Linux 6.10.x patch for NVIDIA-Linux-x86_64-555.42.06

NVIDIA-Linux-x86_64-555.42.06 を linux-6.10.2 で動かすためのパッチです

555系の最新版である NVIDIA-Linux-x86_64-555.58.02 から変更点をbackportします

diff -uNr NVIDIA-Linux-x86_64-555.42.06/kernel/conftest.sh NVIDIA-Linux-x86_64-555.58.02/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-555.42.06/kernel/conftest.sh    2024-06-04 09:18:06.000000000 +0900
+++ NVIDIA-Linux-x86_64-555.58.02/kernel/conftest.sh    2024-06-25 09:57:18.000000000 +0900
@@ -5252,25 +5252,23 @@
             compile_check_conftest "$CODE" "NV_PCI_CLASS_MULTIMEDIA_HD_AUDIO_PRESENT" "" "generic"
         ;;

-        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.
-            #
-            # Note: this commit never made it to the linux kernel, so
-            # unsafe_follow_pfn() never existed.
+            # 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)
             #
             # Determine if drm_plane_helper_funcs::atomic_check takes 'state'
diff -uNr NVIDIA-Linux-x86_64-555.42.06/kernel/nvidia/nvidia.Kbuild NVIDIA-Linux-x86_64-555.58.02/kernel/nvidia/nvidia.Kbuild
--- NVIDIA-Linux-x86_64-555.42.06/kernel/nvidia/nvidia.Kbuild   2024-06-04 10:26:05.000000000 +0900
+++ NVIDIA-Linux-x86_64-555.58.02/kernel/nvidia/nvidia.Kbuild   2024-06-25 11:10:53.000000000 +0900
@@ -161,7 +161,7 @@
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += vga_tryget
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += cc_platform_has
 NV_CONFTEST_FUNCTION_COMPILE_TESTS += seq_read_iter
-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 += add_memory_driver_managed
@@ -231,6 +231,7 @@
 NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_tegra_platform_is_fpga
 NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_tegra_platform_is_sim
 NV_CONFTEST_SYMBOL_COMPILE_TESTS += crypto
+NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_follow_pte

 NV_CONFTEST_TYPE_COMPILE_TESTS += dma_ops
 NV_CONFTEST_TYPE_COMPILE_TESTS += swiotlb_dma_ops
diff -uNr NVIDIA-Linux-x86_64-555.42.06/kernel/nvidia/os-mlock.c NVIDIA-Linux-x86_64-555.58.02/kernel/nvidia/os-mlock.c
--- NVIDIA-Linux-x86_64-555.42.06/kernel/nvidia/os-mlock.c      2024-06-04 10:26:30.000000000 +0900
+++ NVIDIA-Linux-x86_64-555.58.02/kernel/nvidia/os-mlock.c      2024-06-25 11:11:29.000000000 +0900
@@ -36,9 +36,9 @@
                                 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
 }