commit 433c19ff37511a5ed0d303f452f4ca4decb6ae96
Author: Łukasz Wojniłowicz <lukasz.wojnilowicz(a)gmail.com>
Date: Mon Sep 11 17:39:58 2023 +0200
Fix build on kernel-6.5.2
kernel-6.5.2.patch | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++
nvidia-340xx-kmod.spec | 7 ++++-
2 files changed, 83 insertions(+), 1 deletion(-)
---
diff --git a/kernel-6.5.2.patch b/kernel-6.5.2.patch
new file mode 100644
index 0000000..16a854b
--- /dev/null
+++ b/kernel-6.5.2.patch
@@ -0,0 +1,77 @@
+diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+--- a/kernel/conftest.sh 2023-03-04 13:09:34.870313112 +0100
++++ b/kernel/conftest.sh 2023-09-11 17:10:38.066651279 +0200
+@@ -3213,6 +3213,30 @@
+ return
+ fi
+
++ # Conftest #4: check if vma arg was dropped
++ # Return if available.
++ # Fall through to default case if absent.
++
++ echo "$CONFTEST_PREAMBLE
++ #include <linux/mm.h>
++ long get_user_pages(unsigned long start,
++ unsigned long nr_pages,
++ unsigned int gup_flags,
++ struct page **pages) {
++ return 0;
++ }" > conftest$$.c
++
++ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
++ rm -f conftest$$.c
++
++ if [ -f conftest$$.o ]; then
++ echo "#define NV_GET_USER_PAGES_DROPPED_VMA" | append_conftest
"functions"
++ echo "#undef NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" |
append_conftest "functions"
++ echo "#undef NV_GET_USER_PAGES_HAS_TASK_STRUCT" |
append_conftest "functions"
++ rm -f conftest$$.o
++ return
++ fi
++
+ echo "#define NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" |
append_conftest "functions"
+ echo "#define NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest
"functions"
+
+@@ -3220,6 +3244,8 @@
+ ;;
+
+ get_user_pages_remote)
++ echo "#define NV_GET_USER_PAGES_REMOTE_UNUSED" | append_conftest
"functions"
++ return
+ #
+ # Determine if the function get_user_pages_remote() is
+ # present and has write/force/locked/tsk parameters.
+diff -Naur a/kernel/nv-mm.h b/kernel/nv-mm.h
+--- a/kernel/nv-mm.h 2022-10-12 11:30:26.000000000 +0200
++++ b/kernel/nv-mm.h 2023-09-11 17:17:20.528698065 +0200
+@@ -93,7 +93,11 @@
+ if (force)
+ flags |= FOLL_FORCE;
+
+- return get_user_pages(start, nr_pages, flags, pages, vmas);
++ #if defined(NV_GET_USER_PAGES_DROPPED_VMA)
++ return get_user_pages(start, nr_pages, flags, pages);
++ #else
++ return get_user_pages(start, nr_pages, flags, pages, vmas);
++ #endif
+ }
+ #endif
+ #endif
+@@ -129,7 +133,8 @@
+ * all gup code") in v5.9-rc1 (2020-08-11).
+ *
+ */
+-
++#if defined(NV_GET_USER_PAGES_REMOTE_UNUSED)
++#else
+ #if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
+ #if defined(NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS)
+ #define NV_GET_USER_PAGES_REMOTE get_user_pages_remote
+@@ -195,6 +200,7 @@
+ }
+ #endif
+ #endif
++#endif
+
+
+ /*
diff --git a/nvidia-340xx-kmod.spec b/nvidia-340xx-kmod.spec
index ce20db1..20ff302 100644
--- a/nvidia-340xx-kmod.spec
+++ b/nvidia-340xx-kmod.spec
@@ -12,7 +12,7 @@ Name: nvidia-340xx-kmod
Epoch: 1
Version: 340.108
# Taken over by kmodtool
-Release: 28%{?dist}
+Release: 29%{?dist}
Summary: NVIDIA display driver kernel module
Group: System Environment/Kernel
License: Redistributable, no modification permitted
@@ -22,6 +22,7 @@ Source11: nvidia-kmodtool-excludekernel-filterfile
Patch0: import-files-from-390.157.patch
Patch1: fix-build-issues.patch
Patch2: kernel-6.3.1.patch
+Patch3: kernel-6.5.2.patch
BuildRequires: elfutils-libelf-devel
BuildRequires: gcc
@@ -51,6 +52,7 @@ tar --use-compress-program xz -xf
%{_datadir}/%{name}-%{version}/%{name}-%{versi
%patch 0 -p1
%patch 1 -p1
%patch 2 -p1
+%patch 3 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
@@ -79,6 +81,9 @@ done
%{?akmod_install}
%changelog
+* Mon Sep 11 2023 Łukasz Wojniłowicz <lukasz.wojnilowicz(a)gmail.com> - 1:340.108-29
+- Fix build on kernel-6.5.2
+
* Mon May 08 2023 Łukasz Wojniłowicz <lukasz.wojnilowicz(a)gmail.com> - 1:340.108-28
- Fix build on kernel-6.3.1
Show replies by date