commit 28c74d54eabc24445cb0107687fd11bbcd3e54cc
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Thu Feb 1 23:44:34 2024 +0000
fix build with kernel-6.7.3
kernel-6.7.3.patch | 45 +++++++++++++++++++++++++++++++++++++++++++++
nvidia-470xx-kmod.spec | 8 ++++++--
2 files changed, 51 insertions(+), 2 deletions(-)
---
diff --git a/kernel-6.7.3.patch b/kernel-6.7.3.patch
new file mode 100644
index 0000000..124d9a6
--- /dev/null
+++ b/kernel-6.7.3.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))
+ {
diff --git a/nvidia-470xx-kmod.spec b/nvidia-470xx-kmod.spec
index 94ebb1b..5f7ec48 100644
--- a/nvidia-470xx-kmod.spec
+++ b/nvidia-470xx-kmod.spec
@@ -12,13 +12,14 @@ Name: nvidia-470xx-kmod
Epoch: 3
Version: 470.223.02
# Taken over by kmodtool
-Release: 1%{?dist}
+Release: 2%{?dist}
License: Redistributable, no modification permitted
Summary: NVIDIA 470xx display driver kernel module
URL:
https://www.nvidia.com/
Source11: nvidia-470xx-kmodtool-excludekernel-filterfile
+Patch0: kernel-6.7.3.patch
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64
@@ -42,7 +43,7 @@ kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name}
--filterf
%setup -T -c
tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{version}-%{_target_cpu}.tar.xz
# patch loop
-
+%patch -P0 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
done
@@ -73,6 +74,9 @@ done
%{?akmod_install}
%changelog
+* Thu Feb 01 2024 Leigh Scott <leigh123linux(a)gmail.com> - 3:470.223.02-2
+- fix build with kernel-6.7.3
+
* Wed Nov 01 2023 Leigh Scott <leigh123linux(a)gmail.com> - 3:470.223.02-1
- Update to 470.223.02