diff options
author | Lenard Spencer <lenardrspencer@gmail.com> | 2024-02-07 06:33:03 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-02-10 16:09:41 +0700 |
commit | 8b33a40697854ad6d3e2fade5eb06fbd6d759ddf (patch) | |
tree | a36e20fcf425dc857646552bede0c4d2afafb01b /system/nvidia-legacy470-kernel | |
parent | 0075097b11c9203f2060287495c9292a8a7b3d51 (diff) |
system/nvidia-legacy470-kernel: Add patch for 6.x kernels.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/nvidia-legacy470-kernel')
-rw-r--r-- | system/nvidia-legacy470-kernel/nvidia-legacy470-kernel.SlackBuild | 8 | ||||
-rw-r--r-- | system/nvidia-legacy470-kernel/nvidia-rcu_read_lock-unlock.patch | 45 |
2 files changed, 52 insertions, 1 deletions
diff --git a/system/nvidia-legacy470-kernel/nvidia-legacy470-kernel.SlackBuild b/system/nvidia-legacy470-kernel/nvidia-legacy470-kernel.SlackBuild index 1ff05194d5412..d38d694295f83 100644 --- a/system/nvidia-legacy470-kernel/nvidia-legacy470-kernel.SlackBuild +++ b/system/nvidia-legacy470-kernel/nvidia-legacy470-kernel.SlackBuild @@ -32,7 +32,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=nvidia-legacy470-kernel VERSION=${VERSION:-470.223.02} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -58,6 +58,9 @@ else exit 1 fi +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$PKGVER-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 @@ -86,6 +89,9 @@ find -L . \ unset ARCH +# Patch for latest 6.x kernels: +patch -p2 < $CWD/nvidia-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-legacy470-kernel/nvidia-rcu_read_lock-unlock.patch b/system/nvidia-legacy470-kernel/nvidia-rcu_read_lock-unlock.patch new file mode 100644 index 0000000000000..124d9a6ddcf3e --- /dev/null +++ b/system/nvidia-legacy470-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)) + { |