commit 2a0972fdaacd4ba58f492dade2a100413db8876d
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Wed Aug 12 18:19:47 2020 +0100
Patch for kernel-5.8.0
kernel-5.8.patch | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++
nvidia-340xx-kmod.spec | 9 +++++--
2 files changed, 78 insertions(+), 2 deletions(-)
---
diff --git a/kernel-5.8.patch b/kernel-5.8.patch
new file mode 100644
index 0000000..c345a45
--- /dev/null
+++ b/kernel-5.8.patch
@@ -0,0 +1,71 @@
+diff -Naur a/kernel/nvidia-modules-common.mk b/kernel/nvidia-modules-common.mk
+--- a/kernel/nvidia-modules-common.mk
++++ b/kernel/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/kernel/nv-linux.h b/kernel/nv-linux.h
+--- a/kernel/nv-linux.h 2020-08-08 03:48:46.894783237 +0300
++++ b/kernel/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/kernel/os-mlock.c b/kernel/os-mlock.c
+--- a/kernel/os-mlock.c 2020-04-16 15:37:41.000000000 +0300
++++ b/kernel/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/kernel/uvm/nvidia_uvm_lite_api.c b/kernel/uvm/nvidia_uvm_lite_api.c
+--- a/kernel/uvm/nvidia_uvm_lite_api.c 2020-04-16 15:37:41.000000000 +0300
++++ b/kernel/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
+ //
diff --git a/nvidia-340xx-kmod.spec b/nvidia-340xx-kmod.spec
index 50d74f9..27eb9fa 100644
--- a/nvidia-340xx-kmod.spec
+++ b/nvidia-340xx-kmod.spec
@@ -12,7 +12,7 @@ Name: nvidia-340xx-kmod
Epoch: 1
Version: 340.108
# Taken over by kmodtool
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: NVIDIA display driver kernel module
Group: System Environment/Kernel
License: Redistributable, no modification permitted
@@ -21,6 +21,7 @@ URL:
http://www.nvidia.com/
Source11: nvidia-kmodtool-excludekernel-filterfile
Patch0: nv-linux-arm.patch
Patch1: kernel-5.7.patch
+Patch2: kernel-5.8.patch
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
@@ -48,6 +49,7 @@ kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name}
--filterf
tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{version}-%{_target_cpu}.tar.xz
# patch loop
%patch1 -p1
+%patch2 -p1
%patch0 -p1
for kernel_version in %{?kernel_versions} ; do
@@ -78,8 +80,11 @@ done
%{?akmod_install}
%changelog
+* Wed Aug 12 2020 Leigh Scott <leigh123linux(a)gmail.com> - 1:340.108-6
+- Patch for kernel-5.8.0
+
* Sun Jul 05 2020 Leigh Scott <leigh123linux(a)gmail.com> - 1:340.108-5
-- patch for kernel-5.7.0
+- Patch for kernel-5.7.0
* Mon May 18 2020 Nicolas Chauvet <kwizart(a)gmail.com> - 1:340.108-4
- Bump for current