commit 63999d0a0f1225e5f970e0d96f1fe37f61768b3c
Author: orphan <orphan(a)rpmfusion.org>
Date: Wed Sep 6 14:54:06 2023 +0100
Fix for F39 branch
...ernel_6.5-get_user_pages-dropped-vmas-arg.patch | 102 +++++++++++++++++++++
....5-get_user_pages_remote-dropped-vmas-arg.patch | 65 +++++++++++++
nvidia-470xx-kmod.spec | 14 ++-
3 files changed, 180 insertions(+), 1 deletion(-)
---
diff --git a/buildfix_kernel_6.5-get_user_pages-dropped-vmas-arg.patch
b/buildfix_kernel_6.5-get_user_pages-dropped-vmas-arg.patch
new file mode 100644
index 0000000..6df3843
--- /dev/null
+++ b/buildfix_kernel_6.5-get_user_pages-dropped-vmas-arg.patch
@@ -0,0 +1,102 @@
+From 738922af87e3d0096cbe737233fe7f28e91310eb Mon Sep 17 00:00:00 2001
+From: Paolo Pisati <paolo.pisati(a)canonical.com>
+Date: Fri, 21 Jul 2023 14:01:39 +0000
+Subject: [PATCH 2/2] Linux 6.5: get_user_pages() dropped vmas arg
+
+Signed-off-by: Paolo Pisati <paolo.pisati(a)canonical.com>
+---
+ common/inc/nv-mm.h | 4 +++
+ conftest.sh | 25 ++++++++++++++++++-
+ nvidia-uvm/uvm_tools.c | 17 +++++++++++++
+ 3 files changed, 45 insertions(+), 1 deletion(-)
+
+diff --git a/common/inc/nv-mm.h b/common/inc/nv-mm.h
+index 321d718c..0ce99fad 100644
+--- a/common/inc/nv-mm.h
++++ b/common/inc/nv-mm.h
+@@ -93,7 +93,11 @@ typedef int vm_fault_t;
+ if (force)
+ flags |= FOLL_FORCE;
+
++#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
+diff --git a/conftest.sh b/conftest.sh
+index 9b844b84..bcdc8e5c 100755
+--- a/conftest.sh
++++ b/conftest.sh
+@@ -2593,7 +2593,6 @@ compile_test() {
+ # write and force parameters AND that gup has task_struct and
+ # mm_struct as its first arguments.
+ # Return if available.
+- # Fall through to default case if absent.
+
+ echo "$CONFTEST_PREAMBLE
+ #include <linux/mm.h>
+@@ -2617,6 +2616,30 @@ compile_test() {
+ return
+ fi
+
++ # Conftest #4: Check if get_user_pages dropped vmas argument.
++ # Return if postive.
++ # 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 "#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"
++ echo "#define NV_GET_USER_PAGES_DROPPED_VMA" | 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"
+
+diff --git a/nvidia-uvm/uvm_tools.c b/nvidia-uvm/uvm_tools.c
+index 5e4d112a..9728a228 100644
+--- a/nvidia-uvm/uvm_tools.c
++++ b/nvidia-uvm/uvm_tools.c
+@@ -269,6 +269,23 @@ static NV_STATUS map_user_pages(NvU64 user_va, NvU64 size, void
**addr, struct p
+ goto fail;
+ }
+
++#if defined(NV_GET_USER_PAGES_DROPPED_VMA)
++ struct vm_area_struct *vma;
++ unsigned long start;
++
++ nv_mmap_read_lock(current->mm);
++ start = user_va;
++ for (i = 0; i < num_pages; i++) {
++ vma = find_vma(current->mm, start);
++ if (!vma) {
++ nv_mmap_read_unlock(current->mm);
++ status = NV_ERR_INVALID_ARGUMENT;
++ goto fail;
++ }
++ }
++ nv_mmap_read_unlock(current->mm);
++#endif
++
+ for (i = 0; i < num_pages; i++) {
+ if (page_count((*pages)[i]) > MAX_PAGE_COUNT ||
uvm_file_is_nvidia_uvm(vmas[i]->vm_file)) {
+ status = NV_ERR_INVALID_ARGUMENT;
+--
+2.40.1
+
diff --git a/buildfix_kernel_6.5-get_user_pages_remote-dropped-vmas-arg.patch
b/buildfix_kernel_6.5-get_user_pages_remote-dropped-vmas-arg.patch
new file mode 100644
index 0000000..b82ca04
--- /dev/null
+++ b/buildfix_kernel_6.5-get_user_pages_remote-dropped-vmas-arg.patch
@@ -0,0 +1,65 @@
+From dc621d963825e09d9569058be2d046d8902853e8 Mon Sep 17 00:00:00 2001
+From: Paolo Pisati <paolo.pisati(a)canonical.com>
+Date: Fri, 21 Jul 2023 13:17:48 +0000
+Subject: [PATCH] Linux 6.5: get_user_pages_remote() dropped vmas arg
+
+Signed-off-by: Paolo Pisati <paolo.pisati(a)canonical.com>
+---
+ common/inc/nv-mm.h | 4 ++-
+ conftest.sh | 25 ++++++++++++++++++-
+ 2 files changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/common/inc/nv-mm.h b/common/inc/nv-mm.h
+index be834b6f..0ce99fad 100644
+--- a/common/inc/nv-mm.h
++++ b/common/inc/nv-mm.h
+@@ -162,7 +162,9 @@ typedef int vm_fault_t;
+ return get_user_pages_remote(mm, start, nr_pages, flags,
+ pages, vmas, NULL);
+ #endif
+-
++ #elif defined(NV_GET_USER_PAGES_REMOTE_DROPPED_VMA)
++ return get_user_pages_remote(mm, start, nr_pages, flags,
++ pages, NULL);
+ #else
+
+ return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
+diff --git a/conftest.sh b/conftest.sh
+index 4e23a9e6..5fbf776a 100755
+--- a/conftest.sh
++++ b/conftest.sh
+@@ -2778,7 +2778,30 @@ compile_test() {
+ echo "#define NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" |
append_conftest "functions"
+ echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" |
append_conftest "functions"
+ fi
+- ;;
++
++ #
++ # conftest #5: check if get_user_pages_remote() does not take
++ # vmas argument.
++ #
++ echo "$CONFTEST_PREAMBLE
++ #include <linux/mm.h>
++ long get_user_pages_remote(struct mm_struct *mm,
++ unsigned long start,
++ unsigned long nr_pages,
++ unsigned int gup_flags,
++ struct page **pages,
++ int *locked) {
++ 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_REMOTE_DROPPED_VMA" |
append_conftest "functions"
++ rm -f conftest$$.o
++ fi
++ ;;
+
+ usleep_range)
+ #
+--
+2.40.1
+
diff --git a/nvidia-470xx-kmod.spec b/nvidia-470xx-kmod.spec
index 93df26d..4e2cf9e 100644
--- a/nvidia-470xx-kmod.spec
+++ b/nvidia-470xx-kmod.spec
@@ -12,7 +12,7 @@ Name: nvidia-470xx-kmod
Epoch: 3
Version: 470.199.02
# Taken over by kmodtool
-Release: 2%{?dist}
+Release: 3%{?dist}
License: Redistributable, no modification permitted
Summary: NVIDIA 470xx display driver kernel module
@@ -20,6 +20,11 @@ URL:
https://www.nvidia.com/
Source11: nvidia-470xx-kmodtool-excludekernel-filterfile
+# Patches from ubuntu
+#
https://git.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-470/tree...
+Patch0: buildfix_kernel_6.5-get_user_pages-dropped-vmas-arg.patch
+Patch1: buildfix_kernel_6.5-get_user_pages_remote-dropped-vmas-arg.patch
+
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64
@@ -42,6 +47,10 @@ 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
+pushd kernel
+%patch 0 -p1
+%patch 1 -p1
+popd
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
@@ -73,6 +82,9 @@ done
%{?akmod_install}
%changelog
+* Wed Sep 06 2023 orphan <orphan(a)rpmfusion.org> - 3:470.199.02-3
+- Fix for F39 branch
+
* Thu Aug 03 2023 RPM Fusion Release Engineering <sergiomb(a)rpmfusion.org> -
3:470.199.02-2
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild