aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorLenard Spencer <lenardrspencer@gmail.com>2024-02-07 06:36:51 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-02-10 16:09:42 +0700
commit8ef1adcb714dafd5f9c3f16577f743a4a4bf6e42 (patch)
tree3ca6c8e8fbb894e85c2a94e2d34c2b8480dfb128 /system
parent6c9b208ad78ce84b90bd424a04117d72325130cf (diff)
system/nvidia-kernel: Add patch for 6.x kernels.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r--system/nvidia-kernel/nvidia-kernel.SlackBuild5
-rw-r--r--system/nvidia-kernel/nvidia-rcu_read_lock-unlock.patch45
2 files changed, 49 insertions, 1 deletions
diff --git a/system/nvidia-kernel/nvidia-kernel.SlackBuild b/system/nvidia-kernel/nvidia-kernel.SlackBuild
index 6dbd1f281935a..4754352a45c10 100644
--- a/system/nvidia-kernel/nvidia-kernel.SlackBuild
+++ b/system/nvidia-kernel/nvidia-kernel.SlackBuild
@@ -30,7 +30,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=nvidia-kernel
VERSION=${VERSION:-535.154.05}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -87,6 +87,9 @@ find -L . \
(cd kernel || exit 1
+# Patch for latest 6.x kernels:
+patch -p2 < $CWD/nvidia-rcu_read_lock-unlock.patch
+
# CC=${CC:-gcc} suppresses an otherwise harmless "compiler mismatch"
# message. If you custom-build your kernel with clang,
# then pass CC=clang to this script.
diff --git a/system/nvidia-kernel/nvidia-rcu_read_lock-unlock.patch b/system/nvidia-kernel/nvidia-rcu_read_lock-unlock.patch
new file mode 100644
index 0000000000000..124d9a6ddcf3e
--- /dev/null
+++ b/system/nvidia-kernel/nvidia-rcu_read_lock-unlock.patch
@@ -0,0 +1,45 @@
+--- a/kernel/common/inc/nv-linux.h
++++ b/kernel/common/inc/nv-linux.h
+@@ -1990,2 +1990,23 @@
+
++#if defined(CONFIG_HAVE_ARCH_PFN_VALID) || LINUX_VERSION_CODE < KERNEL_VERSION(6,1,76)
++# define nv_pfn_valid pfn_valid
++#else
++/* pre-6.1.76 kernel pfn_valid version without GPL rcu_read_lock/unlock() */
++static inline int nv_pfn_valid(unsigned long pfn)
++{
++ struct mem_section *ms;
++
++ if (PHYS_PFN(PFN_PHYS(pfn)) != pfn)
++ return 0;
++
++ if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
++ return 0;
++
++ ms = __pfn_to_section(pfn);
++ if (!valid_section(ms))
++ return 0;
++
++ return early_section(ms) || pfn_section_valid(ms, pfn);
++}
++#endif
+ #endif /* _NV_LINUX_H_ */
+--- a/kernel/nvidia/nv-mmap.c
++++ b/kernel/nvidia/nv-mmap.c
+@@ -576,3 +576,3 @@
+ if (!IS_REG_OFFSET(nv, access_start, access_len) &&
+- (pfn_valid(PFN_DOWN(mmap_start))))
++ (nv_pfn_valid(PFN_DOWN(mmap_start))))
+ {
+--- a/kernel/nvidia/os-mlock.c
++++ b/kernel/nvidia/os-mlock.c
+@@ -102,3 +102,3 @@
+ if ((nv_follow_pfn(vma, (start + (i * PAGE_SIZE)), &pfn) < 0) ||
+- (!pfn_valid(pfn)))
++ (!nv_pfn_valid(pfn)))
+ {
+@@ -176,3 +176,3 @@
+
+- if (pfn_valid(pfn))
++ if (nv_pfn_valid(pfn))
+ {