commit 92b7fa32b3012530bb574027d733b44531468f0a
Author: Łukasz Wojniłowicz <lukasz.wojnilowicz(a)gmail.com>
Date: Sun Jun 5 13:25:43 2022 +0200
Patch for kernel-5.18.0
fix-build-issues.patch | 648 +++++++++++++++++----
...90.147.patch => import-files-from-390.151.patch | 272 +++++----
nvidia-340xx-kmod.spec | 7 +-
3 files changed, 708 insertions(+), 219 deletions(-)
---
diff --git a/fix-build-issues.patch b/fix-build-issues.patch
index 3030bb7..cc3647a 100644
--- a/fix-build-issues.patch
+++ b/fix-build-issues.patch
@@ -1,7 +1,7 @@
diff -Naur a/kernel/conftest.Kbuild b/kernel/conftest.Kbuild
--- a/kernel/conftest.Kbuild 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/conftest.Kbuild 2022-04-03 09:54:09.789517505 +0200
-@@ -0,0 +1,213 @@
++++ b/kernel/conftest.Kbuild 2022-06-05 13:19:33.726279089 +0200
+@@ -0,0 +1,241 @@
+NV_CONFTEST_GENERIC_COMPILE_TESTS += drm_available
+NV_CONFTEST_GENERIC_COMPILE_TESTS += drm_atomic_available
+NV_CONFTEST_GENERIC_COMPILE_TESTS += dom0_kernel_present
@@ -64,6 +64,20 @@ diff -Naur a/kernel/conftest.Kbuild b/kernel/conftest.Kbuild
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_framebuffer_get
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_for_each_possible_encoder
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += vga_tryget
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_bus_get_device
++
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += remap_page_range
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += address_space_init_once
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += kbasename
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += fatal_signal_pending
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += list_cut_position
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += vzalloc
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += wait_on_bit_lock_argument_count
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += bitmap_clear
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += usleep_range
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += radix_tree_empty
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += radix_tree_replace_slot
++NV_CONFTEST_FUNCTION_COMPILE_TESTS += ktime_get_raw_ts64
+
+NV_CONFTEST_SYMBOL_COMPILE_TESTS += efi_enabled
+NV_CONFTEST_SYMBOL_COMPILE_TESTS += export_symbol_gpl_conftest
@@ -104,6 +118,20 @@ diff -Naur a/kernel/conftest.Kbuild b/kernel/conftest.Kbuild
+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_prime_res_obj
+NV_CONFTEST_TYPE_COMPILE_TESTS += vmalloc_has_pgprot_t_arg
+
++NV_CONFTEST_TYPE_COMPILE_TESTS += vm_operations_struct
++NV_CONFTEST_TYPE_COMPILE_TESTS += task_struct
++NV_CONFTEST_TYPE_COMPILE_TESTS += kuid_t
++NV_CONFTEST_TYPE_COMPILE_TESTS += fault_flags
++NV_CONFTEST_TYPE_COMPILE_TESTS += atomic64_type
++NV_CONFTEST_TYPE_COMPILE_TESTS += address_space
++NV_CONFTEST_TYPE_COMPILE_TESTS += backing_dev_info
++NV_CONFTEST_TYPE_COMPILE_TESTS += mm_context_t
++NV_CONFTEST_TYPE_COMPILE_TESTS += vm_ops_fault_removed_vma_arg
++NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops
++NV_CONFTEST_TYPE_COMPILE_TESTS += pnv_npu2_init_context
++NV_CONFTEST_TYPE_COMPILE_TESTS += kmem_cache_has_kobj_remove_work
++NV_CONFTEST_TYPE_COMPILE_TESTS += sysfs_slab_unlink
++
+NV_CONFTEST_MACRO_COMPILE_TESTS += INIT_WORK
+
+# The conftest.sh script tests various aspects of the target kernel.
@@ -216,8 +244,8 @@ diff -Naur a/kernel/conftest.Kbuild b/kernel/conftest.Kbuild
+
+$(NV_CONFTEST_HEADERS): | $(BUILD_SANITY_CHECKS)
diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
---- a/kernel/conftest.sh 2022-04-03 09:53:53.384897612 +0200
-+++ b/kernel/conftest.sh 2022-04-03 09:54:09.792517436 +0200
+--- a/kernel/conftest.sh 2022-06-05 13:18:33.949571878 +0200
++++ b/kernel/conftest.sh 2022-06-05 13:19:33.730279003 +0200
@@ -113,6 +113,7 @@
FILES="$FILES drm/drm_vblank.h"
FILES="$FILES drm/drm_file.h"
@@ -242,7 +270,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
FILES="$FILES linux/dma-resv.h"
FILES="$FILES linux/dma-map-ops.h"
FILES="$FILES linux/stdarg.h"
-@@ -143,6 +146,8 @@
+@@ -144,6 +147,8 @@
FILES_ARCH="$FILES_ARCH asm/powernv.h"
FILES_ARCH="$FILES_ARCH asm/tlbflush.h"
FILES_ARCH="$FILES_ARCH asm/pgtable_types.h"
@@ -251,7 +279,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
translate_and_find_header_files $HEADERS $FILES
translate_and_find_header_files $HEADERS_ARCH $FILES_ARCH
-@@ -663,6 +668,63 @@
+@@ -664,6 +669,63 @@
compile_check_conftest "$CODE" "NV_FOLLOW_PFN_PRESENT"
"" "functions"
;;
@@ -315,7 +343,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
i2c_adapter)
#
# Determine if the 'i2c_adapter' structure has the
-@@ -1111,6 +1173,16 @@
+@@ -1112,6 +1174,16 @@
compile_check_conftest "$CODE"
"NV_CPUHP_SETUP_STATE_PRESENT" "" "functions"
;;
@@ -332,7 +360,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
acpi_evaluate_integer)
#
# Determine if the acpi_evaluate_integer() function is
-@@ -1426,6 +1498,47 @@
+@@ -1427,6 +1499,47 @@
compile_check_conftest "$CODE"
"NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL" "" "types"
;;
@@ -380,27 +408,8 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
sg_table)
#
# Determine if the struct sg_table type is present.
-@@ -1795,15 +1908,35 @@
-
- pde_data)
+@@ -1815,6 +1928,9 @@
#
-+ # Determine if the pde_data() function is present.
-+ #
-+ # The commit c28198889c15 removed the function
-+ # 'PDE_DATA()', and replaced it with 'pde_data()'
-+ # ("proc: remove PDE_DATA() completely") in v5.17-rc1.
-+ #
-+ CODE="
-+ #include <linux/proc_fs.h>
-+ void conftest_pde_data(void) {
-+ pde_data();
-+ }"
-+
-+ compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT"
"" "functions"
-+ ;;
-+
-+ PDE_DATA)
-+ #
# Determine if the PDE_DATA() function is present.
#
+ # Added by commit d9dda78bad87
@@ -409,15 +418,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
CODE="
#include <linux/proc_fs.h>
void conftest_PDE_DATA(void) {
- PDE_DATA();
- }"
-
-- compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT"
"" "functions"
-+ compile_check_conftest "$CODE"
"NV_PDE_DATA_UPPER_CASE_PRESENT" "" "functions"
- ;;
-
- get_num_physpages)
-@@ -2034,6 +2167,21 @@
+@@ -2052,6 +2168,21 @@
compile_check_conftest "$CODE" "NV_FILE_HAS_INODE"
"" "types"
;;
@@ -439,7 +440,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
xen_ioemu_inject_msi)
#
# Determine if the xen_ioemu_inject_msi() function is present.
-@@ -3411,6 +3559,64 @@
+@@ -3429,6 +3560,64 @@
compile_check_conftest "$CODE"
"NV_DRM_DRIVER_UNLOAD_HAS_INT_RETURN_TYPE" "" "types"
;;
@@ -504,7 +505,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
kref_has_refcount_of_type_refcount_t)
CODE="
#include <linux/kref.h>
-@@ -3963,6 +4169,30 @@
+@@ -3981,6 +4170,30 @@
compile_check_conftest "$CODE"
"NV_DMA_IS_DIRECT_PRESENT" "" "functions"
;;
@@ -536,8 +537,8 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#
# Determine whether driver feature flag DRIVER_PRIME is present.
diff -Naur a/kernel/dkms.conf b/kernel/dkms.conf
---- a/kernel/dkms.conf 2022-01-21 18:37:49.976268255 +0100
-+++ b/kernel/dkms.conf 2022-01-21 18:38:55.084844167 +0100
+--- a/kernel/dkms.conf 2022-06-05 13:18:33.908572764 +0200
++++ b/kernel/dkms.conf 2022-06-05 13:19:33.730279003 +0200
@@ -1,7 +1,13 @@
+if [ -x /usr/bin/nproc ]; then
+ num_cpu_cores=$(nproc)
@@ -554,8 +555,8 @@ diff -Naur a/kernel/dkms.conf b/kernel/dkms.conf
CLEAN="make clean"
AUTOINSTALL="yes"
diff -Naur a/kernel/Makefile b/kernel/Makefile
---- a/kernel/Makefile 2022-01-21 18:37:49.975268277 +0100
-+++ b/kernel/Makefile 2022-01-21 18:38:55.073844408 +0100
+--- a/kernel/Makefile 2022-06-05 13:18:33.904572851 +0200
++++ b/kernel/Makefile 2022-06-05 13:19:33.725279111 +0200
@@ -70,11 +70,11 @@
MODULE_GLUE_OBJS := $(patsubst %.c,%.o,nv-frontend.c)
$(MODULE_NAME)-objs := $(MODULE_GLUE_OBJS)
@@ -587,9 +588,66 @@ diff -Naur a/kernel/Makefile b/kernel/Makefile
#
# Generate multiple targets at runtime depending on the items present in
+diff -Naur a/kernel/nv-acpi.c b/kernel/nv-acpi.c
+--- a/kernel/nv-acpi.c 2022-06-05 13:18:33.909572743 +0200
++++ b/kernel/nv-acpi.c 2022-06-05 13:19:33.732278960 +0200
+@@ -556,9 +556,11 @@
+
+ void NV_API_CALL nv_acpi_methods_init(NvU32 *handlesPresent)
+ {
++#if defined(NV_ACPI_BUS_GET_DEVICE_PRESENT)
+ struct acpi_device *device = NULL;
+ RM_STATUS rmStatus;
+ int retVal = -1;
++#endif
+
+
+ if (!handlesPresent) // Caller passed us invalid pointer.
+@@ -570,6 +572,7 @@
+ NV_ACPI_WALK_NAMESPACE(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, nv_acpi_find_methods, NULL, NULL);
+
++#if defined(NV_ACPI_BUS_GET_DEVICE_PRESENT)
+ if (nvif_handle)
+ {
+ *handlesPresent = NV_ACPI_NVIF_HANDLE_PRESENT;
+@@ -596,6 +599,7 @@
+
+ } while (0);
+ }
++#endif
+
+ if (wmmx_handle)
+ *handlesPresent = *handlesPresent | NV_ACPI_WMMX_HANDLE_PRESENT;
+@@ -651,10 +655,12 @@
+
+ if (nvif_parent_gpu_handle == NULL)
+ return;
+-
++#if defined(NV_ACPI_BUS_GET_DEVICE_PRESENT)
+ acpi_bus_get_device(nvif_parent_gpu_handle, &device);
+
+ nv_uninstall_notifier(device, nv_acpi_event);
++#endif
++
+ nvif_parent_gpu_handle = NULL;
+
+ return;
+@@ -1212,7 +1218,11 @@
+ if (!dev_handle)
+ return RM_ERR_INVALID_ARGUMENT;
+
++#if defined(NV_ACPI_BUS_GET_DEVICE_PRESENT)
+ status = acpi_bus_get_device(dev_handle, &device);
++#else
++ return RM_ERR_NOT_SUPPORTED;
++#endif
+
+ if (ACPI_FAILURE(status) || !device)
+ return RM_ERR_INVALID_ARGUMENT;
diff -Naur a/kernel/nv.c b/kernel/nv.c
---- a/kernel/nv.c 2022-01-21 18:37:49.981268146 +0100
-+++ b/kernel/nv.c 2022-01-21 18:38:55.104843730 +0100
+--- a/kernel/nv.c 2022-06-05 13:18:33.917572570 +0200
++++ b/kernel/nv.c 2022-06-05 13:19:33.743278722 +0200
@@ -752,7 +752,7 @@
NV_SPIN_LOCK_INIT(&km_lock);
#endif
@@ -611,9 +669,44 @@ diff -Naur a/kernel/nv.c b/kernel/nv.c
#endif
vga_set_legacy_decoding(dev, VGA_RSRC_NONE);
#endif
+diff -Naur a/kernel/nv-dma.c b/kernel/nv-dma.c
+--- a/kernel/nv-dma.c 2022-06-05 13:18:33.909572743 +0200
++++ b/kernel/nv-dma.c 2022-06-05 13:19:33.732278960 +0200
+@@ -136,10 +136,17 @@
+ return status;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dma_map->sg_map_count = dma_map_sg(&dma_map->dev->dev,
++ NV_DMA_MAP_SCATTERLIST(dma_map),
++ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map),
++ DMA_BIDIRECTIONAL);
++#else
+ dma_map->sg_map_count = pci_map_sg(dma_map->dev,
+ NV_DMA_MAP_SCATTERLIST(dma_map),
+ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map),
+ PCI_DMA_BIDIRECTIONAL);
++#endif
+ if (dma_map->sg_map_count == 0)
+ {
+ nv_printf(NV_DBG_ERRORS,
+@@ -211,8 +218,13 @@
+
+ if (dma_map->sg_map_count != 0)
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dma_unmap_sg(&dma_map->dev->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
++ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), DMA_BIDIRECTIONAL);
++#else
+ pci_unmap_sg(dma_map->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
+ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), PCI_DMA_BIDIRECTIONAL);
++#endif
+ }
+
+ *priv = dma_map->user_pages;
diff -Naur a/kernel/nv-drm.c b/kernel/nv-drm.c
---- a/kernel/nv-drm.c 2022-01-21 18:37:49.977268233 +0100
-+++ b/kernel/nv-drm.c 2022-01-21 18:38:55.086844123 +0100
+--- a/kernel/nv-drm.c 2022-06-05 13:18:33.910572721 +0200
++++ b/kernel/nv-drm.c 2022-06-05 13:19:33.733278938 +0200
@@ -23,6 +23,11 @@
#include <linux/file.h>
#endif
@@ -1082,9 +1175,29 @@ diff -Naur a/kernel/nv-drm.c b/kernel/nv-drm.c
drm_gem_object_unreference_unlocked(&nv_obj->base);
#endif
+diff -Naur a/kernel/nv-frontend.c b/kernel/nv-frontend.c
+--- a/kernel/nv-frontend.c 2022-06-05 13:18:33.910572721 +0200
++++ b/kernel/nv-frontend.c 2022-06-05 13:19:33.734278916 +0200
+@@ -8,6 +8,7 @@
+ * _NVRM_COPYRIGHT_END_
+ */
+
++#include "conftest.h"
+ #include "nv-misc.h"
+ #include "os-interface.h"
+ #include "nv-linux.h"
+@@ -377,7 +378,7 @@
+ #if (NV_BUILD_MODULE_INSTANCES != 0)
+ #if defined(CONFIG_PROC_FS)
+ if ((nv_num_instances == 0) && (nv_proc_topdir != NULL))
+- NV_REMOVE_PROCE_ENTRY(nv_proc_topdir);
++ NV_REMOVE_PROC_ENTRY(nv_proc_topdir);
+ #endif
+ #else
+ nvidia_exit_module();
diff -Naur a/kernel/nv.h b/kernel/nv.h
---- a/kernel/nv.h 2022-01-21 18:37:49.981268146 +0100
-+++ b/kernel/nv.h 2022-01-21 18:38:55.106843686 +0100
+--- a/kernel/nv.h 2022-06-05 13:18:33.918572548 +0200
++++ b/kernel/nv.h 2022-06-05 13:19:33.745278678 +0200
@@ -13,7 +13,7 @@
#define _NV_H_
@@ -1095,8 +1208,8 @@ diff -Naur a/kernel/nv.h b/kernel/nv.h
#if !defined(NV_MIN)
#define NV_MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
diff -Naur a/kernel/nvidia-drm-gem.c b/kernel/nvidia-drm-gem.c
---- a/kernel/nvidia-drm-gem.c 2022-01-21 18:37:50.025267183 +0100
-+++ b/kernel/nvidia-drm-gem.c 2022-01-21 18:38:55.109843620 +0100
+--- a/kernel/nvidia-drm-gem.c 2022-06-05 13:18:33.953571791 +0200
++++ b/kernel/nvidia-drm-gem.c 2022-06-05 13:19:33.746278657 +0200
@@ -26,10 +26,10 @@
#include "nvidia-drm-priv.h"
@@ -1110,7 +1223,7 @@ diff -Naur a/kernel/nvidia-drm-gem.c b/kernel/nvidia-drm-gem.c
#if defined(NV_DRM_DRM_PRIME_H_PRESENT)
#include <drm/drm_prime.h>
-@@ -88,9 +88,9 @@
+@@ -99,9 +99,9 @@
.vunmap = nv_drm_gem_prime_vunmap,
#endif
@@ -1124,8 +1237,8 @@ diff -Naur a/kernel/nvidia-drm-gem.c b/kernel/nvidia-drm-gem.c
#endif
};
diff -Naur a/kernel/nvidia-drm-linux.c b/kernel/nvidia-drm-linux.c
---- a/kernel/nvidia-drm-linux.c 2022-01-21 18:37:50.027267140 +0100
-+++ b/kernel/nvidia-drm-linux.c 2022-01-21 18:38:55.111843577 +0100
+--- a/kernel/nvidia-drm-linux.c 2022-06-05 13:18:33.955571748 +0200
++++ b/kernel/nvidia-drm-linux.c 2022-06-05 13:19:33.748278614 +0200
@@ -25,7 +25,6 @@
#include <linux/err.h>
@@ -1161,17 +1274,22 @@ diff -Naur a/kernel/nvidia-drm-linux.c
b/kernel/nvidia-drm-linux.c
- MODULE_VERSION(NV_VERSION_STRING);
-#endif
diff -Naur a/kernel/nvidia-modules-common.mk b/kernel/nvidia-modules-common.mk
---- a/kernel/nvidia-modules-common.mk 2022-01-21 18:37:49.982268124 +0100
-+++ b/kernel/nvidia-modules-common.mk 2022-01-21 18:38:55.112843555 +0100
-@@ -149,7 +149,7 @@
+--- a/kernel/nvidia-modules-common.mk 2022-06-05 13:18:33.918572548 +0200
++++ b/kernel/nvidia-modules-common.mk 2022-06-05 13:19:33.749278592 +0200
+@@ -149,10 +149,10 @@
CONFTEST_HEADERS := $(obj)/conftest.h $(CONFTEST_COMPILE_TEST_HEADERS) \
$(obj)/conftest/patches.h
-$(obj)/conftest.h $(CONFTEST_COMPILE_TEST_HEADERS): conftest-compile-test
+# $(obj)/conftest.h $(CONFTEST_COMPILE_TEST_HEADERS): conftest-compile-test
- conftest-compile-test: $(src)/conftest.sh
- @if ! $(CONFTEST) compile_tests $(COMPILE_TESTS); then exit 1; fi
+-conftest-compile-test: $(src)/conftest.sh
+- @if ! $(CONFTEST) compile_tests $(COMPILE_TESTS); then exit 1; fi
++# conftest-compile-test: $(src)/conftest.sh
++# @if ! $(CONFTEST) compile_tests $(COMPILE_TESTS); then exit 1; fi
+
+ $(obj)/conftest/patches.h:
+ @if ! $(CONFTEST) patch_check; then exit 1; fi
@@ -222,6 +222,7 @@
define BUILD_MODULE_RULE
$(1): build-sanity-checks $(3)
@@ -1190,8 +1308,8 @@ diff -Naur a/kernel/nvidia-modules-common.mk
b/kernel/nvidia-modules-common.mk
@$(RM) -rf Module*.symvers .tmp_versions modules.order
diff -Naur a/kernel/nv-linux.h b/kernel/nv-linux.h
---- a/kernel/nv-linux.h 2022-04-03 09:53:53.350898400 +0200
-+++ b/kernel/nv-linux.h 2022-04-03 09:54:09.795517366 +0200
+--- a/kernel/nv-linux.h 2022-06-05 13:18:33.912572678 +0200
++++ b/kernel/nv-linux.h 2022-06-05 13:19:33.736278873 +0200
@@ -119,12 +119,15 @@
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
#include <linux/cpu.h> /* CPU hotplug support */
@@ -1359,24 +1477,167 @@ diff -Naur a/kernel/nv-linux.h b/kernel/nv-linux.h
#endif /* CONFIG_PROC_FS */
-@@ -2187,9 +2250,13 @@
- flags |= FOLL_FORCE;
+@@ -2075,157 +2138,4 @@
+ #endif
+ }
- #if defined(NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG)
+-/* get_user_pages
+- *
+- * The 8-argument version of get_user_pages was deprecated by commit
+- * (2016 Feb 12: cde70140fed8429acf7a14e2e2cbd3e329036653)for the non-remote case
+- * (calling get_user_pages with current and current->mm).
+- *
+- * Completely moved to the 6 argument version of get_user_pages -
+- * 2016 Apr 4: c12d2da56d0e07d230968ee2305aaa86b93a6832
+- *
+- * write and force parameters were replaced with gup_flags by -
+- * 2016 Oct 12: 768ae309a96103ed02eb1e111e838c87854d8b51
+- *
+- * A 7-argument version of get_user_pages was introduced into linux-4.4.y by
+- * commit 8e50b8b07f462ab4b91bc1491b1c91bd75e4ad40 which cherry-pciked the
+- * replacement of the write and force parameters with gup_flags
+- *
+- */
-
-+ #if defined (NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG)
- return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
- pages, vmas, NULL);
-+ #else
-+ return get_user_pages_remote(mm, start, nr_pages, flags,
-+ pages, vmas, NULL);
-+ #endif
-
- #else
-
+-#if defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT)
+- #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
+- #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \
+- get_user_pages(current, current->mm, start, nr_pages, write, force,
pages, vmas)
+- #else
+- #include <linux/mm.h>
+- #include <linux/sched.h>
+-
+- static inline long NV_GET_USER_PAGES(unsigned long start,
+- unsigned long nr_pages,
+- int write,
+- int force,
+- struct page **pages,
+- struct vm_area_struct **vmas)
+- {
+- unsigned int flags = 0;
+-
+- if (write)
+- flags |= FOLL_WRITE;
+- if (force)
+- flags |= FOLL_FORCE;
+-
+- return get_user_pages(current, current->mm, start, nr_pages, flags,
+- pages, vmas);
+- }
+-
+- #endif
+-#else
+- #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
+- #define NV_GET_USER_PAGES get_user_pages
+- #else
+- #include <linux/mm.h>
+-
+- static inline long NV_GET_USER_PAGES(unsigned long start,
+- unsigned long nr_pages,
+- int write,
+- int force,
+- struct page **pages,
+- struct vm_area_struct **vmas)
+- {
+- unsigned int flags = 0;
+-
+- if (write)
+- flags |= FOLL_WRITE;
+- if (force)
+- flags |= FOLL_FORCE;
+-
+- return get_user_pages(start, nr_pages, flags, pages, vmas);
+- }
+- #endif
+-#endif
+-
+-/* get_user_pages_remote() was added by:
+- * 2016 Feb 12: 1e9877902dc7e11d2be038371c6fbf2dfcd469d7
+- *
+- * The very next commit (cde70140fed8429acf7a14e2e2cbd3e329036653)
+- * deprecated the 8-argument version of get_user_pages for the
+- * non-remote case (calling get_user_pages with current and current->mm).
+- *
+- * The guidelines are: call NV_GET_USER_PAGES_REMOTE if you need the 8-argument
+- * version that uses something other than current and current->mm. Use
+- * NV_GET_USER_PAGES if you are refering to current and current->mm.
+- *
+- * Note that get_user_pages_remote() requires the caller to hold a reference on
+- * the task_struct (if non-NULL) and the mm_struct. This will always be true
+- * when using current and current->mm. If the kernel passes the driver a vma
+- * via driver callback, the kernel holds a reference on vma->vm_mm over that
+- * callback.
+- *
+- * get_user_pages_remote() added 'locked' parameter
+- * 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
+- */
+-
+-#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
+- #else
+- static inline long NV_GET_USER_PAGES_REMOTE(struct task_struct *tsk,
+- struct mm_struct *mm,
+- unsigned long start,
+- unsigned long nr_pages,
+- int write,
+- int force,
+- struct page **pages,
+- struct vm_area_struct **vmas)
+- {
+- unsigned int flags = 0;
+-
+- if (write)
+- flags |= FOLL_WRITE;
+- if (force)
+- flags |= FOLL_FORCE;
+-
+- #if defined(NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG)
+-
+- return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
+- pages, vmas, NULL);
+-
+- #else
+-
+- return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
+- pages, vmas);
+-
+- #endif
+-
+- }
+- #endif
+-#else
+- #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
+- #define NV_GET_USER_PAGES_REMOTE NV_GET_USER_PAGES
+- #else
+- #include <linux/mm.h>
+- #include <linux/sched.h>
+-
+- static inline long NV_GET_USER_PAGES_REMOTE(struct task_struct *tsk,
+- struct mm_struct *mm,
+- unsigned long start,
+- unsigned long nr_pages,
+- int write,
+- int force,
+- struct page **pages,
+- struct vm_area_struct **vmas)
+- {
+- unsigned int flags = 0;
+-
+- if (write)
+- flags |= FOLL_WRITE;
+- if (force)
+- flags |= FOLL_FORCE;
+-
+- return get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas);
+- }
+- #endif
+-#endif
+-
+ #endif /* _NV_LINUX_H_ */
diff -Naur a/kernel/nv-procfs.c b/kernel/nv-procfs.c
---- a/kernel/nv-procfs.c 2022-01-21 18:37:49.978268211 +0100
-+++ b/kernel/nv-procfs.c 2022-01-21 18:38:55.095843926 +0100
+--- a/kernel/nv-procfs.c 2022-06-05 13:18:33.913572656 +0200
++++ b/kernel/nv-procfs.c 2022-06-05 13:19:33.737278851 +0200
@@ -409,6 +409,15 @@
return ((status < 0) ? status : (int)count);
}
@@ -1426,8 +1687,8 @@ diff -Naur a/kernel/nv-procfs.c b/kernel/nv-procfs.c
static int
nv_procfs_read_text_file(
diff -Naur a/kernel/nv-vm.c b/kernel/nv-vm.c
---- a/kernel/nv-vm.c 2022-01-21 18:37:49.979268189 +0100
-+++ b/kernel/nv-vm.c 2022-01-21 18:38:55.097843883 +0100
+--- a/kernel/nv-vm.c 2022-06-05 13:18:33.914572634 +0200
++++ b/kernel/nv-vm.c 2022-06-05 13:19:33.739278808 +0200
@@ -12,6 +12,9 @@
#include "os-interface.h"
#include "nv.h"
@@ -1438,9 +1699,30 @@ diff -Naur a/kernel/nv-vm.c b/kernel/nv-vm.c
static inline void nv_set_contig_memory_uc(nv_pte_t *page_ptr, NvU32 num_pages)
{
+@@ -169,12 +172,20 @@
+
+ static inline int nv_map_sg(struct pci_dev *dev, struct scatterlist *sg)
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ return dma_map_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
++#else
+ return pci_map_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
++#endif
+ }
+
+ static inline void nv_unmap_sg(struct pci_dev *dev, struct scatterlist *sg)
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
++ dma_unmap_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
++#else
+ pci_unmap_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
++#endif
+ }
+
+ #define NV_MAP_SG_MAX_RETRIES 16
diff -Naur a/kernel/os-interface.c b/kernel/os-interface.c
---- a/kernel/os-interface.c 2022-01-21 18:37:49.982268124 +0100
-+++ b/kernel/os-interface.c 2022-01-21 18:38:55.115843489 +0100
+--- a/kernel/os-interface.c 2022-06-05 13:18:33.919572526 +0200
++++ b/kernel/os-interface.c 2022-06-05 13:19:33.751278549 +0200
@@ -439,7 +439,7 @@
NvU32 *useconds
)
@@ -1481,8 +1763,8 @@ diff -Naur a/kernel/os-interface.c b/kernel/os-interface.c
{
schedule_timeout(jiffies);
diff -Naur a/kernel/os-interface.h b/kernel/os-interface.h
---- a/kernel/os-interface.h 2022-01-21 18:37:49.982268124 +0100
-+++ b/kernel/os-interface.h 2022-01-21 18:38:55.116843467 +0100
+--- a/kernel/os-interface.h 2022-06-05 13:18:33.920572505 +0200
++++ b/kernel/os-interface.h 2022-06-05 13:19:33.752278527 +0200
@@ -24,7 +24,7 @@
* *
\***************************************************************************/
@@ -1493,31 +1775,33 @@ diff -Naur a/kernel/os-interface.h b/kernel/os-interface.h
/*
* Define away Microsoft compiler extensions when possible
diff -Naur a/kernel/os-mlock.c b/kernel/os-mlock.c
---- a/kernel/os-mlock.c 2022-01-21 18:37:49.983268102 +0100
-+++ b/kernel/os-mlock.c 2022-01-21 18:38:55.117843445 +0100
-@@ -44,11 +44,19 @@
+--- a/kernel/os-mlock.c 2022-06-05 13:18:33.921572483 +0200
++++ b/kernel/os-mlock.c 2022-06-05 13:19:33.753278505 +0200
+@@ -14,6 +14,8 @@
+ #include "os-interface.h"
+ #include "nv-linux.h"
+
++#include "nv-mm.h"
++
+ RM_STATUS NV_API_CALL os_lock_user_pages(
+ void *address,
+ NvU64 page_count,
+@@ -44,10 +46,10 @@
return rmStatus;
}
-+#if defined(NV_MM_HAS_MMAP_LOCK)
-+ down_read(&mm->mmap_lock);
-+ ret = NV_GET_USER_PAGES((unsigned long)address,
-+ page_count, write, force, user_pages, NULL);
-+ up_read(&mm->mmap_lock);
-+ pinned = ret;
-+#else
- down_read(&mm->mmap_sem);
+- down_read(&mm->mmap_sem);
++ nv_mmap_read_lock(mm);
ret = NV_GET_USER_PAGES((unsigned long)address,
page_count, write, force, user_pages, NULL);
- up_read(&mm->mmap_sem);
+- up_read(&mm->mmap_sem);
++ nv_mmap_read_unlock(mm);
pinned = ret;
-+#endif
if (ret < 0)
- {
diff -Naur a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
---- a/kernel/uvm/conftest.sh 2022-01-21 18:37:49.984268080 +0100
-+++ b/kernel/uvm/conftest.sh 2022-01-21 18:38:55.119843402 +0100
+--- a/kernel/uvm/conftest.sh 2022-06-05 13:18:33.922572461 +0200
++++ b/kernel/uvm/conftest.sh 2022-06-05 13:19:33.756278441 +0200
@@ -176,6 +176,7 @@
FILES="$FILES linux/ktime.h"
FILES="$FILES linux/file.h"
@@ -1537,8 +1821,8 @@ diff -Naur a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
#include <asm/set_memory.h>
#else
diff -Naur a/kernel/uvm/Makefile b/kernel/uvm/Makefile
---- a/kernel/uvm/Makefile 2022-01-21 18:37:49.983268102 +0100
-+++ b/kernel/uvm/Makefile 2022-01-21 18:38:55.117843445 +0100
+--- a/kernel/uvm/Makefile 2022-06-05 13:18:33.921572483 +0200
++++ b/kernel/uvm/Makefile 2022-06-05 13:19:33.754278484 +0200
@@ -207,6 +207,7 @@
RM_MODULE_SYMVERS:= $(RM_OUT_DIR)/Module.symvers
@@ -1548,8 +1832,8 @@ diff -Naur a/kernel/uvm/Makefile b/kernel/uvm/Makefile
module $(MODULE_NAME).ko: $(UVM_MODULE_SYMVERS) debug_diagnostics_printing
diff -Naur a/kernel/uvm/nvidia_uvm_linux.h b/kernel/uvm/nvidia_uvm_linux.h
---- a/kernel/uvm/nvidia_uvm_linux.h 2022-01-21 18:37:49.985268058 +0100
-+++ b/kernel/uvm/nvidia_uvm_linux.h 2022-01-21 18:38:55.120843380 +0100
+--- a/kernel/uvm/nvidia_uvm_linux.h 2022-06-05 13:18:33.922572461 +0200
++++ b/kernel/uvm/nvidia_uvm_linux.h 2022-06-05 13:19:33.757278419 +0200
@@ -141,7 +141,9 @@
#if !defined(NV_VMWARE)
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
@@ -1571,9 +1855,9 @@ diff -Naur a/kernel/uvm/nvidia_uvm_linux.h
b/kernel/uvm/nvidia_uvm_linux.h
#include <linux/ioctl32.h> /* register_ioctl32_conversion() */
#endif
diff -Naur a/kernel/uvm/nvidia_uvm_lite_api.c b/kernel/uvm/nvidia_uvm_lite_api.c
---- a/kernel/uvm/nvidia_uvm_lite_api.c 2022-01-21 18:37:49.986268036 +0100
-+++ b/kernel/uvm/nvidia_uvm_lite_api.c 2022-01-21 18:38:55.121843358 +0100
-@@ -30,6 +30,10 @@
+--- a/kernel/uvm/nvidia_uvm_lite_api.c 2022-06-05 13:18:33.924572418 +0200
++++ b/kernel/uvm/nvidia_uvm_lite_api.c 2022-06-05 13:19:33.760278354 +0200
+@@ -30,6 +30,12 @@
#include "uvm_gpu_ops_tests.h"
#endif
@@ -1581,20 +1865,160 @@ diff -Naur a/kernel/uvm/nvidia_uvm_lite_api.c
b/kernel/uvm/nvidia_uvm_lite_api.c
+#define mmap_sem mmap_lock
+#endif
+
++#include "nv-mm.h"
++
//
// nvidia_uvm_lite_api.c
//
+@@ -161,13 +167,13 @@
+ return RM_ERR_NOT_SUPPORTED;
+ }
+
+- down_write(¤t->mm->mmap_sem);
++ nv_mmap_write_lock(current->mm);
+
+ vma = find_uvmlite_vma(pParams->requestedBase, pParams->length, filp);
+
+ if (!vma)
+ {
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+ UVM_ERR_PRINT("Failed to find the vma (base: 0x%llx, length: %llu\n",
+ pParams->requestedBase, pParams->length);
+ return RM_ERR_UVM_ADDRESS_IN_USE;
+@@ -178,7 +184,7 @@
+
+ if (!pRecord)
+ {
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+ UVM_ERR_PRINT("attempted to commit region without a preceding mmap()
"
+ "call\n");
+ return RM_ERR_OBJECT_NOT_FOUND;
+@@ -187,7 +193,7 @@
+ if ((pRecord->baseAddress != pParams->requestedBase) ||
+ (PAGE_ALIGN(pRecord->length) != PAGE_ALIGN(pParams->length)))
+ {
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+ UVM_ERR_PRINT("attempted to commit region with different VA or
length"
+ " than used by preceding mmap\n");
+ return RM_ERR_UVM_ADDRESS_IN_USE;
+@@ -206,7 +212,7 @@
+ }
+
+ up_write(&pPriv->uvmPrivLock);
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+
+ return rmStatus;
+ }
+@@ -235,12 +241,12 @@
+ pParams->requestedBase, pParams->length,
+ pParams->newStreamId);
+
+- down_write(¤t->mm->mmap_sem);
++ nv_mmap_write_lock(current->mm);
+
+ vma = find_uvmlite_vma(pParams->requestedBase, pParams->length, filp);
+ if (vma == NULL)
+ {
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+ return RM_ERR_UVM_ADDRESS_IN_USE;
+ }
+
+@@ -250,7 +256,7 @@
+ rmStatus = uvmlite_region_set_stream(pRecord, pParams->newStreamId);
+
+ up_write(&pPriv->uvmPrivLock);
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+
+ return rmStatus;
+ }
+@@ -264,11 +270,11 @@
+
+ UVM_DBG_PRINT_RL("streamID: 0x%llx\n", pParams->streamId);
+
+- down_write(¤t->mm->mmap_sem);
++ nv_mmap_write_lock(current->mm);
+ down_write(&pPriv->uvmPrivLock);
+ rmStatus = uvmlite_set_stream_running(pPriv, pParams->streamId);
+ up_write(&pPriv->uvmPrivLock);
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+
+ return rmStatus;
+ }
+@@ -290,12 +296,12 @@
+ pParams->streamIdArray[pParams->nStreams - 1]);
+ }
+
+- down_write(¤t->mm->mmap_sem);
++ nv_mmap_write_lock(current->mm);
+ down_write(&pPriv->uvmPrivLock);
+ rmStatus = uvmlite_set_streams_stopped(pPriv, pParams->streamIdArray,
+ pParams->nStreams);
+ up_write(&pPriv->uvmPrivLock);
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+ return rmStatus;
+ }
+
+@@ -311,12 +317,12 @@
+ "flags: 0x%x\n",
+ pParams->requestedBase, pParams->length, pParams->flags);
+
+- down_write(¤t->mm->mmap_sem);
++ nv_mmap_write_lock(current->mm);
+
+ vma = find_uvmlite_vma(pParams->requestedBase, pParams->length, filp);
+ if (vma == NULL)
+ {
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+ return RM_ERR_UVM_ADDRESS_IN_USE;
+ }
+
+@@ -329,7 +335,7 @@
+ vma,
+ pRecord);
+ up_write(&pPriv->uvmPrivLock);
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+
+ return rmStatus;
+ }
+@@ -385,7 +391,7 @@
+ return rmStatus;
+ }
+
+- down_write(¤t->mm->mmap_sem);
++ nv_mmap_write_lock(current->mm);
+ rmStatus = RM_ERR_INVALID_ARGUMENT;
+ vma = find_counters_vma((unsigned long long) countersBaseAddress,
+ UVM_MAX_GPUS * UVM_PER_RESOURCE_COUNTERS_SIZE +
+@@ -416,7 +422,7 @@
+ }
+ }
+
+- up_write(¤t->mm->mmap_sem);
++ nv_mmap_write_unlock(current->mm);
+
+ //
+ // We can not reverse uvm_map_page, so inserted pages will stay
diff -Naur a/kernel/uvm/nvidia_uvm_lite.c b/kernel/uvm/nvidia_uvm_lite.c
---- a/kernel/uvm/nvidia_uvm_lite.c 2022-01-21 18:37:49.986268036 +0100
-+++ b/kernel/uvm/nvidia_uvm_lite.c 2022-01-21 18:38:55.121843358 +0100
+--- a/kernel/uvm/nvidia_uvm_lite.c 2022-06-05 13:18:33.924572418 +0200
++++ b/kernel/uvm/nvidia_uvm_lite.c 2022-06-05 13:19:33.759278376 +0200
@@ -131,8 +131,8 @@
RM_STATUS _preexisting_error_on_channel(UvmGpuMigrationTracking *pMigTracker,
UvmCommitRecord *pRecord);
-static void _set_timeout_in_usec(struct timeval *src,
- struct timeval *result,
-+static void _set_timeout_in_usec(struct nv_timeval *src,
-+ struct nv_timeval *result,
++static void _set_timeout_in_usec(nv_timeval *src,
++ nv_timeval *result,
unsigned long timeoutInUsec)
{
if (!src || !result)
@@ -1649,9 +2073,9 @@ diff -Naur a/kernel/uvm/nvidia_uvm_lite.c
b/kernel/uvm/nvidia_uvm_lite.c
- struct timeval eccErrorStartTime = {0};
- struct timeval eccErrorCurrentTime = {0};
- struct timeval eccTimeout = {0};
-+ struct nv_timeval eccErrorStartTime = {0};
-+ struct nv_timeval eccErrorCurrentTime = {0};
-+ struct nv_timeval eccTimeout = {0};
++ nv_timeval eccErrorStartTime = {0};
++ nv_timeval eccErrorCurrentTime = {0};
++ nv_timeval eccTimeout = {0};
NvBool bEccErrorTimeout = NV_FALSE;
NvBool bEccIncomingError = NV_FALSE;
unsigned rmInterruptSet = 0;
diff --git a/import-files-from-390.147.patch b/import-files-from-390.151.patch
similarity index 98%
rename from import-files-from-390.147.patch
rename to import-files-from-390.151.patch
index 24bc362..305ac9c 100644
--- a/import-files-from-390.147.patch
+++ b/import-files-from-390.151.patch
@@ -1,6 +1,6 @@
diff -Naur a/kernel/conftest.h b/kernel/conftest.h
--- a/kernel/conftest.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/conftest.h 2022-01-21 18:37:50.019267315 +0100
++++ b/kernel/conftest.h 2022-06-05 13:18:33.945571964 +0200
@@ -0,0 +1,11 @@
+#ifndef _CONFTEST_H
+#define _CONFTEST_H
@@ -15,7 +15,7 @@ diff -Naur a/kernel/conftest.h b/kernel/conftest.h
+#endif
diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
--- a/kernel/conftest.sh 2019-12-11 23:04:24.000000000 +0100
-+++ b/kernel/conftest.sh 2022-01-21 18:37:50.022267249 +0100
++++ b/kernel/conftest.sh 2022-06-05 13:18:33.949571878 +0200
@@ -24,7 +24,6 @@
OUTPUT=$5
XEN_PRESENT=1
@@ -155,7 +155,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
FILES="$FILES linux/printk.h"
FILES="$FILES linux/ratelimit.h"
FILES="$FILES linux/prio_tree.h"
-@@ -171,27 +129,23 @@
+@@ -171,27 +129,24 @@
FILES="$FILES linux/bug.h"
FILES="$FILES linux/sched/signal.h"
FILES="$FILES linux/sched/task.h"
@@ -167,6 +167,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ FILES="$FILES linux/dma-resv.h"
+ FILES="$FILES linux/dma-map-ops.h"
+ FILES="$FILES linux/stdarg.h"
++ FILES="$FILES linux/iosys-map.h"
+ # Arch specific headers which need testing
+ FILES_ARCH="asm/book3s/64/hash-64k.h"
@@ -192,7 +193,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
}
build_cflags() {
-@@ -202,72 +156,61 @@
+@@ -202,72 +157,61 @@
if [ "$OUTPUT" != "$SOURCES" ]; then
OUTPUT_CFLAGS="-I$OUTPUT/include2 -I$OUTPUT/include"
if [ -f "$OUTPUT/include/generated/autoconf.h" ]; then
@@ -306,7 +307,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
if [ -n "$BUILD_PARAMS" ]; then
CFLAGS="$CFLAGS -D$BUILD_PARAMS"
fi
-@@ -288,9 +231,31 @@
+@@ -288,9 +232,31 @@
CFLAGS="$CFLAGS -DCC_HAVE_ASM_GOTO"
fi
fi
@@ -339,7 +340,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#if defined(NV_LINUX_KCONFIG_H_PRESENT)
#include <linux/kconfig.h>
#endif
-@@ -356,6 +321,47 @@
+@@ -356,6 +322,47 @@
fi
}
@@ -387,7 +388,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
get_configuration_option() {
#
# Print the value of given configuration option, if defined
-@@ -424,6 +430,9 @@
+@@ -424,6 +431,9 @@
#
CODE="
#if defined(NV_ASM_SET_MEMORY_H_PRESENT)
@@ -397,7 +398,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#include <asm/set_memory.h>
#else
#include <asm/cacheflush.h>
-@@ -441,6 +450,9 @@
+@@ -441,6 +451,9 @@
#
CODE="
#if defined(NV_ASM_SET_MEMORY_H_PRESENT)
@@ -407,7 +408,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#include <asm/set_memory.h>
#else
#include <asm/cacheflush.h>
-@@ -452,12 +464,50 @@
+@@ -452,12 +465,50 @@
compile_check_conftest "$CODE"
"NV_SET_MEMORY_ARRAY_UC_PRESENT" "" "functions"
;;
@@ -458,7 +459,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#include <asm/set_memory.h>
#else
#include <asm/cacheflush.h>
-@@ -491,9 +541,7 @@
+@@ -491,9 +542,7 @@
#include <linux/version.h>
#include <linux/utsname.h>
#include <linux/mm.h>
@@ -469,7 +470,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
void conftest_change_page_attr(void) {
change_page_attr();
}"
-@@ -554,6 +602,20 @@
+@@ -554,6 +603,20 @@
fi
;;
@@ -490,7 +491,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
remap_pfn_range)
#
# Determine if the remap_pfn_range() function is
-@@ -568,61 +630,37 @@
+@@ -568,61 +631,37 @@
compile_check_conftest "$CODE"
"NV_REMAP_PFN_RANGE_PRESENT" "" "functions"
;;
@@ -577,7 +578,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
;;
i2c_adapter)
-@@ -768,6 +806,20 @@
+@@ -768,6 +807,20 @@
fi
;;
@@ -598,7 +599,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
acpi_device_ops)
#
# Determine if the 'acpi_device_ops' structure has
-@@ -1059,16 +1111,6 @@
+@@ -1059,16 +1112,6 @@
compile_check_conftest "$CODE"
"NV_CPUHP_SETUP_STATE_PRESENT" "" "functions"
;;
@@ -615,7 +616,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
acpi_evaluate_integer)
#
# Determine if the acpi_evaluate_integer() function is
-@@ -1188,6 +1230,19 @@
+@@ -1188,6 +1231,19 @@
compile_check_conftest "$CODE"
"NV_IOREMAP_CACHE_PRESENT" "" "functions"
;;
@@ -635,7 +636,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
ioremap_wc)
#
# Determine if the ioremap_wc() function is present.
-@@ -1371,47 +1426,6 @@
+@@ -1371,47 +1427,6 @@
compile_check_conftest "$CODE"
"NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL" "" "types"
;;
@@ -683,7 +684,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
sg_table)
#
# Determine if the struct sg_table type is present.
-@@ -1431,7 +1445,7 @@
+@@ -1431,7 +1446,7 @@
#
echo "$CONFTEST_PREAMBLE
#include <linux/scatterlist.h>
@@ -692,7 +693,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
}" > conftest$$.c
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
-@@ -1447,7 +1461,7 @@
+@@ -1447,7 +1462,7 @@
CODE="
#include <linux/scatterlist.h>
@@ -701,7 +702,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
sg_alloc_table();
}"
-@@ -1520,6 +1534,197 @@
+@@ -1520,6 +1535,197 @@
return
;;
@@ -899,7 +900,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
drm_available)
#
# Determine if the DRM subsystem is usable
-@@ -1533,26 +1738,47 @@
+@@ -1533,26 +1739,47 @@
#include <drm/drm_drv.h>
#endif
@@ -957,7 +958,40 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
proc_create_data)
#
# Determine if the proc_create_data() function is present.
-@@ -1610,7 +1836,7 @@
+@@ -1569,6 +1796,23 @@
+
+ pde_data)
+ #
++ # Determine if the pde_data() function is present.
++ #
++ # The commit c28198889c15 removed the function
++ # 'PDE_DATA()', and replaced it with 'pde_data()'
++ # ("proc: remove PDE_DATA() completely") in v5.17-rc1.
++ #
++ CODE="
++ #include <linux/proc_fs.h>
++ void conftest_pde_data(void) {
++ pde_data();
++ }"
++
++ compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT"
"" "functions"
++ ;;
++
++ PDE_DATA)
++ #
+ # Determine if the PDE_DATA() function is present.
+ #
+ CODE="
+@@ -1577,7 +1821,7 @@
+ PDE_DATA();
+ }"
+
+- compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT"
"" "functions"
++ compile_check_conftest "$CODE"
"NV_PDE_DATA_UPPER_CASE_PRESENT" "" "functions"
+ ;;
+
+ get_num_physpages)
+@@ -1610,7 +1854,7 @@
vm_operations_struct)
#
# Determine if the 'vm_operations_struct' structure has
@@ -966,7 +1000,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#
CODE="
#include <linux/mm.h>
-@@ -1619,45 +1845,56 @@
+@@ -1619,45 +1863,56 @@
}"
compile_check_conftest "$CODE"
"NV_VM_OPERATIONS_STRUCT_HAS_FAULT" "" "types"
@@ -1050,7 +1084,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
task_struct)
#
# Determine if the 'task_struct' structure has
-@@ -1672,6 +1909,20 @@
+@@ -1672,6 +1927,20 @@
compile_check_conftest "$CODE" "NV_TASK_STRUCT_HAS_CRED"
"" "types"
;;
@@ -1071,7 +1105,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
address_space)
#
# Determine if the 'address_space' structure has
-@@ -1755,6 +2006,19 @@
+@@ -1755,6 +2024,19 @@
compile_check_conftest "$CODE"
"NV_PM_VT_SWITCH_REQUIRED_PRESENT" "" "functions"
;;
@@ -1091,7 +1125,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
file_inode)
#
-@@ -1770,19 +2034,133 @@
+@@ -1770,19 +2052,133 @@
compile_check_conftest "$CODE" "NV_FILE_HAS_INODE"
"" "types"
;;
@@ -1175,9 +1209,8 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
- drm_pci_set_busid();
+ void conftest_dma_map_ops(void) {
+ struct dma_map_ops ops;
- }"
-
-- compile_check_conftest "$CODE"
"NV_DRM_PCI_SET_BUSID_PRESENT" "" "functions"
++ }"
++
+ compile_check_conftest "$CODE" "NV_DMA_MAP_OPS_PRESENT"
"" "types"
+ ;;
+
@@ -1226,13 +1259,14 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ #include <linux/dma-mapping.h>
+ void conftest_dma_map_resource(void) {
+ dma_map_resource();
-+ }"
-+
+ }"
+
+- compile_check_conftest "$CODE"
"NV_DRM_PCI_SET_BUSID_PRESENT" "" "functions"
+ compile_check_conftest "$CODE"
"NV_DMA_MAP_RESOURCE_PRESENT" "" "functions"
;;
write_cr4)
-@@ -1798,6 +2176,66 @@
+@@ -1798,6 +2194,66 @@
compile_check_conftest "$CODE" "NV_WRITE_CR4_PRESENT"
"" "functions"
;;
@@ -1299,7 +1333,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
for_each_online_node)
#
# Determine if the for_each_online_node() function is present.
-@@ -1824,6 +2262,705 @@
+@@ -1824,6 +2280,705 @@
compile_check_conftest "$CODE" "NV_NODE_END_PFN_PRESENT"
"" "functions"
;;
@@ -2005,7 +2039,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
get_user_pages)
#
# Conftest for get_user_pages()
-@@ -1841,7 +2978,7 @@
+@@ -1841,7 +2996,7 @@
# 2016 Oct 12: 768ae309a96103ed02eb1e111e838c87854d8b51
#
# linux-4.4.168 cherry-picked commit 768ae309a961 without
@@ -2014,7 +2048,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#
# Conftest #1: Check if get_user_pages accepts 6 arguments.
# Return if true.
-@@ -1921,7 +3058,6 @@
+@@ -1921,7 +3076,6 @@
return
fi
@@ -2022,7 +2056,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
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"
-@@ -1931,7 +3067,7 @@
+@@ -1931,7 +3085,7 @@
get_user_pages_remote)
#
# Determine if the function get_user_pages_remote() is
@@ -2031,7 +2065,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#
# get_user_pages_remote() was added by:
# 2016 Feb 12: 1e9877902dc7e11d2be038371c6fbf2dfcd469d7
-@@ -1944,13 +3080,17 @@
+@@ -1944,13 +3098,17 @@
# get_user_pages_remote() added 'locked' parameter
# 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
#
@@ -2050,7 +2084,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
get_user_pages_remote();
}" > conftest$$.c
-@@ -1959,6 +3099,7 @@
+@@ -1959,6 +3117,7 @@
if [ -f conftest$$.o ]; then
echo "#undef NV_GET_USER_PAGES_REMOTE_PRESENT" |
append_conftest "functions"
@@ -2058,7 +2092,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
echo "#undef
NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS" | append_conftest
"functions"
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" |
append_conftest "functions"
rm -f conftest$$.o
-@@ -1986,14 +3127,20 @@
+@@ -1986,14 +3145,20 @@
rm -f conftest$$.c
if [ -f conftest$$.o ]; then
@@ -2080,7 +2114,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
echo "$CONFTEST_PREAMBLE
#include <linux/mm.h>
long get_user_pages_remote(struct task_struct *tsk,
-@@ -2011,13 +3158,238 @@
+@@ -2011,13 +3176,238 @@
rm -f conftest$$.c
if [ -f conftest$$.o ]; then
@@ -2320,7 +2354,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
;;
drm_driver_unload_has_int_return_type)
-@@ -2032,38 +3404,192 @@
+@@ -2032,38 +3422,192 @@
#include <drm/drmP.h>
#endif
@@ -2373,13 +2407,11 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
- #include <drm/drmP.h>
+ #if defined(NV_DRM_DRM_ATOMIC_HELPER_H_PRESENT)
+ #include <drm/drm_atomic_helper.h>
- #endif
++ #endif
+ void conftest_drm_atomic_helper_disable_all(void) {
+ drm_atomic_helper_disable_all();
+ }"
-
-- #if defined(NV_DRM_DRM_PCI_H_PRESENT)
-- #include <drm/drm_pci.h>
++
+ compile_check_conftest "$CODE"
"NV_DRM_ATOMIC_HELPER_DISABLE_ALL_PRESENT" "" "functions"
+ ;;
+
@@ -2395,9 +2427,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ echo "$CONFTEST_PREAMBLE
+ #if defined(NV_DRM_DRM_ATOMIC_HELPER_H_PRESENT)
+ #include <drm/drm_atomic_helper.h>
- #endif
-- void conftest_drm_legacy_pci_init(void) {
-- drm_legacy_pci_init();
++ #endif
+ void conftest_drm_atomic_helper_set_config(void) {
+ drm_atomic_helper_set_config();
+ }" > conftest$$.c
@@ -2459,15 +2489,16 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ CODE="
+ #if defined(NV_DRM_DRM_ATOMIC_HELPER_H_PRESENT)
+ #include <drm/drm_atomic_helper.h>
-+ #endif
+ #endif
+ void conftest_drm_atomic_helper_connector_dpms(void) {
+ drm_atomic_helper_connector_dpms();
- }"
-
-- compile_check_conftest "$CODE"
"NV_DRM_LEGACY_PCI_INIT_PRESENT" "" "functions"
++ }"
++
+ compile_check_conftest "$CODE"
"NV_DRM_ATOMIC_HELPER_CONNECTOR_DPMS_PRESENT" ""
"functions"
+ ;;
-+
+
+- #if defined(NV_DRM_DRM_PCI_H_PRESENT)
+- #include <drm/drm_pci.h>
+ backlight_device_register)
+ #
+ # Determine if the backlight_device_register() function is present
@@ -2479,7 +2510,9 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ #include <linux/backlight.h>
+ #if !defined(CONFIG_BACKLIGHT_CLASS_DEVICE)
+ #error Backlight class device not enabled
-+ #endif
+ #endif
+- void conftest_drm_legacy_pci_init(void) {
+- drm_legacy_pci_init();
+ void conftest_backlight_device_register(void) {
+ backlight_device_register(NULL, NULL, NULL, NULL, NULL);
+ }" > conftest$$.c
@@ -2507,8 +2540,9 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ void conftest_backlight_props_type(void) {
+ struct backlight_properties tmp;
+ tmp.type = BACKLIGHT_RAW;
-+ }"
-+
+ }"
+
+- compile_check_conftest "$CODE"
"NV_DRM_LEGACY_PCI_INIT_PRESENT" "" "functions"
+ compile_check_conftest "$CODE"
"NV_BACKLIGHT_PROPERTIES_TYPE_PRESENT" "" "types"
+ ;;
+
@@ -2530,7 +2564,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
;;
timer_setup)
-@@ -2081,7 +3607,172 @@
+@@ -2081,7 +3625,172 @@
compile_check_conftest "$CODE" "NV_TIMER_SETUP_PRESENT"
"" "functions"
;;
@@ -2704,7 +2738,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#
# Determine if the function do_gettimeofday() is
# present.
-@@ -2109,9 +3800,32 @@
+@@ -2109,9 +3818,32 @@
compile_check_conftest "$CODE"
"NV_DO_GETTIMEOFDAY_PRESENT" "" "functions"
;;
@@ -2739,7 +2773,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#
# Added by commit e6b62714e87c8811d5564b6a0738dcde63a51774 (drm:
# Introduce drm_gem_object_{get,put}()) on 2017-02-28.
-@@ -2124,20 +3838,19 @@
+@@ -2124,20 +3856,19 @@
#if defined(NV_DRM_DRM_GEM_H_PRESENT)
#include <drm/drm_gem.h>
#endif
@@ -2767,7 +2801,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
#
CODE="
#if defined(NV_DRM_DRMP_H_PRESENT)
-@@ -2147,14 +3860,108 @@
+@@ -2147,14 +3878,108 @@
#if defined(NV_DRM_DRM_DRV_H_PRESENT)
#include <drm/drm_drv.h>
#endif
@@ -2810,7 +2844,9 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+
+ compile_check_conftest "$CODE"
"NV_DRM_CONNECTOR_LIST_ITER_BEGIN_PRESENT" "" "functions"
+ ;;
-+
+
+- void conftest_drm_driver_legacy_feature_bit_present(struct drm_driver *drv)
{
+- drv->driver_features = DRIVER_LEGACY;
+ drm_atomic_helper_swap_state_has_stall_arg)
+ #
+ # Determine if drm_atomic_helper_swap_state() has 'stall' argument.
@@ -2827,12 +2863,11 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ struct drm_atomic_state *state,
+ bool stall) {
+ (void)drm_atomic_helper_swap_state(state, stall);
-+ }"
-+
-+ compile_check_conftest "$CODE"
"NV_DRM_ATOMIC_HELPER_SWAP_STATE_HAS_STALL_ARG" | append_conftest
"types"
+ }"
-- void conftest_drm_driver_legacy_feature_bit_present(struct drm_driver *drv)
{
-- drv->driver_features = DRIVER_LEGACY;
+- compile_check_conftest "$CODE"
"NV_DRM_DRIVER_LEGACY_FEATURE_BIT_PRESENT" "" "types"
++ compile_check_conftest "$CODE"
"NV_DRM_ATOMIC_HELPER_SWAP_STATE_HAS_STALL_ARG" | append_conftest
"types"
++
+ #
+ # Determine if drm_atomic_helper_swap_state() returns int.
+ #
@@ -2848,9 +2883,8 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+ struct drm_atomic_state *state,
+ bool stall) {
+ return drm_atomic_helper_swap_state(state, stall);
- }"
-
-- compile_check_conftest "$CODE"
"NV_DRM_DRIVER_LEGACY_FEATURE_BIT_PRESENT" "" "types"
++ }"
++
+ compile_check_conftest "$CODE"
"NV_DRM_ATOMIC_HELPER_SWAP_STATE_RETURN_INT" | append_conftest
"types"
;;
@@ -2879,7 +2913,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
drm_driver_prime_flag_present)
#
-@@ -2181,6 +3988,7 @@
+@@ -2181,6 +4006,7 @@
#if defined(NV_DRM_DRM_DRV_H_PRESENT)
#include <drm/drm_drv.h>
#endif
@@ -2887,7 +2921,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
unsigned int drm_driver_prime_flag_present_conftest(void) {
return DRIVER_PRIME;
}"
-@@ -2188,12 +3996,529 @@
+@@ -2188,12 +4014,546 @@
compile_check_conftest "$CODE"
"NV_DRM_DRIVER_PRIME_FLAG_PRESENT" "" "types"
;;
@@ -3411,6 +3445,23 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
+
+ compile_check_conftest "$CODE" "NV_DRM_DEVICE_HAS_PDEV"
"" "types"
+ ;;
++
++ acpi_bus_get_device)
++ #
++ # Determine if the acpi_bus_get_device() function is present
++ #
++ # acpi_bus_get_device() was removed by commit ac2a3feefad5
++ # ("ACPI: bus: Eliminate acpi_bus_get_device()") in
++ # v5.18-rc2 (2022-04-05).
++ #
++ CODE="
++ #include <linux/acpi.h>
++ int conftest_acpi_bus_get_device(void) {
++ return acpi_bus_get_device();
++ }"
++ compile_check_conftest "$CODE"
"NV_ACPI_BUS_GET_DEVICE_PRESENT" "" "functions"
++ ;;
++
esac
}
@@ -3420,7 +3471,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
case "$6" in
cc_sanity_check)
#
-@@ -2239,137 +4564,85 @@
+@@ -2239,137 +4599,85 @@
cc_version_check)
#
@@ -3528,21 +3579,21 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
echo "";
- echo "gcc-version-check failed:";
+ echo "Compiler version check failed:";
- echo "";
-- echo "$MSG" | fmt -w 52
++ echo "";
+ echo "The major and minor number of the compiler used to";
+ echo "compile the kernel:";
echo "";
+- echo "$MSG" | fmt -w 52
++ echo "${kernel_cc_string}";
+ echo "";
- echo "If you know what you are doing and want to override";
- echo "the gcc version check, you can do so by setting the";
- echo "IGNORE_CC_MISMATCH environment variable to
\"1\".";
-+ echo "${kernel_cc_string}";
++ echo "does not match the compiler used here:";
echo "";
- echo "In any other case, set the CC environment variable";
- echo "to the name of the compiler that was used to compile";
- echo "the kernel.";
-+ echo "does not match the compiler used here:";
-+ echo "";
+ $CC --version
+ echo "";
+ echo "It is recommended to set the CC environment variable";
@@ -3620,7 +3671,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
fi
;;
-@@ -2449,52 +4722,6 @@
+@@ -2449,52 +4757,6 @@
fi
;;
@@ -3673,7 +3724,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
xen_sanity_check)
#
# Check if the target kernel is a Xen kernel. If so, exit, since
-@@ -2506,6 +4733,8 @@
+@@ -2506,6 +4768,8 @@
exit 0
fi
@@ -3682,7 +3733,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
if [ "$XEN_PRESENT" != "0" ]; then
echo "The kernel you are installing for is a Xen kernel!";
echo "";
-@@ -2571,7 +4800,7 @@
+@@ -2571,7 +4835,7 @@
for PATCH in patch-*.h; do
if [ -f $PATCH ]; then
@@ -3691,7 +3742,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
PATCHES="$PATCHES "`echo $PATCH | sed -s
's/patch-\(.*\)\.h/\1/'`
fi
done
-@@ -2579,14 +4808,11 @@
+@@ -2579,14 +4843,11 @@
echo "static struct {
const char *short_description;
const char *description;
@@ -3709,7 +3760,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
exit 0
;;
-@@ -2596,20 +4822,13 @@
+@@ -2596,20 +4857,13 @@
# Run a series of compile tests to determine the set of interfaces
# and features available in the target kernel.
#
@@ -3733,7 +3784,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
exit 0
;;
-@@ -2635,7 +4854,33 @@
+@@ -2635,7 +4889,33 @@
exit 1
fi
;;
@@ -3768,7 +3819,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
test_configuration_option)
#
# Check to see if the given config option is set.
-@@ -2679,4 +4924,25 @@
+@@ -2679,4 +4959,25 @@
exit 1
;;
@@ -3796,7 +3847,7 @@ diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
esac
diff -Naur a/kernel/nv-gpu-info.h b/kernel/nv-gpu-info.h
--- a/kernel/nv-gpu-info.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nv-gpu-info.h 2022-01-21 18:37:50.022267249 +0100
++++ b/kernel/nv-gpu-info.h 2022-06-05 13:18:33.949571878 +0200
@@ -0,0 +1,31 @@
+/* _NVRM_COPYRIGHT_BEGIN_
+ *
@@ -3831,7 +3882,7 @@ diff -Naur a/kernel/nv-gpu-info.h b/kernel/nv-gpu-info.h
+#endif /* _NV_GPU_INFO_H_ */
diff -Naur a/kernel/nvidia-dma-fence-helper.h b/kernel/nvidia-dma-fence-helper.h
--- a/kernel/nvidia-dma-fence-helper.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-dma-fence-helper.h 2022-01-21 18:37:50.023267227 +0100
++++ b/kernel/nvidia-dma-fence-helper.h 2022-06-05 13:18:33.951571834 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
@@ -3956,7 +4007,7 @@ diff -Naur a/kernel/nvidia-dma-fence-helper.h
b/kernel/nvidia-dma-fence-helper.h
+#endif /* __NVIDIA_DMA_FENCE_HELPER_H__ */
diff -Naur a/kernel/nvidia-dma-resv-helper.h b/kernel/nvidia-dma-resv-helper.h
--- a/kernel/nvidia-dma-resv-helper.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-dma-resv-helper.h 2022-01-21 18:37:50.025267183 +0100
++++ b/kernel/nvidia-dma-resv-helper.h 2022-06-05 13:18:33.951571834 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
@@ -4040,7 +4091,7 @@ diff -Naur a/kernel/nvidia-dma-resv-helper.h
b/kernel/nvidia-dma-resv-helper.h
+#endif /* __NVIDIA_DMA_RESV_HELPER_H__ */
diff -Naur a/kernel/nvidia-drm-conftest.h b/kernel/nvidia-drm-conftest.h
--- a/kernel/nvidia-drm-conftest.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-conftest.h 2022-01-21 18:37:50.025267183 +0100
++++ b/kernel/nvidia-drm-conftest.h 2022-06-05 13:18:33.952571813 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
@@ -4108,8 +4159,8 @@ diff -Naur a/kernel/nvidia-drm-conftest.h
b/kernel/nvidia-drm-conftest.h
+#endif /* defined(__NVIDIA_DRM_CONFTEST_H__) */
diff -Naur a/kernel/nvidia-drm-gem.c b/kernel/nvidia-drm-gem.c
--- a/kernel/nvidia-drm-gem.c 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-gem.c 2022-01-21 18:37:50.025267183 +0100
-@@ -0,0 +1,193 @@
++++ b/kernel/nvidia-drm-gem.c 2022-06-05 13:18:33.953571791 +0200
+@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
+ *
@@ -4165,8 +4216,19 @@ diff -Naur a/kernel/nvidia-drm-gem.c b/kernel/nvidia-drm-gem.c
+
+#if !defined(NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS) && \
+ defined(NV_DRM_GEM_OBJECT_VMAP_HAS_MAP_ARG)
++
++/*
++ * The 'dma_buf_map' structure is renamed to 'iosys_map' by the commit
++ * 7938f4218168 ("dma-buf-map: Rename to iosys-map").
++ */
++#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
++typedef struct iosys_map nv_sysio_map_t;
++#else
++typedef struct dma_buf_map nv_sysio_map_t;
++#endif
++
+static int nv_drm_gem_vmap(struct drm_gem_object *gem,
-+ struct dma_buf_map *map)
++ nv_sysio_map_t *map)
+{
+ map->vaddr = nv_drm_gem_prime_vmap(gem);
+ if (map->vaddr == NULL) {
@@ -4177,7 +4239,7 @@ diff -Naur a/kernel/nvidia-drm-gem.c b/kernel/nvidia-drm-gem.c
+}
+
+static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
-+ struct dma_buf_map *map)
++ nv_sysio_map_t *map)
+{
+ nv_drm_gem_prime_vunmap(gem, map->vaddr);
+ map->vaddr = NULL;
@@ -4305,7 +4367,7 @@ diff -Naur a/kernel/nvidia-drm-gem.c b/kernel/nvidia-drm-gem.c
+#endif /* NV_DRM_AVAILABLE */
diff -Naur a/kernel/nvidia-drm-gem.h b/kernel/nvidia-drm-gem.h
--- a/kernel/nvidia-drm-gem.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-gem.h 2022-01-21 18:37:50.026267161 +0100
++++ b/kernel/nvidia-drm-gem.h 2022-06-05 13:18:33.953571791 +0200
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
@@ -4507,7 +4569,7 @@ diff -Naur a/kernel/nvidia-drm-gem.h b/kernel/nvidia-drm-gem.h
+#endif /* __NVIDIA_DRM_GEM_H__ */
diff -Naur a/kernel/nvidia-drm-gem-user-memory.c b/kernel/nvidia-drm-gem-user-memory.c
--- a/kernel/nvidia-drm-gem-user-memory.c 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-gem-user-memory.c 2022-01-21 18:37:50.025267183 +0100
++++ b/kernel/nvidia-drm-gem-user-memory.c 2022-06-05 13:18:33.952571813 +0200
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
@@ -4650,7 +4712,7 @@ diff -Naur a/kernel/nvidia-drm-gem-user-memory.c
b/kernel/nvidia-drm-gem-user-me
+#endif
diff -Naur a/kernel/nvidia-drm-gem-user-memory.h b/kernel/nvidia-drm-gem-user-memory.h
--- a/kernel/nvidia-drm-gem-user-memory.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-gem-user-memory.h 2022-01-21 18:37:50.025267183 +0100
++++ b/kernel/nvidia-drm-gem-user-memory.h 2022-06-05 13:18:33.953571791 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
@@ -4707,7 +4769,7 @@ diff -Naur a/kernel/nvidia-drm-gem-user-memory.h
b/kernel/nvidia-drm-gem-user-me
+#endif /* __NVIDIA_DRM_GEM_USER_MEMORY_H__ */
diff -Naur a/kernel/nvidia-drm-helper.c b/kernel/nvidia-drm-helper.c
--- a/kernel/nvidia-drm-helper.c 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-helper.c 2022-01-21 18:37:50.026267161 +0100
++++ b/kernel/nvidia-drm-helper.c 2022-06-05 13:18:33.954571769 +0200
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
@@ -4900,7 +4962,7 @@ diff -Naur a/kernel/nvidia-drm-helper.c
b/kernel/nvidia-drm-helper.c
+#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
diff -Naur a/kernel/nvidia-drm-helper.h b/kernel/nvidia-drm-helper.h
--- a/kernel/nvidia-drm-helper.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-helper.h 2022-01-21 18:37:50.027267140 +0100
++++ b/kernel/nvidia-drm-helper.h 2022-06-05 13:18:33.955571748 +0200
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
@@ -5345,7 +5407,7 @@ diff -Naur a/kernel/nvidia-drm-helper.h
b/kernel/nvidia-drm-helper.h
+#endif /* __NVIDIA_DRM_HELPER_H__ */
diff -Naur a/kernel/nvidia-drm-ioctl.h b/kernel/nvidia-drm-ioctl.h
--- a/kernel/nvidia-drm-ioctl.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-ioctl.h 2022-01-21 18:37:50.027267140 +0100
++++ b/kernel/nvidia-drm-ioctl.h 2022-06-05 13:18:33.955571748 +0200
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
@@ -5484,7 +5546,7 @@ diff -Naur a/kernel/nvidia-drm-ioctl.h b/kernel/nvidia-drm-ioctl.h
+#endif /* _UAPI_NVIDIA_DRM_IOCTL_H_ */
diff -Naur a/kernel/nvidia-drm-linux.c b/kernel/nvidia-drm-linux.c
--- a/kernel/nvidia-drm-linux.c 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-linux.c 2022-01-21 18:37:50.027267140 +0100
++++ b/kernel/nvidia-drm-linux.c 2022-06-05 13:18:33.955571748 +0200
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
@@ -5673,7 +5735,7 @@ diff -Naur a/kernel/nvidia-drm-linux.c b/kernel/nvidia-drm-linux.c
+#endif
diff -Naur a/kernel/nvidia-drm-os-interface.h b/kernel/nvidia-drm-os-interface.h
--- a/kernel/nvidia-drm-os-interface.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-os-interface.h 2022-01-21 18:37:50.028267118 +0100
++++ b/kernel/nvidia-drm-os-interface.h 2022-06-05 13:18:33.956571726 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
@@ -5733,7 +5795,7 @@ diff -Naur a/kernel/nvidia-drm-os-interface.h
b/kernel/nvidia-drm-os-interface.h
+#endif /* __NVIDIA_DRM_OS_INTERFACE_H__ */
diff -Naur a/kernel/nvidia-drm-priv.h b/kernel/nvidia-drm-priv.h
--- a/kernel/nvidia-drm-priv.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvidia-drm-priv.h 2022-01-21 18:37:50.028267118 +0100
++++ b/kernel/nvidia-drm-priv.h 2022-06-05 13:18:33.956571726 +0200
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
@@ -5856,7 +5918,7 @@ diff -Naur a/kernel/nvidia-drm-priv.h b/kernel/nvidia-drm-priv.h
+#endif /* __NVIDIA_DRM_PRIV_H__ */
diff -Naur a/kernel/nvkms-api-types.h b/kernel/nvkms-api-types.h
--- a/kernel/nvkms-api-types.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvkms-api-types.h 2022-01-21 18:37:50.029267096 +0100
++++ b/kernel/nvkms-api-types.h 2022-06-05 13:18:33.957571704 +0200
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
@@ -6166,7 +6228,7 @@ diff -Naur a/kernel/nvkms-api-types.h b/kernel/nvkms-api-types.h
+#endif /* NVKMS_API_TYPES_H */
diff -Naur a/kernel/nvkms-kapi.h b/kernel/nvkms-kapi.h
--- a/kernel/nvkms-kapi.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nvkms-kapi.h 2022-01-21 18:37:50.029267096 +0100
++++ b/kernel/nvkms-kapi.h 2022-06-05 13:18:33.957571704 +0200
@@ -0,0 +1,788 @@
+/* _NVRM_COPYRIGHT_BEGIN_
+ *
@@ -6958,7 +7020,7 @@ diff -Naur a/kernel/nvkms-kapi.h b/kernel/nvkms-kapi.h
+#endif /* defined(__NVKMS_KAPI_H__) */
diff -Naur a/kernel/nv-mm.h b/kernel/nv-mm.h
--- a/kernel/nv-mm.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nv-mm.h 2022-01-21 18:37:50.022267249 +0100
++++ b/kernel/nv-mm.h 2022-06-05 13:18:33.950571856 +0200
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ Copyright (c) 2016-2017 NVIDIA Corporation
@@ -7247,7 +7309,7 @@ diff -Naur a/kernel/nv-mm.h b/kernel/nv-mm.h
+#endif // __NV_MM_H__
diff -Naur a/kernel/nv_stdarg.h b/kernel/nv_stdarg.h
--- a/kernel/nv_stdarg.h 1970-01-01 01:00:00.000000000 +0100
-+++ b/kernel/nv_stdarg.h 2022-01-21 18:37:50.023267227 +0100
++++ b/kernel/nv_stdarg.h 2022-06-05 13:18:33.951571834 +0200
@@ -0,0 +1,39 @@
+/*
+ * SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All
rights reserved.
@@ -7290,7 +7352,7 @@ diff -Naur a/kernel/nv_stdarg.h b/kernel/nv_stdarg.h
+#endif // _NV_STDARG_H_
diff -Naur a/kernel/nv-time.h b/kernel/nv-time.h
--- a/kernel/nv-time.h 2019-12-11 23:04:24.000000000 +0100
-+++ b/kernel/nv-time.h 2022-01-21 18:37:50.023267227 +0100
++++ b/kernel/nv-time.h 2022-06-05 13:18:33.950571856 +0200
@@ -23,12 +23,20 @@
#ifndef __NV_TIME_H__
#define __NV_TIME_H__
diff --git a/nvidia-340xx-kmod.spec b/nvidia-340xx-kmod.spec
index 5fa95db..ca5534a 100644
--- a/nvidia-340xx-kmod.spec
+++ b/nvidia-340xx-kmod.spec
@@ -12,14 +12,14 @@ Name: nvidia-340xx-kmod
Epoch: 1
Version: 340.108
# Taken over by kmodtool
-Release: 19%{?dist}
+Release: 20%{?dist}
Summary: NVIDIA display driver kernel module
Group: System Environment/Kernel
License: Redistributable, no modification permitted
URL:
http://www.nvidia.com/
Source11: nvidia-kmodtool-excludekernel-filterfile
-Patch0: import-files-from-390.147.patch
+Patch0: import-files-from-390.151.patch
Patch1: fix-build-issues.patch
BuildRequires: elfutils-libelf-devel
@@ -77,6 +77,9 @@ done
%{?akmod_install}
%changelog
+* Sun Jun 05 2022 Łukasz Wojniłowicz <lukasz.wojnilowicz(a)gmail.com> - 1:340.108-20
+- Patch for kernel-5.18.0
+
* Sun Apr 03 2022 Łukasz Wojniłowicz <lukasz.wojnilowicz(a)gmail.com> - 1:340.108-19
- Patch for kernel-5.17.0