summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2024-02-01 14:58:45 -0500
committerIonen Wolkens <ionen@gentoo.org>2024-02-01 16:05:17 -0500
commitc64caf5352e8b82edbaa2204aaf055cbcabfc8d1 (patch)
tree98938c6af69ba115d3351d08e64faddd7689ad78 /x11-drivers
parentdev-build/dagger: add github upstream metadata (diff)
downloadgentoo-c64caf5352e8b82edbaa2204aaf055cbcabfc8d1.tar.gz
gentoo-c64caf5352e8b82edbaa2204aaf055cbcabfc8d1.tar.bz2
gentoo-c64caf5352e8b82edbaa2204aaf055cbcabfc8d1.zip
x11-drivers/nvidia-drivers: fix build w/ kernel 6.1.76+6.6.15+6.7.3
NVIDIA already confirmed to be planning a release without pfn_valid, so this is temporary until then. May need revisiting for older kernels if change is further backported. bug #923456 could be closed but leaving open for visibility for now. Bug: https://bugs.gentoo.org/923456 Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'x11-drivers')
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-470.223.02-gpl-pfn_valid.patch62
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-470.223.02.ebuild1
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild1
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-535.146.02.ebuild1
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-535.154.05.ebuild1
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-535.43.23.ebuild1
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-545.29.06-r1.ebuild1
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-550.40.07.ebuild1
8 files changed, 69 insertions, 0 deletions
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.223.02-gpl-pfn_valid.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
new file mode 100644
index 000000000000..e0da3fcc2f87
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.223.02-gpl-pfn_valid.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))
+ {
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-470.223.02.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.223.02.ebuild
index 36142dbc5a6d..1dc53d0b7a19 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-470.223.02.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.223.02.ebuild
@@ -83,6 +83,7 @@ QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
PATCHES=(
"${FILESDIR}"/nvidia-drivers-470.141.03-clang15.patch
+ "${FILESDIR}"/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
"${FILESDIR}"/nvidia-settings-390.144-desktop.patch
"${FILESDIR}"/nvidia-settings-390.144-no-gtk2.patch
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild
index 88e1b916d113..3b43c86bcab8 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.147.05.ebuild
@@ -87,6 +87,7 @@ BDEPEND="
QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
PATCHES=(
+ "${FILESDIR}"/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
"${FILESDIR}"/nvidia-drivers-525.116.04-clang-unused-option.patch
"${FILESDIR}"/nvidia-drivers-525.147.05-gcc14.patch
"${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-535.146.02.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-535.146.02.ebuild
index 4c38e242a855..38ad82d3c314 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-535.146.02.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-535.146.02.ebuild
@@ -88,6 +88,7 @@ BDEPEND="
QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
PATCHES=(
+ "${FILESDIR}"/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
"${FILESDIR}"/nvidia-drivers-525.147.05-gcc14.patch
"${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-535.154.05.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-535.154.05.ebuild
index 4c38e242a855..38ad82d3c314 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-535.154.05.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-535.154.05.ebuild
@@ -88,6 +88,7 @@ BDEPEND="
QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
PATCHES=(
+ "${FILESDIR}"/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
"${FILESDIR}"/nvidia-drivers-525.147.05-gcc14.patch
"${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.23.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.23.ebuild
index 5e197cccc108..8dbcdaa46159 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.23.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-535.43.23.ebuild
@@ -91,6 +91,7 @@ BDEPEND="
QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
PATCHES=(
+ "${FILESDIR}"/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
"${FILESDIR}"/nvidia-drivers-525.147.05-gcc14.patch
"${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-545.29.06-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-545.29.06-r1.ebuild
index e22d74f46e2c..59fb67e327b0 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-545.29.06-r1.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-545.29.06-r1.ebuild
@@ -87,6 +87,7 @@ BDEPEND="
QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
PATCHES=(
+ "${FILESDIR}"/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
"${FILESDIR}"/nvidia-drivers-525.147.05-gcc14.patch
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
"${FILESDIR}"/nvidia-settings-530.30.02-desktop.patch
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.07.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.07.ebuild
index 3c3500782cb2..e52744d51ff0 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.07.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-550.40.07.ebuild
@@ -88,6 +88,7 @@ BDEPEND="
QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
PATCHES=(
+ "${FILESDIR}"/nvidia-drivers-470.223.02-gpl-pfn_valid.patch
"${FILESDIR}"/nvidia-drivers-525.147.05-gcc14.patch
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
"${FILESDIR}"/nvidia-settings-530.30.02-desktop.patch