nvidia-340xx/buildfix_kernel_5.8.patch
2020-08-15 05:37:50 -04:00

71 lines
2.3 KiB
Diff

diff -Naur a/nvidia-modules-common.mk b/nvidia-modules-common.mk
--- a/nvidia-modules-common.mk
+++ b/nvidia-modules-common.mk
@@ -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 -Naru a/nv-linux.h b/nv-linux.h
--- a/nv-linux.h 2020-08-08 03:48:46.894783237 +0300
+++ b/nv-linux.h 2020-08-08 15:43:05.252047541 +0300
@@ -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 -Naru a/os-mlock.c b/os-mlock.c
--- a/os-mlock.c 2020-04-16 15:37:41.000000000 +0300
+++ b/os-mlock.c 2020-08-08 15:47:44.793311179 +0300
@@ -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)
{
diff -Naru a/uvm/nvidia_uvm_lite_api.c b/uvm/nvidia_uvm_lite_api.c
--- a/uvm/nvidia_uvm_lite_api.c 2020-04-16 15:37:41.000000000 +0300
+++ b/uvm/nvidia_uvm_lite_api.c 2020-08-08 15:28:40.110186418 +0300
@@ -30,6 +30,10 @@
#include "uvm_gpu_ops_tests.h"
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+#define mmap_sem mmap_lock
+#endif
+
//
// nvidia_uvm_lite_api.c
//