Patches for Nvidia Graphics Drivers (nvidia-kernel-dkms)

Jessie Frazelle jess at linux.com
Sun Apr 5 00:42:49 UTC 2015


The following are patches so nvidia-kernel-dkms works on kernel 3.19 &
kernel 4.0.0, I split into 2 packages because I understand if you do
not want the 4.0.0 patch because it is still in the testing cycle.

Here is the first for 3.19+

Index: nvidia-graphics-drivers/nv-drm.c
===================================================================
--- nvidia-graphics-drivers.orig/nv-drm.c
+++ nvidia-graphics-drivers/nv-drm.c
@@ -128,6 +128,10 @@ static struct drm_driver nv_drm_driver =
     .gem_prime_vmap = nv_gem_prime_vmap,
     .gem_prime_vunmap = nv_gem_prime_vunmap,

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+    .set_busid = drm_pci_set_busid,
+#endif
+
     .name = "nvidia-drm",
     .desc = "NVIDIA DRM driver",
     .date = "20130102",
Index: nvidia-graphics-drivers/nv-frontend.c
===================================================================
--- nvidia-graphics-drivers.orig/nv-frontend.c
+++ nvidia-graphics-drivers/nv-frontend.c
@@ -327,7 +327,7 @@ long nvidia_frontend_unlocked_ioctl(
     unsigned long i_arg
 )
 {
-    return nvidia_frontend_ioctl(file->f_dentry->d_inode, file, cmd, i_arg);
+    return nvidia_frontend_ioctl(file->f_path.dentry->d_inode, file,
cmd, i_arg);
 }

 long nvidia_frontend_compat_ioctl(
@@ -336,7 +336,7 @@ long nvidia_frontend_compat_ioctl(
     unsigned long i_arg
 )
 {
-    return nvidia_frontend_ioctl(file->f_dentry->d_inode, file, cmd, i_arg);
+    return nvidia_frontend_ioctl(file->f_path.dentry->d_inode, file,
cmd, i_arg);
 }

 int nvidia_frontend_mmap(
Index: nvidia-graphics-drivers/nv.c
===================================================================
--- nvidia-graphics-drivers.orig/nv.c
+++ nvidia-graphics-drivers/nv.c
@@ -1824,7 +1824,7 @@ nvidia_unlocked_ioctl(
     unsigned long i_arg
 )
 {
-    return nvidia_ioctl(file->f_dentry->d_inode, file, cmd, i_arg);
+    return nvidia_ioctl(file->f_path.dentry->d_inode, file, cmd, i_arg);
 }

 /*


--------------------------------------------------------------------------------------------------


Here is the patch for kernel 4.0.0:

Index: nvidia-graphics-drivers/nv-pat.c
===================================================================
--- nvidia-graphics-drivers.orig/nv-pat.c
+++ nvidia-graphics-drivers/nv-pat.c
@@ -35,8 +35,14 @@ static inline void nv_disable_caches(uns
     unsigned long cr0 = read_cr0();
     write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
     wbinvd();
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
     *cr4 = read_cr4();
     if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
+#else
+    *cr4 = __read_cr4();
+    if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
+#endif
     __flush_tlb();
 }

@@ -46,7 +52,11 @@ static inline void nv_enable_caches(unsi
     wbinvd();
     __flush_tlb();
     write_cr0((cr0 & 0x9fffffff));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
     if (cr4 & 0x80) write_cr4(cr4);
+#else
+    if (cr4 & 0x80) __write_cr4(cr4);
+#endif
 }

 static int nv_determine_pat_mode(void)


--------------------------------------------------------------------------------------------------


Hopefully you find this helpful. I was unsure how to do the patch on
your repo because it is using the binary .run files from nvidia,
unless I was looking at it incorrectly. I could not understand how you
all were tracking the source. But am open to helping if it was a
misunderstanding on my part. Thanks so much!

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC  511E 18F3 685C 0022 BFF3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixes-for-kernel-4.0.0.patch
Type: text/x-patch
Size: 910 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-nvidia-devel/attachments/20150405/c1c39cbc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixes-for-kernel-3.19.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-nvidia-devel/attachments/20150405/c1c39cbc/attachment-0001.bin>


More information about the pkg-nvidia-devel mailing list