commit 6e828d30f46411050830c2246f900a8624557981
Author: Sérgio M. Basto <sergio(a)serjux.com>
Date: Sun Nov 10 01:22:09 2024 +0000
Update Debian patches
...valid-w-o-GPL-rcu_read_lock-unlock-from-v.patch | 95 ++--------------------
...ackport-follow_pfn-changes-from-550.90.07.patch | 79 ++++++++++++++++++
...t_addr_valid-macro-use-nv_pfn_valid-on-pp.patch | 28 +++++++
..._get_kern_phys_address-changes-from-555.4.patch | 25 ++++++
nvidia-470xx-kmod.spec | 14 +++-
5 files changed, 153 insertions(+), 88 deletions(-)
---
diff --git a/kernel-610-buildfix.patch
b/0037-import-pfn_valid-w-o-GPL-rcu_read_lock-unlock-from-v.patch
similarity index 50%
rename from kernel-610-buildfix.patch
rename to 0037-import-pfn_valid-w-o-GPL-rcu_read_lock-unlock-from-v.patch
index f01f227..433660b 100644
--- a/kernel-610-buildfix.patch
+++ b/0037-import-pfn_valid-w-o-GPL-rcu_read_lock-unlock-from-v.patch
@@ -1,4 +1,4 @@
-From 8ab6949372810eb4ea617b1c0ad42c07eec6c624 Mon Sep 17 00:00:00 2001
+From b459a16515766b157b4b0b29102cece1eacf2a12 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <anbe(a)debian.org>
Date: Thu, 1 Feb 2024 14:58:45 -0500
Subject: [PATCH] import pfn_valid() w/o GPL rcu_read_lock/unlock from v6.8-rc3
@@ -43,12 +43,12 @@ Origin: gentoo,
https://github.com/gentoo/gentoo/blob/c64caf53/x11-drivers/nvidi
1 file changed, 33 insertions(+)
diff --git a/common/inc/nv-linux.h b/common/inc/nv-linux.h
-index e095a89..a17fb08 100644
+index e095a89..7f93fd0 100644
--- a/common/inc/nv-linux.h
+++ b/common/inc/nv-linux.h
-@@ -2014,6 +2014,39 @@ static inline void nv_mutex_destroy(struct mutex *lock)
-
- }
+@@ -1987,6 +1987,39 @@ static inline NvU32 nv_default_irq_flags(nv_state_t *nv)
+ #define NV_SET_CLOSE_ON_EXEC(fd, fdt) __set_bit(fd, fdt->close_on_exec)
+ #endif
+#if (!defined(CONFIG_HAVE_ARCH_PFN_VALID)) && \
+ ((LINUX_VERSION_CODE == KERNEL_VERSION(6,7,3)) || \
@@ -83,86 +83,9 @@ index e095a89..a17fb08 100644
+# define nv_pfn_valid pfn_valid
+#endif
+
- #define NV_CHECK_EXPORT_SYMBOL(symbol) (NV_IS_EXPORT_SYMBOL_PRESENT_##symbol &&
\
- !NV_IS_EXPORT_SYMBOL_GPL_##symbol)
- #endif /* _NV_LINUX_H_ */
-From 910bd390666769db4e3522e01cabefceb1952947 Mon Sep 17 00:00:00 2001
-From: Andreas Beckmann <anbe(a)debian.org>
-Date: Tue, 23 Jul 2024 21:49:33 +0200
-Subject: [PATCH] backport follow_pfn changes from 550.90.07
-
----
- conftest.sh | 16 +++++++++-------
- nvidia/nvidia.Kbuild | 2 +-
- nvidia/os-mlock.c | 6 +++---
- 3 files changed, 13 insertions(+), 11 deletions(-)
-
-diff --git a/conftest.sh b/conftest.sh
-index 98af501..d5a5845 100755
---- a/conftest.sh
-+++ b/conftest.sh
-@@ -4685,20 +4685,22 @@ compile_test() {
- compile_check_conftest "$CODE"
"NV_SG_PAGE_ITER_PAGE_PRESENT" "" "functions"
- ;;
-
-- unsafe_follow_pfn)
-+ follow_pfn)
- #
-- # Determine if unsafe_follow_pfn() is present.
-+ # Determine if follow_pfn() is present.
- #
-- # unsafe_follow_pfn() was added by commit 69bacee7f9ad
-- # ("mm: Add unsafe_follow_pfn") in v5.13-rc1.
-+ # follow_pfn() was added by commit 3b6748e2dd69
-+ # ("mm: introduce follow_pfn()") in v2.6.31-rc1, and removed
-+ # by commit 233eb0bf3b94 ("mm: remove follow_pfn")
-+ # from linux-next 233eb0bf3b94.
- #
- CODE="
- #include <linux/mm.h>
-- void conftest_unsafe_follow_pfn(void) {
-- unsafe_follow_pfn();
-+ void conftest_follow_pfn(void) {
-+ follow_pfn();
- }"
-
-- compile_check_conftest "$CODE"
"NV_UNSAFE_FOLLOW_PFN_PRESENT" "" "functions"
-+ compile_check_conftest "$CODE" "NV_FOLLOW_PFN_PRESENT"
"" "functions"
- ;;
-
- drm_plane_atomic_check_has_atomic_state_arg)
-diff --git a/nvidia/nvidia.Kbuild b/nvidia/nvidia.Kbuild
-index 44990d3..31a6f92 100644
---- a/nvidia/nvidia.Kbuild
-+++ b/nvidia/nvidia.Kbuild
-@@ -164,7 +164,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += cc_mkdec
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += iterate_fd
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += seq_read_iter
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += sg_page_iter_page
--NV_CONFTEST_FUNCTION_COMPILE_TESTS += unsafe_follow_pfn
-+NV_CONFTEST_FUNCTION_COMPILE_TESTS += follow_pfn
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_get
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_put_unlocked
- NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_close_on_exec
-diff --git a/nvidia/os-mlock.c b/nvidia/os-mlock.c
-index fb0bcd3..607f2f1 100644
---- a/nvidia/os-mlock.c
-+++ b/nvidia/os-mlock.c
-@@ -17,10 +17,10 @@ static inline int nv_follow_pfn(struct vm_area_struct *vma,
- unsigned long address,
- unsigned long *pfn)
- {
--#if defined(NV_UNSAFE_FOLLOW_PFN_PRESENT)
-- return unsafe_follow_pfn(vma, address, pfn);
--#else
-+#if defined(NV_FOLLOW_PFN_PRESENT)
- return follow_pfn(vma, address, pfn);
-+#else
-+ return -1;
- #endif
- }
-
+ #define MODULE_BASE_NAME "nvidia"
+ #define MODULE_INSTANCE_NUMBER 0
+ #define MODULE_INSTANCE_STRING ""
--
-2.20.1
-
+2.39.5
diff --git a/0043-backport-follow_pfn-changes-from-550.90.07.patch
b/0043-backport-follow_pfn-changes-from-550.90.07.patch
new file mode 100644
index 0000000..c338fb9
--- /dev/null
+++ b/0043-backport-follow_pfn-changes-from-550.90.07.patch
@@ -0,0 +1,79 @@
+From 910bd390666769db4e3522e01cabefceb1952947 Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe(a)debian.org>
+Date: Tue, 23 Jul 2024 21:49:33 +0200
+Subject: [PATCH] backport follow_pfn changes from 550.90.07
+
+---
+ conftest.sh | 16 +++++++++-------
+ nvidia/nvidia.Kbuild | 2 +-
+ nvidia/os-mlock.c | 6 +++---
+ 3 files changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/conftest.sh b/conftest.sh
+index 98af501..d5a5845 100755
+--- a/conftest.sh
++++ b/conftest.sh
+@@ -4685,20 +4685,22 @@ compile_test() {
+ compile_check_conftest "$CODE"
"NV_SG_PAGE_ITER_PAGE_PRESENT" "" "functions"
+ ;;
+
+- unsafe_follow_pfn)
++ follow_pfn)
+ #
+- # Determine if unsafe_follow_pfn() is present.
++ # Determine if follow_pfn() is present.
+ #
+- # unsafe_follow_pfn() was added by commit 69bacee7f9ad
+- # ("mm: Add unsafe_follow_pfn") in v5.13-rc1.
++ # follow_pfn() was added by commit 3b6748e2dd69
++ # ("mm: introduce follow_pfn()") in v2.6.31-rc1, and removed
++ # by commit 233eb0bf3b94 ("mm: remove follow_pfn")
++ # from linux-next 233eb0bf3b94.
+ #
+ CODE="
+ #include <linux/mm.h>
+- void conftest_unsafe_follow_pfn(void) {
+- unsafe_follow_pfn();
++ void conftest_follow_pfn(void) {
++ follow_pfn();
+ }"
+
+- compile_check_conftest "$CODE"
"NV_UNSAFE_FOLLOW_PFN_PRESENT" "" "functions"
++ compile_check_conftest "$CODE" "NV_FOLLOW_PFN_PRESENT"
"" "functions"
+ ;;
+
+ drm_plane_atomic_check_has_atomic_state_arg)
+diff --git a/nvidia/nvidia.Kbuild b/nvidia/nvidia.Kbuild
+index 44990d3..31a6f92 100644
+--- a/nvidia/nvidia.Kbuild
++++ b/nvidia/nvidia.Kbuild
+@@ -164,7 +164,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += cc_mkdec
+ NV_CONFTEST_FUNCTION_COMPILE_TESTS += iterate_fd
+ NV_CONFTEST_FUNCTION_COMPILE_TESTS += seq_read_iter
+ NV_CONFTEST_FUNCTION_COMPILE_TESTS += sg_page_iter_page
+-NV_CONFTEST_FUNCTION_COMPILE_TESTS += unsafe_follow_pfn
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += follow_pfn
+ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_get
+ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_put_unlocked
+ NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_close_on_exec
+diff --git a/nvidia/os-mlock.c b/nvidia/os-mlock.c
+index fb0bcd3..607f2f1 100644
+--- a/nvidia/os-mlock.c
++++ b/nvidia/os-mlock.c
+@@ -17,10 +17,10 @@ static inline int nv_follow_pfn(struct vm_area_struct *vma,
+ unsigned long address,
+ unsigned long *pfn)
+ {
+-#if defined(NV_UNSAFE_FOLLOW_PFN_PRESENT)
+- return unsafe_follow_pfn(vma, address, pfn);
+-#else
++#if defined(NV_FOLLOW_PFN_PRESENT)
+ return follow_pfn(vma, address, pfn);
++#else
++ return -1;
+ #endif
+ }
+
+--
+2.20.1
+
diff --git a/0045-let-the-virt_addr_valid-macro-use-nv_pfn_valid-on-pp.patch
b/0045-let-the-virt_addr_valid-macro-use-nv_pfn_valid-on-pp.patch
new file mode 100644
index 0000000..4ba4686
--- /dev/null
+++ b/0045-let-the-virt_addr_valid-macro-use-nv_pfn_valid-on-pp.patch
@@ -0,0 +1,28 @@
+From fd0d12162ffb24fb1048467d265e942d54ca482d Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe(a)debian.org>
+Date: Sun, 13 Oct 2024 08:52:51 +0200
+Subject: [PATCH] let the virt_addr_valid() macro use nv_pfn_valid() on ppc64el
+
+---
+ common/inc/nv-linux.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/common/inc/nv-linux.h b/common/inc/nv-linux.h
+index 7f93fd0..2b685c9 100644
+--- a/common/inc/nv-linux.h
++++ b/common/inc/nv-linux.h
+@@ -2016,6 +2016,11 @@ static inline int nv_pfn_valid(unsigned long pfn)
+ return ret;
+ }
+
++#if defined(NVCPU_PPC64LE)
++// let the virt_addr_valid() macro use nv_pfn_valid()
++#define pfn_valid nv_pfn_valid
++#endif
++
+ #else
+ # define nv_pfn_valid pfn_valid
+ #endif
+--
+2.39.5
+
diff --git a/0046-backport-nv_get_kern_phys_address-changes-from-555.4.patch
b/0046-backport-nv_get_kern_phys_address-changes-from-555.4.patch
new file mode 100644
index 0000000..ae1e44d
--- /dev/null
+++ b/0046-backport-nv_get_kern_phys_address-changes-from-555.4.patch
@@ -0,0 +1,25 @@
+From 7af6b6ecd9a27264ba2568a58d4d7eab1111c3c9 Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe(a)debian.org>
+Date: Fri, 18 Oct 2024 00:04:11 +0200
+Subject: [PATCH] backport nv_get_kern_phys_address() changes from 555.42.02
+
+---
+ nvidia/nv-vtophys.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nvidia/nv-vtophys.c b/nvidia/nv-vtophys.c
+index 9c8d4ef..8a62b88 100644
+--- a/nvidia/nv-vtophys.c
++++ b/nvidia/nv-vtophys.c
+@@ -16,7 +16,7 @@
+ NvU64 NV_API_CALL nv_get_kern_phys_address(NvU64 address)
+ {
+ /* direct-mapped kernel address */
+- if (virt_addr_valid(address))
++ if (virt_addr_valid((void *)address))
+ return __pa(address);
+
+ nv_printf(NV_DBG_ERRORS,
+--
+2.39.5
+
diff --git a/nvidia-470xx-kmod.spec b/nvidia-470xx-kmod.spec
index 9bf41a9..8a457d9 100644
--- a/nvidia-470xx-kmod.spec
+++ b/nvidia-470xx-kmod.spec
@@ -12,7 +12,7 @@ Name: nvidia-470xx-kmod
Epoch: 3
Version: 470.256.02
# Taken over by kmodtool
-Release: 3%{?dist}
+Release: 4%{?dist}
License: Redistributable, no modification permitted
Summary: NVIDIA 470xx display driver kernel module
@@ -21,7 +21,10 @@ URL:
https://www.nvidia.com/
Source11: nvidia-470xx-kmodtool-excludekernel-filterfile
Patch0: gcc-14.patch
Patch1: nvidia-UBSAN.patch
-Patch2: kernel-610-buildfix.patch
+Patch2: 0037-import-pfn_valid-w-o-GPL-rcu_read_lock-unlock-from-v.patch
+Patch3: 0043-backport-follow_pfn-changes-from-550.90.07.patch
+Patch4: 0045-let-the-virt_addr_valid-macro-use-nv_pfn_valid-on-pp.patch
+Patch5: 0046-backport-nv_get_kern_phys_address-changes-from-555.4.patch
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64
@@ -47,6 +50,10 @@ tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{versi
%patch -P0 -p1
%patch -P1 -p1
%patch -P2 -p1 -d kernel/
+%patch -P3 -p1 -d kernel/
+%patch -P4 -p1 -d kernel/
+%patch -P5 -p1 -d kernel/
+
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
done
@@ -77,6 +84,9 @@ done
%{?akmod_install}
%changelog
+* Sun Nov 10 2024 Sérgio Basto <sergio(a)serjux.com> - 3:470.256.02-4
+- Update Debian patches
+
* Tue Aug 13 2024 Leigh Scott <leigh123linux(a)gmail.com> - 3:470.256.02-3
- Add debian build fixes for kernel-6.10