diff options
author | Daniel Bermond | 2024-02-02 17:29:59 -0300 |
---|---|---|
committer | Daniel Bermond | 2024-02-02 17:29:59 -0300 |
commit | 4aa19ade390161712389e643950d7f3443b4ba31 (patch) | |
tree | 77380db7052b1028efba275b06b81472b3cbb5a5 | |
parent | 6ec726a001c61d2b9e4d3669af66c151e411e36c (diff) | |
download | aur-4aa19ade390161712389e643950d7f3443b4ba31.tar.gz |
Add fix for linux 6.7.3 and 6.6.15
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | 130-nvidia-linux-fix.patch | 62 | ||||
-rw-r--r-- | PKGBUILD | 12 |
3 files changed, 74 insertions, 4 deletions
@@ -1,7 +1,7 @@ pkgbase = nvidia-beta-dkms pkgdesc = NVIDIA driver sources for linux (beta version) pkgver = 550.40.07 - pkgrel = 1 + pkgrel = 2 url = https://www.nvidia.com/ arch = x86_64 license = custom @@ -15,9 +15,11 @@ pkgbase = nvidia-beta-dkms source = https://us.download.nvidia.com/XFree86/Linux-x86_64/550.40.07/NVIDIA-Linux-x86_64-550.40.07-no-compat32.run source = 110-nvidia-change-dkms-conf.patch source = 120-nvidia-linux-rt-gift.patch + source = 130-nvidia-linux-fix.patch sha256sums = 6d32940a6f4b92f534b42d68aa0974a7fcd6b5c0abb4d900b43c07f2326da85a sha256sums = 4d18fbf00ffde21d22fee704c94c041e27aab2074a95dfff25d4666a6fcba9dd sha256sums = 291bc6568e18496a4c2e732fd8616f6d536d8e9f3ab51f1959e3fc08f0de126b + sha256sums = 59958c134261a53edb641ba3c96b13e397d1903ec3637c8be8d61141356292de pkgname = nvidia-beta-dkms depends = dkms diff --git a/130-nvidia-linux-fix.patch b/130-nvidia-linux-fix.patch new file mode 100644 index 000000000000..e0da3fcc2f87 --- /dev/null +++ b/130-nvidia-linux-fix.patch @@ -0,0 +1,62 @@ +linux-6.1.76, 6.6.15, and 6.7.3 have modified the non-ARCH-specific +pfn_valid() to use __rcu_read_lock/unlock[1] that is marked GPL and +cannot be used here[2][3][4] unless use the open source variant. + +As a workaround, reuse the old implementation until NVIDIA makes +a fixed release (due to no longer be using pfn_valid[5], likely +with its own implementation similarly to this patch). + +Safe to use with kernel >=5.15 or so but older ones had a different +pfn_valid implementation. However 5.15 and older branches are +"currently" not affected, so simply limit to >=6.1.76. + +[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/include/linux/mmzone.h?h=v6.7.3&id=3a01daace71b521563c38bbbf874e14c3e58adb7 +[2] https://bugs.gentoo.org/923456 +[3] https://forums.developer.nvidia.com/t/280908 +[4] https://github.com/NVIDIA/open-gpu-kernel-modules/issues/594 +[5] https://github.com/NVIDIA/open-gpu-kernel-modules/issues/594#issuecomment-1916197641 +--- 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)) + { @@ -10,7 +10,7 @@ pkgname=nvidia-beta-dkms pkgver=550.40.07 -pkgrel=1 +pkgrel=2 pkgdesc='NVIDIA driver sources for linux (beta version)' arch=('x86_64') url='https://www.nvidia.com/' @@ -22,10 +22,12 @@ options=('!strip') _pkg="NVIDIA-Linux-${CARCH}-${pkgver}-no-compat32" source=("https://us.download.nvidia.com/XFree86/Linux-${CARCH}/${pkgver}/${_pkg}.run" '110-nvidia-change-dkms-conf.patch' - '120-nvidia-linux-rt-gift.patch') + '120-nvidia-linux-rt-gift.patch' + '130-nvidia-linux-fix.patch') sha256sums=('6d32940a6f4b92f534b42d68aa0974a7fcd6b5c0abb4d900b43c07f2326da85a' '4d18fbf00ffde21d22fee704c94c041e27aab2074a95dfff25d4666a6fcba9dd' - '291bc6568e18496a4c2e732fd8616f6d536d8e9f3ab51f1959e3fc08f0de126b') + '291bc6568e18496a4c2e732fd8616f6d536d8e9f3ab51f1959e3fc08f0de126b' + '59958c134261a53edb641ba3c96b13e397d1903ec3637c8be8d61141356292de') prepare() { # extract the source file @@ -35,6 +37,10 @@ prepare() { patch -d "$_pkg" -Np1 -i "${srcdir}/110-nvidia-change-dkms-conf.patch" patch -d "$_pkg" -Np1 -i "${srcdir}/120-nvidia-linux-rt-gift.patch" + + # fix incompat with Linux 6.6.15 and 6.7.3 + # from Gentoo at https://github.com/gentoo/gentoo/commit/c64caf5352e8b82edbaa2204aaf055cbcabfc8d1 + patch -d "$_pkg" -Np1 -i "${srcdir}/130-nvidia-linux-fix.patch" } package() { |