Skip to content

Instantly share code, notes, and snippets.

@mcoffin
Created February 22, 2020 01:06
Show Gist options
  • Save mcoffin/26c05bcda029ac95d8bc2a4f878b4784 to your computer and use it in GitHub Desktop.
Save mcoffin/26c05bcda029ac95d8bc2a4f878b4784 to your computer and use it in GitHub Desktop.
diff -prN -U 1 ./nvidia-440.59/common/inc/nv-linux.h ./nvidia-440.59-patched/common/inc/nv-linux.h
--- ./nvidia-440.59/common/inc/nv-linux.h 2020-02-14 18:06:52.000000000 -0700
+++ ./nvidia-440.59-patched/common/inc/nv-linux.h 2020-02-21 13:02:48.000000000 -0700
@@ -531,2 +531,4 @@ static inline void *nv_ioremap(NvU64 phy
+#define ioremap_nocache ioremap
+
static inline void *nv_ioremap_nocache(NvU64 phys, NvU64 size)
diff -prN -U 1 ./nvidia-440.59/common/inc/nv-procfs.h ./nvidia-440.59-patched/common/inc/nv-procfs.h
--- ./nvidia-440.59/common/inc/nv-procfs.h 2020-02-14 18:06:52.000000000 -0700
+++ ./nvidia-440.59-patched/common/inc/nv-procfs.h 2020-02-21 14:02:37.000000000 -0700
@@ -34,6 +34,6 @@
int mode = (S_IFREG | S_IRUGO); \
- const struct file_operations *fops = &nv_procfs_##__name##_fops; \
- if (fops->write != 0) \
+ const struct proc_ops *pops = &nv_procfs_##__name##_pops;\
+ if (pops->proc_write != 0) \
mode |= S_IWUSR; \
- __entry = proc_create_data(filename, mode, parent, fops, __data);\
+ __entry = proc_create_data(filename, mode, parent, pops, __data);\
__entry; \
@@ -115,4 +115,17 @@
.release = nv_procfs_release_##name, \
+ };\
+ static const struct proc_ops nv_procfs_##name##_pops = { \
+ .proc_open = nv_procfs_open_##name,\
+ .proc_read = seq_read,\
+ .proc_lseek = seq_lseek,\
+ .proc_release = nv_procfs_release_##name,\
};
+#ifdef CONFIG_COMPAT
+#define NV_POPS_COMPAT_IOCTL(name) \
+ .proc_compat_ioctl = nv_procfs_##name##_fops.compat_ioctl,
+#else
+#define NV_POPS_COMPAT_IOCTL(name)
+#endif
+
#endif /* CONFIG_PROC_FS */
diff -prN -U 1 ./nvidia-440.59/nvidia/nv-procfs.c ./nvidia-440.59-patched/nvidia/nv-procfs.c
--- ./nvidia-440.59/nvidia/nv-procfs.c 2020-02-14 18:06:52.000000000 -0700
+++ ./nvidia-440.59-patched/nvidia/nv-procfs.c 2020-02-21 14:00:57.000000000 -0700
@@ -463,2 +463,10 @@ static struct file_operations nv_procfs_
+static struct proc_ops nv_procfs_registry_pops = {
+ .proc_open = nv_procfs_open_registry,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_registry,
+};
+
#if defined(CONFIG_PM)
@@ -541,2 +549,9 @@ static struct file_operations nv_procfs_
};
+static struct proc_ops nv_procfs_suspend_depth_pops = {
+ .proc_open = nv_procfs_open_suspend_depth,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_suspend_depth,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release
+};
@@ -623,2 +638,9 @@ static struct file_operations nv_procfs_
};
+static struct proc_ops nv_procfs_suspend_pops = {
+ .proc_open = nv_procfs_open_suspend,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_suspend,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release
+};
#endif
@@ -732,2 +754,7 @@ static struct file_operations nv_procfs_
};
+static struct proc_ops nv_procfs_exercise_error_forwarding_pops = {
+ .proc_open = nv_procfs_open_exercise_error_forwarding,
+ .proc_write = nv_procfs_write_file,
+ .proc_release = nv_procfs_close_exercise_error_forwarding,
+};
@@ -861,2 +888,9 @@ static struct file_operations nv_procfs_
};
+static struct proc_ops nv_procfs_unbind_lock_pops = {
+ .proc_open = nv_procfs_open_unbind_lock,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_unbind_lock,
+};
@@ -1197,2 +1231,9 @@ static const struct file_operations nv_p
};
+static const struct proc_ops nv_procfs_numa_status_pops = {
+ .proc_open = nv_procfs_open_numa_status,
+ .proc_read = seq_read,
+ .proc_write = nv_procfs_write_file,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_numa_status,
+};
@@ -1205,2 +1246,8 @@ static const struct file_operations nv_p
};
+static const struct proc_ops nv_procfs_offline_pages_pops = {
+ .proc_open = nv_procfs_open_offline_pages,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = nv_procfs_close_offline_pages,
+};
diff -prN -U 1 ./nvidia-440.59/nvidia/os-interface.c ./nvidia-440.59-patched/nvidia/os-interface.c
--- ./nvidia-440.59/nvidia/os-interface.c 2020-02-14 18:06:52.000000000 -0700
+++ ./nvidia-440.59-patched/nvidia/os-interface.c 2020-02-21 13:26:47.000000000 -0700
@@ -479,5 +479,7 @@ void NV_API_CALL os_get_current_tick(NvU
{
+ struct timespec64 ts64;
struct timespec ts;
- jiffies_to_timespec(jiffies, &ts);
+ jiffies_to_timespec64(jiffies, &ts64);
+ ts = timespec64_to_timespec(ts64);
diff -prN -U 1 ./nvidia-440.59/nvidia-modeset/nvidia-modeset-linux.c ./nvidia-440.59-patched/nvidia-modeset/nvidia-modeset-linux.c
--- ./nvidia-440.59/nvidia-modeset/nvidia-modeset-linux.c 2020-02-14 18:06:52.000000000 -0700
+++ ./nvidia-440.59-patched/nvidia-modeset/nvidia-modeset-linux.c 2020-02-21 13:37:53.000000000 -0700
@@ -1071,3 +1071,3 @@ nvkms_add_proc_file(const nvkms_procfs_f
new_proc_dir = proc_create_data(file->name, 0, nvkms_proc_dir,
- &nv_procfs_nvkms_proc_fops, file->func);
+ &nv_procfs_nvkms_proc_pops, file->func);
return (new_proc_dir != NULL);
@mcoffin
Copy link
Author

mcoffin commented Aug 28, 2020

@Dragon8oy - sorry I didn't see this, but this is no longer necessary as the latest nvidia drivers are working with the 5.{7,8} kernels :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment