331.38 on 3.14-rc1 kernel

Did someone made a patch for 3.14-rc1 kernel?

This is the dkms make.log: DKMS make.log for nvidia-331.38 for kernel 3.14.0-rc1-core2duo (x86_64)Mon Feb - Pastebin.com

I seem to be bitten by https://devtalk.nvidia.com/default/topic/567297/linux/linux-3-10-driver-crash, so I can’t verify, but the nature of the patch tells me that the following should do:

diff -Naurp nvidia-331-331.38.orig/dkms.conf nvidia-331-331.38/dkms.conf
--- nvidia-331-331.38.orig/dkms.conf	2014-01-14 12:52:58.000000000 +0100
+++ nvidia-331-331.38/dkms.conf	2014-02-04 00:24:49.412260941 +0100
@@ -11,3 +11,4 @@ AUTOINSTALL="yes"
 #PATCH[1]="buildfix_kernel_3.10.patch"
 #PATCH_MATCH[1]="^3.[10-11]"
 PATCH[0]="buildfix_kernel_3.13.patch"
+PATCH[1]="buildfix_kernel_3.14.patch"
diff -Naurp nvidia-331-331.38.orig/patches/buildfix_kernel_3.14.patch nvidia-331-331.38/patches/buildfix_kernel_3.14.patch
--- nvidia-331-331.38.orig/patches/buildfix_kernel_3.14.patch	1970-01-01 01:00:00.000000000 +0100
+++ nvidia-331-331.38/patches/buildfix_kernel_3.14.patch	2014-02-04 00:23:33.816258917 +0100
@@ -0,0 +1,15 @@
+diff -Naurp nvidia-331-331.38.orig/nv-linux.h nvidia-331-331.38/nv-linux.h
+--- nvidia-331-331.38.orig/nv-linux.h	2014-02-04 00:20:25.756253881 +0100
++++ nvidia-331-331.38/nv-linux.h	2014-02-04 00:22:32.076257264 +0100
+@@ -268,6 +268,11 @@ extern int nv_pat_mode;
+ #if !defined(NV_VMWARE) && defined(CONFIG_ACPI)
+ #include <acpi/acpi.h>
+ #include <acpi/acpi_drivers.h>
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
++#include <acpi/acpi_bus.h>
++#endif
++
+ #if defined(NV_ACPI_DEVICE_OPS_HAS_MATCH) || defined(ACPI_VIDEO_HID)
+ #define NV_LINUX_ACPI_EVENTS_SUPPORTED 1
+ #endif

The explanation of the above is that nv-linux.h includes <acpi/acpi-drivers.h> which, in the past, must in turn have included <acpi/acpi_bus.h> but, apparently, no longer does so.

My patch creates a patch (yeah, I’m meta like that) in patches/ that dkms.conf says to apply, and said patch says that if the kernel version is 3.14 or above, include <acpi/acpi_bus.h>.

As said, I cannot verify functionality, but it compiles, and the nature of the fix tells me that it should work just fine, as long as the driver worked for you beforehand, and as long as 3.14 doesn’t cause the driver to show other oddities that cannot be ascertained at compile-time.

How to you get this patch to run? I tried using patch command, but was unsuccessful. I’m sure others would also benefit if you could include this information. I would appreciate it.

This patch will get the driver to compile, but will still not allow it to work on EFI systems without CSM and it will still have broken backlight control on all laptops.

There is something wacky going on with ACPI. I am trying to get to the bottom of it, but I haven’t gotten anything yet.

This patch doesn’t work for me. I still get the same errors on DKMS module compile as before.

Come to think of it, I did diff against /usr/src/nvidia-331-331.38 from the Ubuntu packages which might explain why it fails to patch for you guys - sorry about that.

Try editing nv-linux.h manually, finding the place where it says

#include <acpi/acpi_drivers.h>

and adding

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
#include <acpi/acpi_bus.h>
#endif

after that.

Incidentally, I discovered that I may not have hit the bug I mentioned above after all, but perhaps rather what mamarly referred to above, which I seem to have gotten going for me.

Try:

--- nvidia-331-331.38.orig/nv-linux.h	2014-02-04 00:20:25.756253881 +0100
+++ nvidia-331-331.38/nv-linux.h	2014-02-04 04:25:44.415803558 +0100
@@ -267,6 +267,7 @@ extern int nv_pat_mode;
 
 #if !defined(NV_VMWARE) && defined(CONFIG_ACPI)
-#include <acpi/acpi.h>
+#include <linux/acpi.h>
 #include <acpi/acpi_drivers.h>
 #if defined(NV_ACPI_DEVICE_OPS_HAS_MATCH) || defined(ACPI_VIDEO_HID)
 #define NV_LINUX_ACPI_EVENTS_SUPPORTED 1

and

--- nvidia-331-331.38.orig/nv-acpi.c	2014-02-03 22:25:39.750114792 +0100
+++ nvidia-331-331.38/nv-acpi.c	2014-02-04 13:24:30.256642614 +0100
@@ -1076,10 +1076,15 @@ RM_STATUS NV_API_CALL nv_acpi_dsm_method
     NvU8 argument3[4]; /* For all DSM sub functions, input size is 4 */
     NvU32 data_size;
     acpi_handle dev_handle  = NULL;
+#ifdef ACPI_HANDLE
+    nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); 
+    dev_handle = ACPI_HANDLE(&nvl->dev->dev);
+#else
 #ifdef DEVICE_ACPI_HANDLE
     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); 
     dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev);
 #endif
+#endif
 
     if (!dev_handle)
         return RM_ERR_NOT_SUPPORTED;
@@ -1179,12 +1184,17 @@ RM_STATUS NV_API_CALL nv_acpi_ddc_method
     NvU32 i;
     acpi_handle dev_handle  = NULL;
     acpi_handle lcd_dev_handle  = NULL;
+#ifdef ACPI_HANDLE
+    nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); 
+    dev_handle = ACPI_HANDLE(&nvl->dev->dev);
+#else
 #ifdef DEVICE_ACPI_HANDLE
     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); 
     dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev);
 #else
         return RM_ERR_NOT_SUPPORTED;
 #endif
+#endif
     if (!dev_handle)
         return RM_ERR_INVALID_ARGUMENT;
 
@@ -1294,13 +1304,17 @@ RM_STATUS NV_API_CALL nv_acpi_rom_method
     struct acpi_object_list input = { 2, rom_arg };
     acpi_handle dev_handle  = NULL;
     uint32_t offset, length;
+#ifdef ACPI_HANDLE
+    nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); 
+    dev_handle = ACPI_HANDLE(&nvl->dev->dev);
+#else
 #ifdef DEVICE_ACPI_HANDLE
     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); 
     dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev);
 #else
     return RM_ERR_NOT_SUPPORTED;
 #endif
-
+#endif
     if (!dev_handle)
         return RM_ERR_INVALID_ARGUMENT;
 
@@ -1364,13 +1378,17 @@ RM_STATUS NV_API_CALL nv_acpi_dod_method
     union acpi_object *dod;
     acpi_handle dev_handle = NULL;
     NvU32 i, count = (*pSize / sizeof(NvU32));
+#ifdef ACPI_HANDLE
+    nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+    dev_handle = ACPI_HANDLE(&nvl->dev->dev);
+#else
 #ifdef DEVICE_ACPI_HANDLE
     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
     dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev);
 #else
     return RM_ERR_NOT_SUPPORTED;
 #endif
-
+#endif
     if (!dev_handle)
         return RM_ERR_INVALID_ARGUMENT;

Since 3.13, you should also use

--- a/nv-acpi.c
+++ b/nv-acpi.c
@@ -303,7 +303,9 @@ static int nv_acpi_remove(struct acpi_device *device, int type)
 
     if (pNvAcpiObject->notify_handler_installed)
     {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
         NV_ACPI_OS_WAIT_EVENTS_COMPLETE();
+#endif
 
         // remove event notifier
         status = acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, nv_acpi_event);

Save those snippets to files, and for each of the do

patch -p1 < filename

in the sources dir.

That should then work

I patched it manualy, and I had to use 3.13 patch from Arch git repo to make it compile. I’m writting this from 3.14-rc1 with NVIDIA drivers now. :)

I used the patch for 3.14 from the second post.

Good to hear :-)

I may have further simplified the change, however, since it would seem that changing

#include <acpi/acpi.h>

to

#include <linux/acpi.h>

is enough - at least to get it to compile (this is the first of the three patches in #7)

The second patch is what it further took for me to actually get X running - which I hadn’t managed since 3.12, which I think is the bug that mamarly referred to :-)

Yeah, probably. I had it running in 3.13 (DEVICE_ACPI_HANDLE() got renamed to ACPI_HANDLE()), but I am still working on getting it running in 3.14.

OK, I have it working now!

The first patch from #7 is mostly correct, but the “#include <acpi/acpi_drivers.h>” line should be removed. That allows the driver (and Xorg) to start on my UEFI without CSM system.

Yes, I assume that’s included by <linux/acpi.h>

I shall return with a unified patch when I have the time and thank you for noticing!

It was a bit more than “noticing.” :) I spent the better part of two days bisecting the changes between 3.13 and 3.14-rc1 to find what was causing it to fail to start X.

In that case, I’m most sorry for the understatement.

For my own part, though, and as stated above, I spent the whole 3.13 cycle believing I was bitten by the wrong bug, and then got everything working last night with the above patches, inspired by something I read somewhere I can’t even remember.

Mostly, I just got into it, though, since it wouldn’t compile on 3.14-rc1 at all initially - a release that I hoped would fix the bug that I wasn’t bitten by after all :-)

No problem, I just wanted to explain why it took me so long to get that done.

s_molgaard - I tried using the patch command as you described with each snippet you posted and still am unable to get the driver to compile. I also tried the --apply-patch command with the driver *.run installer, and that also asked which file to patch. So I tried adding the /a and /b to the two lines, and that did not work either. Did you save each snippet as it’s own .patch file or did you manually enter something? Could you please describe how you patched the extracted driver source directory or particular files? Maybe I’m missing something or I’m just a little slow, because others seem to get it working. I would be very pleased if anyone could explain how they did this. I am running debian Jessie/sid, so maybe these edits might not work since it looks like your diffing against an arch repo driver. I’m not that good at development so any help would be much appreciated… Actually I was able to patch everything as described, but I still can’t compile for some reason. The nvidia-installer is still error’n out on acpi.h. maybe I’m missing something. I had to remove the acpi_drivers.h or whatever “drivers line” like the others did. I’ll try the arch driver/patch and see what happens, if not; I’ll post the nvidia-installer.log file in case you plan on building your own driver. Thanks for your help

Maybe I can answer that question.
I applied it manualy, by opening the file from extracted driver directory, and copy-pasting lines from the patch file to it. I’m running Ubuntu, and .run file from nvidia site, but I used arch repo 3.13 patch and the patch from #2 post

The package nvidia-full-beta-all and nvidia-full-beta in ArchLinux AUR have been updated and contain a nvidia-linux-3.14.patch which works fine.

https://aur.archlinux.org/packages/nvidia-full-beta-all/

Hello I,m new to forumn I have been trying to patch the 331.38 for 3 days and still no luck. Lots of black screens.
I have Ubuntu 13.10 Saucy kernel 3.14.0-rc1+
Video card- NVIDIA Corporation GF119 [GeForce GT 610] (rev a1)

From the link above in “post#18” I tried to manually add “nvidia-Linux-3.14.patch” to the driver 331.38 “nv-linux.h” file. Is this a good correct way to do this?

No luck so From the terminal I also tried “patch -p1 > nvidia-linux-3.14.patch”
But patch command just hangs and does nothing.

Am I doing this right I need to patch the “nv-linux.h” file using 331.38 ?
I’ll try again with milos_sd’s way again in post 17

Sorry but being new to patching I’m stuck! Any help here appreciated Thanks

Wanted to add I’m using (64)bit. A week ago a I had ver 304.117 working with kernel 3.13 from the repository ppa:xorg-edgers/ppa

But with what I do on my machine I’m up to kernel 3.14 now so anyways,

Thought I’d share. Thanks for all your work