distribution/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-0004-fix-5.8.patch
2022-02-05 09:23:32 -05:00

57 lines
2.4 KiB
Diff

diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nvidia-modules-common.mk NVIDIA-Linux-x86_64-340.108-new/kernel/nvidia-modules-common.mk
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nvidia-modules-common.mk 2019-12-11 23:04:24.000000000 +0100
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nvidia-modules-common.mk 2020-08-04 16:18:14.073333322 +0200
@@ -222,6 +222,7 @@
define BUILD_MODULE_RULE
$(1): build-sanity-checks $(3)
@echo "NVIDIA: calling KBUILD..."; \
+ touch .nv-kernel.o.cmd; \
$$(MAKE) "CC=$$(CC)" NV_MODULE_SUFFIX=$$(strip $(2)) $$(KBUILD_PARAMS) modules; \
echo "NVIDIA: left KBUILD."; \
if ! [ -f $(1) ]; then \
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h
--- NVIDIA-Linux-x86_64-340.108-old/kernel/nv-linux.h 2020-08-01 20:34:33.900000000 +0200
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-linux.h 2020-08-03 13:10:17.693333317 +0200
@@ -669,11 +669,19 @@
# define KM_FREE_RECORD(a,b,c)
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+#define NV_VMALLOC(ptr, size) \
+ { \
+ (ptr) = __vmalloc(size, GFP_KERNEL); \
+ VM_ALLOC_RECORD(ptr, size, "vm_vmalloc"); \
+ }
+#else
#define NV_VMALLOC(ptr, size) \
{ \
(ptr) = __vmalloc(size, GFP_KERNEL, PAGE_KERNEL); \
VM_ALLOC_RECORD(ptr, size, "vm_vmalloc"); \
}
+#endif
#define NV_VFREE(ptr, size) \
{ \
diff -Naur NVIDIA-Linux-x86_64-340.108-old/kernel/os-mlock.c NVIDIA-Linux-x86_64-340.108-new/kernel/os-mlock.c
--- NVIDIA-Linux-x86_64-340.108-old/kernel/os-mlock.c 2019-12-11 23:04:24.000000000 +0100
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/os-mlock.c 2020-08-03 13:11:06.536666663 +0200
@@ -44,11 +44,19 @@
return rmStatus;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+ down_read(&mm->mmap_lock);
+ ret = NV_GET_USER_PAGES((unsigned long)address,
+ page_count, write, force, user_pages, NULL);
+ up_read(&mm->mmap_lock);
+ pinned = ret;
+#else
down_read(&mm->mmap_sem);
ret = NV_GET_USER_PAGES((unsigned long)address,
page_count, write, force, user_pages, NULL);
up_read(&mm->mmap_sem);
pinned = ret;
+#endif
if (ret < 0)
{