nvidia-340xx/0014-kernel-6.5.patch

76 lines
2.7 KiB
Diff
Raw Permalink Normal View History

2024-01-19 20:55:32 +08:00
diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
--- a/kernel/conftest.sh 2023-09-09 04:19:11.170064889 +0000
+++ b/kernel/conftest.sh 2023-09-09 04:21:10.593482047 +0000
@@ -1977,6 +1977,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"
@@ -1985,6 +2009,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 parameters.
diff -Naur a/kernel/nv-linux.h b/kernel/nv-linux.h
--- a/kernel/nv-linux.h 2023-09-09 04:19:11.163398218 +0000
+++ b/kernel/nv-linux.h 2023-09-09 04:21:36.163499676 +0000
@@ -2205,7 +2205,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
@@ -2231,6 +2235,8 @@
* 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
*/
+#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
@@ -2295,5 +2301,6 @@
}
#endif
#endif
+#endif
#endif /* _NV_LINUX_H_ */