[packages/xorg-driver-video-nvidia-legacy-390xx] up to 390.141

atler atler at pld-linux.org
Fri Jan 8 11:10:32 CET 2021


commit ebe2077a6881d932d844821900a8323627d078ce
Author: Jan Palus <atler at pld-linux.org>
Date:   Fri Jan 8 10:34:14 2021 +0100

    up to 390.141

 kernel-5.10.patch                          | 206 ----------
 kernel-5.8-uvm.patch                       | 621 -----------------------------
 kernel-5.8.patch                           |  89 -----
 kernel-5.9-uvm.patch                       |  24 --
 kernel-5.9.patch                           | 354 ----------------
 xorg-driver-video-nvidia-legacy-390xx.spec |  20 +-
 6 files changed, 4 insertions(+), 1310 deletions(-)
---
diff --git a/xorg-driver-video-nvidia-legacy-390xx.spec b/xorg-driver-video-nvidia-legacy-390xx.spec
index c562711..f699d84 100644
--- a/xorg-driver-video-nvidia-legacy-390xx.spec
+++ b/xorg-driver-video-nvidia-legacy-390xx.spec
@@ -33,33 +33,28 @@ exit 1
 
 %define		no_install_post_check_so 1
 
-%define		rel	4
+%define		rel	1
 %define		pname	xorg-driver-video-nvidia-legacy-390xx
 Summary:	Linux Drivers for nVidia GeForce/Quadro Chips
 Summary(hu.UTF-8):	Linux meghajtók nVidia GeForce/Quadro chipekhez
 Summary(pl.UTF-8):	Sterowniki do kart graficznych nVidia GeForce/Quadro
 Name:		%{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
 # when updating version here, keep nvidia-settings.spec in sync as well
-Version:	390.138
+Version:	390.141
 Release:	%{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
 Epoch:		1
 License:	nVidia Binary
 Group:		X11
 Source0:	http://us.download.nvidia.com/XFree86/Linux-x86/%{version}/NVIDIA-Linux-x86-%{version}.run
-# Source0-md5:	1247db325e3127324e28fb5f7c59ad50
+# Source0-md5:	f3e6660ffe5338b17b7e643d0eceb57e
 Source1:	http://us.download.nvidia.com/XFree86/Linux-x86_64/%{version}/NVIDIA-Linux-x86_64-%{version}-no-compat32.run
-# Source1-md5:	06e8b4f973719cb425a580542c861259
+# Source1-md5:	d794fa3548343ffaf6d6398ff69f6f27
 Source2:	%{pname}-xinitrc.sh
 Source3:	gl.pc.in
 Source4:	10-nvidia.conf
 Source5:	10-nvidia-modules.conf
 Patch0:		X11-driver-nvidia-GL.patch
 Patch1:		X11-driver-nvidia-desktop.patch
-Patch2:		kernel-5.8.patch
-Patch3:		kernel-5.8-uvm.patch
-Patch4:		kernel-5.9.patch
-Patch5:		kernel-5.9-uvm.patch
-Patch6:		kernel-5.10.patch
 URL:		http://www.nvidia.com/object/unix.html
 BuildRequires:	rpmbuild(macros) >= 1.701
 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
@@ -266,13 +261,6 @@ rm -rf NVIDIA-Linux-x86*-%{version}*
 %endif
 %patch0 -p1
 %patch1 -p1
-%patch2 -p1
-%patch4 -p1
-%ifarch %{x8664}
-%patch3 -p1
-%patch5 -p1
-%endif
-%patch6 -p1
 echo 'EXTRA_CFLAGS += -Wno-pointer-arith -Wno-sign-compare -Wno-unused' >> kernel/Makefile.kbuild
 
 %build
diff --git a/kernel-5.10.patch b/kernel-5.10.patch
deleted file mode 100644
index 053e9c1..0000000
--- a/kernel-5.10.patch
+++ /dev/null
@@ -1,206 +0,0 @@
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/common/inc/nv-linux.h.orig	2020-12-22 11:58:13.756901968 +0100
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/common/inc/nv-linux.h	2020-12-22 12:34:56.069935099 +0100
-@@ -1304,7 +1304,8 @@
-  * device.  So if SWIOTLB is enabled, we should avoid making
-  * mapping calls.
-  */
--static inline NvBool nv_dma_maps_swiotlb(struct pci_dev *dev)
-+static inline NvBool
-+nv_dma_maps_swiotlb(struct pci_dev *dev)
- {
-     NvBool swiotlb_in_use = NV_FALSE;
- #if defined(CONFIG_SWIOTLB)
-@@ -1316,7 +1317,6 @@
-      * get_dma_ops() interface.
-      */
-     #if defined(NV_GET_DMA_OPS_PRESENT)
--      #if defined(NV_DMA_MAP_OPS_PRESENT) || defined(NV_SWIOTLB_DMA_OPS_PRESENT)
-     /*
-      * The __attribute__ ((unused)) is necessary because in at least one
-      * case, *none* of the preprocessor branches below are taken, and
-@@ -1324,14 +1324,11 @@
-      * happen with the (NV_IS_EXPORT_SYMBOL_PRESENT_swiotlb_map_sg_attrs == 1)
-      * case.
-      */
--    const struct dma_map_ops *ops __attribute__ ((unused)) = get_dma_ops(&dev->dev);
--      #else
--    const struct dma_mapping_ops *ops __attribute__ ((unused)) = get_dma_ops(&dev->dev);
--      #endif
-+    const struct dma_map_ops *ops __attribute__ ((unused)) = get_dma_ops(&dev->dev);
-     #else
-     const struct dma_mapping_ops *ops __attribute__ ((unused)) = dma_ops;
-     #endif
--    #if defined(NV_DMA_MAP_OPS_PRESENT) || defined(NV_SWIOTLB_DMA_OPS_PRESENT)
-+
-     /*
-      * The switch from dma_mapping_ops -> dma_map_ops coincided with the
-      * switch from swiotlb_map_sg -> swiotlb_map_sg_attrs.
-@@ -1352,9 +1349,9 @@
-        * NV_IS_EXPORT_SYMBOL_PRESENT_swiotlb_dma_ops == 0) does
-        * nothing, and ends up dropping us out to the last line of this function,
-        * effectively returning false. The nearly-human-readable version of that
--       * case is "Either struct dma_map_ops or struct swiotlb_dma_ops is present
--       * (NV_DMA_MAP_OPS_PRESENT or NV_SWIOTLB_DMA_OPS_PRESENT is defined) but
--       * neither swiotlb_map_sg_attrs nor swiotlb_dma_ops is present".
-+       * case is "struct swiotlb_dma_ops is present (NV_SWIOTLB_DMA_OPS_PRESENT
-+       * is defined) but neither swiotlb_map_sg_attrs nor swiotlb_dma_ops is
-+       * present".
-        *
-        * That can happen on kernels that fall within below range:
-        *
-@@ -1378,17 +1375,6 @@
-        * we just return NV_FALSE and in nv_compute_gfp_mask() we check for
-        * whether swiotlb could possibly be used (outside of swiotlb=force).
-        */
--    #else
--    swiotlb_in_use = (ops->map_sg == swiotlb_map_sg);
--    #endif
--  #elif defined(NVCPU_X86_64)
--    /*
--     * Fallback for old 2.6 kernels - if the DMA operations infrastructure
--     * isn't in place, use the swiotlb flag. Before dma_ops was added, this
--     * flag used to be exported. It still exists in modern kernels but is no
--     * longer exported.
--     */
--    swiotlb_in_use = (swiotlb == 1);
-   #endif
- #endif
- 
-diff --color -ur NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/common/inc/nv-linux.h NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/common/inc/nv-linux.h
---- NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/common/inc/nv-linux.h	2020-12-22 12:36:18.220333393 +0100
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/common/inc/nv-linux.h	2020-12-22 12:43:57.293884303 +0100
-@@ -178,6 +178,10 @@
- #include <linux/dma-mapping.h>
- #endif
- 
-+#if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT)
-+#include <linux/dma-map-ops.h>
-+#endif
-+
- #if defined(CONFIG_SWIOTLB) && defined(NVCPU_AARCH64)
- #include <linux/swiotlb.h>
- #endif
-diff --color -ur NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/conftest.sh
---- NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/conftest.sh	2020-12-22 12:36:18.166999801 +0100
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/conftest.sh	2020-12-22 12:43:18.766880222 +0100
-@@ -134,6 +134,7 @@
-     FILES="$FILES linux/fence.h"
-     FILES="$FILES linux/ktime.h"
-     FILES="$FILES linux/dma-resv.h"
-+    FILES="$FILES linux/dma-map-ops.h"
- 
-     # Arch specific headers which need testing
-     FILES_ARCH="asm/book3s/64/hash-64k.h"
-@@ -2097,8 +2098,20 @@
-             #
-             # Determine if the get_dma_ops() function is present.
-             #
-+            # The structure was made available to all architectures by commit
-+            # e1c7e324539a ("dma-mapping: always provide the dma_map_ops
-+            # based implementation") in v4.5
-+            #
-+            # Commit 0a0f0d8be76d ("dma-mapping: split <linux/dma-mapping.h>")
-+            # in v5.10-rc1 (2020-09-22), moved get_dma_ops() function
-+            # prototype from <linux/dma-mapping.h> to <linux/dma-map-ops.h>.
-+            #
-             CODE="
-+            #if defined(NV_LINUX_DMA_MAP_OPS_H_PRESENT)
-+            #include <linux/dma-map-ops.h>
-+            #else
-             #include <linux/dma-mapping.h>
-+            #endif
-             void conftest_get_dma_ops(void) {
-                 get_dma_ops();
-             }"
-diff --color -ur NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/conftest.sh NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/conftest.sh
---- NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/conftest.sh	2020-12-22 13:14:54.092636780 +0100
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/conftest.sh	2020-12-22 13:17:31.066679257 +0100
-@@ -4244,6 +4244,30 @@
- 
-             compile_check_conftest "$CODE" "NV_VGA_TRYGET_PRESENT" "" "functions"
-         ;;
-+
-+        drm_prime_pages_to_sg_has_drm_device_arg)
-+            #
-+            # Determine if drm_prime_pages_to_sg() has 'dev' argument.
-+            #
-+            # drm_prime_pages_to_sg() is updated to take 'dev' argument by commit
-+            # 707d561f77b5 ("drm: allow limiting the scatter list size.").
-+            #
-+            CODE="
-+            #if defined(NV_DRM_DRMP_H_PRESENT)
-+            #include <drm/drmP.h>
-+            #endif
-+            #if defined(NV_DRM_DRM_PRIME_H_PRESENT)
-+            #include <drm/drm_prime.h>
-+            #endif
-+
-+            struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev,
-+                                                   struct page **pages,
-+                                                   unsigned int nr_pages) {
-+                return 0;
-+            }"
-+
-+            compile_check_conftest "$CODE" "NV_DRM_PRIME_PAGES_TO_SG_HAS_DRM_DEVICE_ARG" "" "types"
-+        ;;
-     esac
- }
- 
-diff --color -ur NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
---- NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c	2020-05-14 14:29:25.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c	2020-12-22 13:18:37.296993224 +0100
-@@ -29,6 +29,7 @@
- #endif
- 
- #include "nvidia-drm-gem-user-memory.h"
-+#include "nvidia-drm-helper.h"
- #include "nvidia-drm-ioctl.h"
- 
- static inline
-@@ -46,9 +46,11 @@
-     struct nv_drm_gem_object *nv_gem)
- {
-     struct nv_drm_gem_user_memory *nv_user_memory = to_nv_user_memory(nv_gem);
-+    struct drm_gem_object *gem = &nv_gem->base;
- 
--    return drm_prime_pages_to_sg(nv_user_memory->pages,
--                                 nv_user_memory->pages_count);
-+    return nv_drm_prime_pages_to_sg(gem->dev,
-+                                    nv_user_memory->pages,
-+                                    nv_user_memory->pages_count);
- }
- 
- static void *__nv_drm_gem_user_memory_prime_vmap(
-diff --color -ur NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-helper.h NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm-helper.h
---- NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/nvidia-drm/nvidia-drm-helper.h	2020-05-14 14:29:24.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm-helper.h	2020-12-22 13:18:10.323531096 +0100
-@@ -55,6 +55,21 @@
- #endif
- }
- 
-+#if defined(NV_DRM_DRM_PRIME_H_PRESENT)
-+#include <drm/drm_prime.h>
-+#endif
-+ 
-+static inline struct sg_table*
-+nv_drm_prime_pages_to_sg(struct drm_device *dev,
-+                         struct page **pages, unsigned int nr_pages)
-+{
-+#if defined(NV_DRM_PRIME_PAGES_TO_SG_HAS_DRM_DEVICE_ARG)
-+    return drm_prime_pages_to_sg(dev, pages, nr_pages);
-+#else
-+    return drm_prime_pages_to_sg(pages, nr_pages);
-+#endif
-+}
-+
- #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
- 
- /*
-diff --color -ur NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/nvidia-drm/nvidia-drm.Kbuild NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm.Kbuild
---- NVIDIA-Linux-x86_64-390.138-no-compat32.orig/kernel/nvidia-drm/nvidia-drm.Kbuild	2020-05-14 11:37:09.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm.Kbuild	2020-12-22 13:32:37.631385816 +0100
-@@ -92,3 +92,4 @@
- NV_CONFTEST_TYPE_COMPILE_TESTS += drm_gem_prime_export_has_dev_arg
- NV_CONFTEST_TYPE_COMPILE_TESTS += vm_fault_t
- NV_CONFTEST_TYPE_COMPILE_TESTS += drm_gem_object_has_resv
-+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_prime_pages_to_sg_has_drm_device_arg
diff --git a/kernel-5.8-uvm.patch b/kernel-5.8-uvm.patch
deleted file mode 100644
index f76ea51..0000000
--- a/kernel-5.8-uvm.patch
+++ /dev/null
@@ -1,621 +0,0 @@
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8.c~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8.c	2020-08-16 21:17:54.577960591 +0200
-@@ -298,7 +298,11 @@
-     }
- 
-     // At this point we are guaranteed that the mmap_sem is held in write mode.
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_lock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+    uvm_record_lock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- 
-     // Split vmas should always fall entirely within the old one, and be on one
-     // side.
-@@ -347,7 +351,11 @@
- 
- out:
-     uvm_va_space_up_write(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_unlock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+    uvm_record_unlock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- }
- 
- static void uvm_vm_close_managed(struct vm_area_struct *vma)
-@@ -357,7 +365,11 @@
-     bool is_uvm_teardown = false;
- 
-     if (current->mm != NULL)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_record_lock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+        uvm_record_lock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- 
-     if (current->mm == NULL) {
-         // current->mm will be NULL on process teardown. In that case, we want
-@@ -387,7 +399,11 @@
-     uvm_va_space_up_write(va_space);
- 
-     if (current->mm != NULL)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_record_unlock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+        uvm_record_unlock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- }
- 
- static vm_fault_t uvm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
-@@ -415,7 +431,11 @@
-     // The mmap_sem might be held in write mode, but the mode doesn't matter for
-     // the purpose of lock ordering and we don't rely on it being in write
-     // anywhere so just record it as read mode in all cases.
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_lock_mmap_sem_read(&vma->vm_mm->mmap_sem);
-+#else
-+    uvm_record_lock_mmap_sem_read(&vma->vm_mm->mmap_lock);
-+#endif
- 
-     do {
-         bool do_sleep = false;
-@@ -475,7 +495,11 @@
-         uvm_gpu_retain_mask(&service_context->cpu.fault_gpus_to_check_for_ecc);
- 
-     uvm_va_space_up_read(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_unlock_mmap_sem_read(&vma->vm_mm->mmap_sem);
-+#else
-+    uvm_record_unlock_mmap_sem_read(&vma->vm_mm->mmap_lock);
-+#endif
- 
-     if (status == NV_OK) {
-         uvm_gpu_t *gpu;
-@@ -540,7 +564,11 @@
-     bool is_fork = (vma->vm_mm != origin_vma->vm_mm);
-     NV_STATUS status;
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_lock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+    uvm_record_lock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- 
-     uvm_va_space_down_write(va_space);
- 
-@@ -578,7 +606,11 @@
- 
-     uvm_va_space_up_write(va_space);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_unlock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+    uvm_record_unlock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- }
- 
- // vm operations on semaphore pool allocations only control CPU mappings. Unmapping GPUs,
-@@ -588,7 +620,11 @@
-     uvm_va_space_t *va_space = uvm_va_space_get(vma->vm_file);
- 
-     if (current->mm != NULL)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_record_lock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+        uvm_record_lock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- 
-     uvm_va_space_down_read(va_space);
- 
-@@ -597,7 +633,11 @@
-     uvm_va_space_up_read(va_space);
- 
-     if (current->mm != NULL)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_record_unlock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+        uvm_record_unlock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- }
- 
- static struct vm_operations_struct uvm_vm_ops_semaphore_pool =
-@@ -623,7 +663,11 @@
-     if (status != NV_OK)
-         return -nv_status_to_errno(status);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_lock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+    uvm_record_lock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- 
-     // UVM mappings are required to set offset == VA. This simplifies things
-     // since we don't have to worry about address aliasing (except for fork,
-@@ -709,7 +753,11 @@
-     if (ret != 0 && vma_wrapper_allocated)
-         uvm_vma_wrapper_destroy(vma->vm_private_data);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_record_unlock_mmap_sem_write(&current->mm->mmap_sem);
-+#else
-+    uvm_record_unlock_mmap_sem_write(&current->mm->mmap_lock);
-+#endif
- 
-     return ret;
- }
-@@ -849,7 +897,11 @@
-     if ((params->flags & ~UVM_INIT_FLAGS_MASK))
-         return NV_ERR_INVALID_ARGUMENT;
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_write_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_write_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_write(va_space);
- 
-     if (va_space->initialized) {
-@@ -868,7 +920,11 @@
-     }
- 
-     uvm_va_space_up_write(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_write_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_write_mmap_sem(&current->mm->mmap_lock);
-+#endif
- 
-     return status;
- }
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_gpu_replayable_faults.c~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_gpu_replayable_faults.c	2020-08-16 21:19:01.838196966 +0200
-@@ -1423,7 +1423,11 @@
-     // TODO: Bug 1896767: See the comments on unsafe_mm in uvm8_va_space.h.
-     //       We can only get here when loaded in ATS mode (uvm8_ats_mode=1).
-     if (va_space->unsafe_mm)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_down_read_mmap_sem(&va_space->unsafe_mm->mmap_sem);
-+#else
-+        uvm_down_read_mmap_sem(&va_space->unsafe_mm->mmap_lock);
-+#endif
- #endif
- }
- 
-@@ -1433,7 +1437,11 @@
-     // TODO: Bug 1896767: See the comments on unsafe_mm in uvm8_va_space.h.
-     //       We can only get here when loaded in ATS mode (uvm8_ats_mode=1).
-     if (va_space->unsafe_mm)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_up_read_mmap_sem(&va_space->unsafe_mm->mmap_sem);
-+#else
-+        uvm_up_read_mmap_sem(&va_space->unsafe_mm->mmap_lock);
-+#endif
- #endif
- }
- 
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_hmm.c~	2020-05-14 14:29:24.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_hmm.c	2020-08-16 21:19:29.444957178 +0200
-@@ -113,7 +113,11 @@
-     if (!uvm_hmm_is_enabled())
-         return NV_OK;
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_assert_mmap_sem_locked_write(&current->mm->mmap_sem);
-+#else
-+    uvm_assert_mmap_sem_locked_write(&current->mm->mmap_lock);
-+#endif
-     uvm_assert_rwsem_locked_write(&va_space->lock);
- 
-     UVM_ASSERT_MSG(!(va_space->initialization_flags & UVM_INIT_FLAGS_DISABLE_HMM),
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_mem.c~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_mem.c	2020-08-16 21:21:03.818596808 +0200
-@@ -479,7 +479,11 @@
- 
-     UVM_ASSERT(uvm_mem_is_sysmem(mem));
-     UVM_ASSERT(mem->is_user_allocation);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_sem);
-+#else
-+    uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_lock);
-+#endif
- 
-     // TODO: Bug 1995015: high-order page allocations need to be allocated as
-     // compound pages in order to be able to use vm_insert_page on them. This
-@@ -503,7 +507,11 @@
-     size_t num_chunk_pages = mem->chunk_size / PAGE_SIZE;
- 
-     UVM_ASSERT(mem->is_user_allocation);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_sem);
-+#else
-+    uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_lock);
-+#endif
-     UVM_ASSERT(!uvm_mem_is_sysmem(mem));
-     UVM_ASSERT(mem->backing_gpu != NULL);
-     UVM_ASSERT(mem->backing_gpu->numa_info.enabled);
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_migrate.c~	2020-05-14 14:29:24.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_migrate.c	2020-08-16 21:22:42.825565347 +0200
-@@ -353,7 +353,11 @@
-     bool do_mappings;
-     bool do_two_passes;
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_assert_mmap_sem_locked(&current->mm->mmap_sem);
-+#else
-+    uvm_assert_mmap_sem_locked(&current->mm->mmap_lock);
-+#endif
-     uvm_assert_rwsem_locked(&va_space->lock);
- 
-     if (!first_va_range || first_va_range->type != UVM_VA_RANGE_TYPE_MANAGED)
-@@ -559,7 +563,11 @@
-     }
- 
-     // mmap_sem will be needed if we have to create CPU mappings
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_read(va_space);
- 
-     if (!(params->flags & UVM_MIGRATE_FLAG_ASYNC)) {
-@@ -620,7 +628,11 @@
-     //       benchmarks to see if a two-pass approach would be faster (first
-     //       pass pushes all GPU work asynchronously, second pass updates CPU
-     //       mappings synchronously).
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem_out_of_order(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem_out_of_order(&current->mm->mmap_lock);
-+#endif
- 
-     if (tracker_ptr) {
-         if (params->semaphoreAddress && status == NV_OK) {
-@@ -666,7 +678,11 @@
-     uvm_gpu_t *gpu = NULL;
- 
-     // mmap_sem will be needed if we have to create CPU mappings
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_read(va_space);
- 
-     if (uvm_uuid_is_cpu(&params->destinationUuid)) {
-@@ -711,7 +727,11 @@
-     //       benchmarks to see if a two-pass approach would be faster (first
-     //       pass pushes all GPU work asynchronously, second pass updates CPU
-     //       mappings synchronously).
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem_out_of_order(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem_out_of_order(&current->mm->mmap_lock);
-+#endif
- 
-     tracker_status = uvm_tracker_wait_deinit(&local_tracker);
-     uvm_va_space_up_read(va_space);
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_policy.c~	2020-05-14 14:29:24.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_policy.c	2020-08-16 21:24:00.905791643 +0200
-@@ -279,7 +279,11 @@
-     // We need mmap_sem if we might create CPU mappings
-     if (uvm_uuid_is_cpu(processor_uuid)) {
-         processor_id = UVM_CPU_ID;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+        uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     }
- 
-     uvm_va_space_down_write(va_space);
-@@ -335,7 +339,11 @@
-     uvm_va_space_up_write(va_space);
- 
-     if (processor_id == UVM_CPU_ID)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+        uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
- 
-     return status;
- }
-@@ -525,7 +533,11 @@
-         return NV_ERR_INVALID_ADDRESS;
- 
-     // We need mmap_sem as we may create CPU mappings
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_write(va_space);
- 
-     status = uvm_va_space_split_span_as_needed(va_space,
-@@ -568,7 +580,11 @@
- 
- done:
-     uvm_va_space_up_write(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     return status;
- }
- 
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_tools.c~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_tools.c	2020-08-16 21:24:49.602594914 +0200
-@@ -253,9 +253,17 @@
-         goto fail;
-     }
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     down_read(&current->mm->mmap_sem);
-+#else
-+    mmap_read_lock(current->mm);
-+#endif
-     ret = NV_GET_USER_PAGES(user_va, num_pages, 1, 0, *pages, vmas);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     up_read(&current->mm->mmap_sem);
-+#else
-+    mmap_read_unlock(current->mm);
-+#endif
-     if (ret != num_pages) {
-         status = NV_ERR_INVALID_ARGUMENT;
-         goto fail;
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_block.c~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_block.c	2020-08-16 21:26:29.646199465 +0200
-@@ -6227,7 +6227,11 @@
-     // vma->vm_mm for us, so we can safely operate on the vma, but we can't use
-     // uvm_va_range_vma_current.
-     vma = uvm_va_range_vma(va_range);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_sem);
-+#else
-+    uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_lock);
-+#endif
- 
-     // Add the mapping
-     addr = uvm_va_block_cpu_page_address(block, page_index);
-@@ -10031,7 +10035,11 @@
- 
-     // mmap_sem isn't needed for invalidating CPU mappings, but it will be
-     // needed for inserting them.
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_read(va_space);
- 
-     if (uvm_uuid_is_cpu(&params->uuid)) {
-@@ -10114,7 +10122,11 @@
- 
- out:
-     uvm_va_space_up_read(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
- 
-     uvm_va_block_context_free(block_context);
- 
-@@ -10129,7 +10141,11 @@
- 
-     BUILD_BUG_ON(UVM_TEST_VA_BLOCK_SIZE != UVM_VA_BLOCK_SIZE);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_read(va_space);
- 
-     status = uvm_va_block_find(va_space, params->lookup_address, &va_block);
-@@ -10147,7 +10163,11 @@
- 
- out:
-     uvm_va_space_up_read(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     return status;
- }
- 
-@@ -10163,7 +10183,11 @@
-     unsigned release_block_count = 0;
-     NvU64 addr = UVM_ALIGN_DOWN(params->lookup_address, PAGE_SIZE);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_read(va_space);
- 
-     status = uvm_va_block_find(va_space, addr, &block);
-@@ -10286,7 +10310,11 @@
-             uvm_va_block_release(block);
-     }
-     uvm_va_space_up_read(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     return status;
- }
- 
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_range.c~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_range.c	2020-08-16 21:27:24.013008865 +0200
-@@ -1725,7 +1725,11 @@
- 
-     va_space = uvm_va_space_get(filp);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_read(va_space);
- 
-     va_range = uvm_va_range_find(va_space, params->lookup_address);
-@@ -1786,7 +1790,11 @@
- 
- out:
-     uvm_va_space_up_read(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     return status;
- }
- 
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_range.h~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_range.h	2020-08-16 21:27:50.646411059 +0200
-@@ -661,7 +661,11 @@
-     if (current->mm != vma->vm_mm)
-         return NULL;
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_sem);
-+#else
-+    uvm_assert_mmap_sem_locked(&vma->vm_mm->mmap_lock);
-+#endif
-     return vma;
- }
- 
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_space.c~	2020-05-14 14:29:23.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm8_va_space.c	2020-08-16 21:29:20.783306131 +0200
-@@ -63,7 +63,11 @@
-         // TODO: Bug 1896767: Add a callback here. See the comments on unsafe_mm
-         //       in uvm8_va_space.h.
-         UVM_ASSERT(current->mm == va_space->unsafe_mm);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-         uvm_assert_mmap_sem_locked_write(&current->mm->mmap_sem);
-+#else
-+        uvm_assert_mmap_sem_locked_write(&current->mm->mmap_lock);
-+#endif
- 
-         npu_context = pnv_npu2_init_context(gpu_va_space->gpu->pci_dev, (MSR_DR | MSR_PR | MSR_HV), NULL, NULL);
-         if (IS_ERR(npu_context)) {
-@@ -635,7 +639,11 @@
- 
-     // The mmap_sem lock is needed to establish CPU mappings to any pages
-     // evicted from the GPU if accessed by CPU is set for them.
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
- 
-     uvm_va_space_down_write(va_space);
- 
-@@ -650,7 +658,11 @@
-     uvm_processor_mask_clear(&va_space->gpu_register_in_progress, gpu->id);
- 
-     uvm_va_space_up_write(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
- 
-     // Drop the count we took above
-     uvm_gpu_release(gpu);
-@@ -1053,7 +1065,11 @@
-         return status;
-     }
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_write_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_write_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_write(va_space);
- 
-     if (!uvm_processor_mask_test(&va_space->registered_gpus, gpu->id)) {
-@@ -1092,7 +1108,11 @@
-     }
- 
-     uvm_va_space_up_write(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_write_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_write_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_gpu_release(gpu);
-     return NV_OK;
- 
-@@ -1108,7 +1128,11 @@
-     }
- 
-     uvm_va_space_up_write(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_write_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_write_mmap_sem(&current->mm->mmap_lock);
-+#endif
- 
-     destroy_gpu_va_space(gpu_va_space);
-     uvm_gpu_release(gpu);
-@@ -1180,7 +1204,11 @@
-     uvm_gpu_retain(gpu);
-     uvm_va_space_up_read_rm(va_space);
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_down_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_down_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_va_space_down_write(va_space);
- 
-     // We dropped the lock so we have to re-verify that this gpu_va_space is
-@@ -1199,7 +1227,11 @@
- 
- done:
-     uvm_va_space_up_write(va_space);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     uvm_up_read_mmap_sem(&current->mm->mmap_sem);
-+#else
-+    uvm_up_read_mmap_sem(&current->mm->mmap_lock);
-+#endif
-     uvm_deferred_free_object_list(&deferred_free_list);
-     uvm_gpu_va_space_release(gpu_va_space);
-     uvm_gpu_release(gpu);
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/nvidia-uvm.Kbuild~	2020-05-14 12:29:28.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/nvidia-uvm.Kbuild	2020-08-19 10:25:21.041741168 +0200
-@@ -8,10 +8,15 @@
- MIN_PATCHLEVEL := 6
- MIN_SUBLEVEL   := 32
- 
-+MAX_VERSION    := 5
-+MAX_PATCHLEVEL := 8
-+MAX_SUBLEVEL   := 0
-+
- KERNEL_VERSION_NUMERIC := $(shell echo $$(( $(VERSION) * 65536 + $(PATCHLEVEL) * 256 + $(SUBLEVEL) )))
- MIN_VERSION_NUMERIC    := $(shell echo $$(( $(MIN_VERSION) * 65536 + $(MIN_PATCHLEVEL) * 256 + $(MIN_SUBLEVEL) )))
-+MAX_VERSION_NUMERIC    := $(shell echo $$(( $(MAX_VERSION) * 65536 + $(MAX_PATCHLEVEL) * 256 + $(MAX_SUBLEVEL) )))
- 
--KERNEL_NEW_ENOUGH_FOR_UVM := $(shell [ $(KERNEL_VERSION_NUMERIC) -ge $(MIN_VERSION_NUMERIC) ] && echo 1)
-+KERNEL_NEW_ENOUGH_FOR_UVM := $(shell [ $(KERNEL_VERSION_NUMERIC) -ge $(MIN_VERSION_NUMERIC) -a $(KERNEL_VERSION_NUMERIC) -lt $(MAX_VERSION_NUMERIC) ] && echo 1)
- 
- #
- # Define NVIDIA_UVM_{SOURCES,OBJECTS}
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm_unsupported.c~	2020-05-14 14:29:22.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-uvm/uvm_unsupported.c	2020-08-19 10:30:13.371736488 +0200
-@@ -42,6 +42,7 @@
- #include "conftest.h"
- 
- #include <linux/module.h>
-+#include <linux/sched.h>
- #include <asm/uaccess.h>
- #include <linux/cdev.h>
- #include <linux/fs.h>
diff --git a/kernel-5.8.patch b/kernel-5.8.patch
deleted file mode 100644
index f1a414e..0000000
--- a/kernel-5.8.patch
+++ /dev/null
@@ -1,89 +0,0 @@
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/common/inc/nv-linux.h~	2020-05-14 14:29:21.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/common/inc/nv-linux.h	2020-08-16 21:04:10.709809366 +0200
-@@ -531,7 +531,11 @@
- 
- static inline void *nv_vmalloc(unsigned long size)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     void *ptr = __vmalloc(size, GFP_KERNEL, PAGE_KERNEL);
-+#else
-+    void *ptr = __vmalloc(size, GFP_KERNEL);
-+#endif
-     if (ptr)
-         NV_MEMDBG_ADD(ptr, size);
-     return ptr;
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia/os-mlock.c~	2020-05-14 14:29:21.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia/os-mlock.c	2020-08-16 21:07:49.051608021 +0200
-@@ -44,7 +44,11 @@
-         return rmStatus;
-     }
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     down_read(&mm->mmap_sem);
-+#else
-+    mmap_read_lock(mm);
-+#endif
- 
-     vma = find_vma(mm, (NvUPtr)address);
-     if ((vma == NULL) || ((vma->vm_flags & (VM_IO | VM_PFNMAP)) == 0))
-@@ -77,7 +81,11 @@
-     }
- 
- done:
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     up_read(&mm->mmap_sem);
-+#else
-+    mmap_read_unlock(mm);
-+#endif
- 
-     return rmStatus;
- #else
-@@ -115,10 +123,18 @@
-         return rmStatus;
-     }
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     down_read(&mm->mmap_sem);
-+#else
-+    mmap_read_lock(mm);
-+#endif
-     ret = NV_GET_USER_PAGES((unsigned long)address,
-                             page_count, write, force, user_pages, NULL);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     up_read(&mm->mmap_sem);
-+#else
-+    mmap_read_unlock(mm);
-+#endif
-     pinned = ret;
- 
-     if (ret < 0)
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm-linux.c~	2020-05-14 14:29:25.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia-drm/nvidia-drm-linux.c	2020-08-16 21:10:16.179212969 +0200
-@@ -32,6 +32,7 @@
- #if defined(NV_DRM_AVAILABLE)
- 
- #include <linux/vmalloc.h>
-+#include <linux/version.h>
- 
- #if defined(NV_DRM_DRMP_H_PRESENT)
- #include <drm/drmP.h>
-@@ -103,11 +103,19 @@
-         return -ENOMEM;
-     }
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     down_read(&mm->mmap_sem);
-+#else
-+    mmap_read_lock(mm);
-+#endif
- 
-     pages_pinned = NV_GET_USER_PAGES(address, pages_count, write, force,
-                                      user_pages, NULL);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
-     up_read(&mm->mmap_sem);
-+#else
-+    mmap_read_unlock(mm);
-+#endif
- 
-     if (pages_pinned < 0 || (unsigned)pages_pinned < pages_count) {
-         goto failed;
diff --git a/kernel-5.9-uvm.patch b/kernel-5.9-uvm.patch
deleted file mode 100644
index 4bdea19..0000000
--- a/kernel-5.9-uvm.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff --git a/kernel/nvidia-uvm/uvm8_tools.c b/kernel/nvidia-uvm/uvm8_tools.c
-index 86dbb77..63d0b64 100644
---- a/kernel/nvidia-uvm/uvm8_tools.c
-+++ b/kernel/nvidia-uvm/uvm8_tools.c
-@@ -190,7 +190,6 @@ static uvm_tools_event_tracker_t *tools_event_tracker(struct file *filp)
- {
-     long event_tracker = atomic_long_read((atomic_long_t *)&filp->private_data);
- 
--    smp_read_barrier_depends();
-     return (uvm_tools_event_tracker_t *)event_tracker;
- }
- 
-diff --git a/kernel/nvidia-uvm/uvm8_va_range.h b/kernel/nvidia-uvm/uvm8_va_range.h
-index 8cae357..6166cc8 100644
---- a/kernel/nvidia-uvm/uvm8_va_range.h
-+++ b/kernel/nvidia-uvm/uvm8_va_range.h
-@@ -717,7 +717,6 @@ static uvm_va_block_t *uvm_va_range_block(uvm_va_range_t *va_range, size_t index
-     // make sure that any initialization of this block by the creating thread is
-     // visible to later accesses in this thread, which requires a data
-     // dependency barrier.
--    smp_read_barrier_depends();
-     return block;
- }
- 
diff --git a/kernel-5.9.patch b/kernel-5.9.patch
deleted file mode 100644
index a9cb20e..0000000
--- a/kernel-5.9.patch
+++ /dev/null
@@ -1,354 +0,0 @@
-diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
-index ab06dbc..dd335b5 100644
---- a/kernel/common/inc/nv-linux.h
-+++ b/kernel/common/inc/nv-linux.h
-@@ -159,7 +159,7 @@ static inline uid_t __kuid_val(kuid_t uid)
- }
- #endif
- 
--#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL)
-+#if defined(NVCPU_X86_64) && !defined(NV_FILE_OPERATIONS_HAS_COMPAT_IOCTL)
- #include <linux/syscalls.h>         /* sys_ioctl()                      */
- #include <linux/ioctl32.h>          /* register_ioctl32_conversion()    */
- #endif
-diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
-index d2d7657..a5325fe 100644
---- a/kernel/common/inc/nv-mm.h
-+++ b/kernel/common/inc/nv-mm.h
-@@ -144,9 +144,13 @@ typedef int vm_fault_t;
-                 flags |= FOLL_FORCE;
- 
-         #if defined(NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG)
--
-+            #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
- 
-@@ -159,7 +163,7 @@ typedef int vm_fault_t;
-     #endif
- #else
-     #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
--        #define NV_GET_USER_PAGES_REMOTE    NV_GET_USER_PAGES
-+        #define NV_GET_USER_PAGES_REMOTE    get_user_pages
-     #else
-         #include <linux/mm.h>
-         #include <linux/sched.h>
-diff --git a/kernel/conftest.sh b/kernel/conftest.sh
-index e900963..ef82dee 100755
---- a/kernel/conftest.sh
-+++ b/kernel/conftest.sh
-@@ -3043,6 +3043,7 @@ compile_test() {
- 
-             if [ -f conftest$$.o ]; then
-                 echo "#undef NV_GET_USER_PAGES_REMOTE_PRESENT" | append_conftest "functions"
-+                echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions"
-                 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
-@@ -3070,14 +3071,20 @@ compile_test() {
-             rm -f conftest$$.c
- 
-             if [ -f conftest$$.o ]; then
-+                echo "#define NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions"
-                 echo "#define 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
-                 return
-             fi
- 
-+            echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions"
-+
-+            #
-             # conftest #3: check if get_user_pages_remote() has locked argument
--            
-+            # Return if these arguments are present. Fall through to conftest #4
-+            # if these args are absent.
-+            #
-             echo "$CONFTEST_PREAMBLE
-             #include <linux/mm.h>
-             long get_user_pages_remote(struct task_struct *tsk,
-@@ -3095,13 +3102,40 @@ compile_test() {
-             rm -f conftest$$.c
- 
-             if [ -f conftest$$.o ]; then
-+                echo "#define NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions"
-+                echo "#define NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" | append_conftest "functions"
-+                rm -f conftest$$.o
-+                return
-+            fi
-+
-+            #
-+            # conftest #4: check if get_user_pages_remote() does not take
-+            # tsk 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,
-+                                       struct vm_area_struct **vmas,
-+                                       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 "#undef NV_GET_USER_PAGES_REMOTE_HAS_TSK_ARG" | append_conftest "functions"
-                 echo "#define NV_GET_USER_PAGES_REMOTE_HAS_LOCKED_ARG" | append_conftest "functions"
-                 rm -f conftest$$.o
-             else
-+
-+                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
--            echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions"
--
-         ;;
- 
-         usleep_range)
-@@ -4131,6 +4165,115 @@ compile_test() {
-             compile_check_conftest "$CODE" "NV_PCI_DEV_HAS_SKIP_BUS_PM" "" "types"
-         ;;
- 
-+        drm_gem_object_put_unlocked)
-+            #
-+            # Determine if the function drm_gem_object_put_unlocked() is present.
-+            #
-+            # In v5.9-rc1, commit 2f4dd13d4bb8 ("drm/gem: add
-+            # drm_gem_object_put helper") removes drm_gem_object_put_unlocked()
-+            # function and replace its definition by transient macro. Commit
-+            # ab15d56e27be ("drm: remove transient
-+            # drm_gem_object_put_unlocked()") finally removes
-+            # drm_gem_object_put_unlocked() macro.
-+            #
-+            CODE="
-+            #if defined(NV_DRM_DRMP_H_PRESENT)
-+            #include <drm/drmP.h>
-+            #endif
-+
-+            #if defined(NV_DRM_DRM_GEM_H_PRESENT)
-+            #include <drm/drm_gem.h>
-+            #endif
-+            void conftest_drm_gem_object_put_unlocked(void) {
-+                drm_gem_object_put_unlocked();
-+            }"
-+
-+            compile_check_conftest "$CODE" "NV_DRM_GEM_OBJECT_PUT_UNLOCK_PRESENT" "" "functions"
-+        ;;
-+
-+        drm_display_mode_has_vrefresh)
-+            #
-+            # Determine if the 'drm_display_mode' structure has a 'vrefresh'
-+            # field.
-+            #
-+            # Removed by commit 0425662fdf05 ("drm: Nuke mode->vrefresh") in
-+            # v5.9-rc1.
-+            #
-+            CODE="
-+            #include <drm/drm_modes.h>
-+
-+            int conftest_drm_display_mode_has_vrefresh(void) {
-+                return offsetof(struct drm_display_mode, vrefresh);
-+            }"
-+
-+            compile_check_conftest "$CODE" "NV_DRM_DISPLAY_MODE_HAS_VREFRESH" "types"
-+
-+        ;;
-+
-+        drm_driver_master_set_has_int_return_type)
-+            #
-+            # Determine if drm_driver::master_set() returns integer value
-+            #
-+            # Changed to void by commit 907f53200f98 ("drm: vmwgfx: remove
-+            # drm_driver::master_set() return type") in v5.9-rc1.
-+            #
-+            CODE="
-+            #if defined(NV_DRM_DRMP_H_PRESENT)
-+            #include <drm/drmP.h>
-+            #endif
-+
-+            #if defined(NV_DRM_DRM_DRV_H_PRESENT)
-+            #include <drm/drm_drv.h>
-+            #endif
-+
-+            int conftest_drm_driver_master_set_has_int_return_type(struct drm_driver *drv,
-+                struct drm_device *dev, struct drm_file *file_priv, bool from_open) {
-+
-+                return drv->master_set(dev, file_priv, from_open);
-+            }"
-+
-+            compile_check_conftest "$CODE" "NV_DRM_DRIVER_SET_MASTER_HAS_INT_RETURN_TYPE" "" "types"
-+        ;;
-+
-+        drm_driver_has_gem_free_object)
-+            #
-+            # Determine if the 'drm_driver' structure has a 'gem_free_object'
-+            # function pointer.
-+            #
-+            # drm_driver::gem_free_object is removed by commit 1a9458aeb8eb
-+            # ("drm: remove drm_driver::gem_free_object") in v5.9-rc1.
-+            #
-+            CODE="
-+            #if defined(NV_DRM_DRMP_H_PRESENT)
-+            #include <drm/drmP.h>
-+            #endif
-+
-+            #if defined(NV_DRM_DRM_DRV_H_PRESENT)
-+            #include <drm/drm_drv.h>
-+            #endif
-+
-+            int conftest_drm_driver_has_gem_free_object(void) {
-+                return offsetof(struct drm_driver, gem_free_object);
-+            }"
-+
-+            compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_GEM_FREE_OBJECT" "" "types"
-+        ;;
-+
-+        vga_tryget)
-+            #
-+            # Determine if vga_tryget() is present
-+            #
-+            # vga_tryget() was removed by commit f369bc3f9096 ("vgaarb: mark
-+            # vga_tryget static") in v5.9-rc1 (2020-08-01).
-+            #
-+            CODE="
-+            #include <linux/vgaarb.h>
-+            void conftest_vga_tryget(void) {
-+                vga_tryget();
-+            }"
-+
-+            compile_check_conftest "$CODE" "NV_VGA_TRYGET_PRESENT" "" "functions"
-+        ;;
-     esac
- }
- 
-diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
-index 17e377d..1b4cc6d 100644
---- a/kernel/nvidia-drm/nvidia-drm-drv.c
-+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
-@@ -466,8 +466,8 @@ static void nv_drm_unload(struct drm_device *dev)
- 
- #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
- 
--static int nv_drm_master_set(struct drm_device *dev,
--                             struct drm_file *file_priv, bool from_open)
-+static int __nv_drm_master_set(struct drm_device *dev,
-+                               struct drm_file *file_priv, bool from_open)
- {
-     struct nv_drm_device *nv_dev = to_nv_device(dev);
- 
-@@ -478,6 +478,21 @@ static int nv_drm_master_set(struct drm_device *dev,
-     return 0;
- }
- 
-+#if defined(NV_DRM_DRIVER_SET_MASTER_HAS_INT_RETURN_TYPE)
-+static int nv_drm_master_set(struct drm_device *dev,
-+                             struct drm_file *file_priv, bool from_open)
-+{
-+    return __nv_drm_master_set(dev, file_priv, from_open);
-+}
-+#else
-+static void nv_drm_master_set(struct drm_device *dev,
-+                              struct drm_file *file_priv, bool from_open)
-+{
-+     WARN_ON(__nv_drm_master_set(dev, file_priv, from_open) != 0);
-+}
-+#endif
-+
-+
- #if defined(NV_DRM_MASTER_DROP_HAS_FROM_RELEASE_ARG)
- static
- void nv_drm_master_drop(struct drm_device *dev,
-@@ -677,7 +692,9 @@ static struct drm_driver nv_drm_driver = {
- #endif
-                                DRIVER_GEM  | DRIVER_RENDER,
- 
-+#if defined(NV_DRM_DRIVER_HAS_GEM_FREE_OBJECT)
-     .gem_free_object        = nv_drm_gem_free,
-+#endif
- 
-     .ioctls                 = nv_drm_ioctls,
-     .num_ioctls             = ARRAY_SIZE(nv_drm_ioctls),
-diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h
-index 5691a7a..18c50ca 100644
---- a/kernel/nvidia-drm/nvidia-drm-gem.h
-+++ b/kernel/nvidia-drm/nvidia-drm-gem.h
-@@ -87,7 +87,13 @@ static inline void
- nv_drm_gem_object_unreference_unlocked(struct nv_drm_gem_object *nv_gem)
- {
- #if defined(NV_DRM_GEM_OBJECT_GET_PRESENT)
-+
-+#if defined(NV_DRM_GEM_OBJECT_PUT_UNLOCK_PRESENT)
-     drm_gem_object_put_unlocked(&nv_gem->base);
-+#else
-+    drm_gem_object_put(&nv_gem->base);
-+#endif
-+
- #else
-     drm_gem_object_unreference_unlocked(&nv_gem->base);
- #endif
-diff --git a/kernel/nvidia-drm/nvidia-drm-utils.c b/kernel/nvidia-drm/nvidia-drm-utils.c
-index 8cb2d5e..e30b2b6 100644
---- a/kernel/nvidia-drm/nvidia-drm-utils.c
-+++ b/kernel/nvidia-drm/nvidia-drm-utils.c
-@@ -103,7 +103,9 @@ void
- nvkms_display_mode_to_drm_mode(const struct NvKmsKapiDisplayMode *displayMode,
-                                struct drm_display_mode *mode)
- {
-+#if defined(NV_DRM_DISPLAY_MODE_HAS_VREFRESH)
-     mode->vrefresh    = (displayMode->timings.refreshRate + 500) / 1000; /* In Hz */
-+#endif
- 
-     mode->clock       = (displayMode->timings.pixelClockHz + 500) / 1000; /* In Hz */
- 
-@@ -189,7 +191,11 @@ bool drm_format_to_nvkms_format(u32 format,
- void drm_mode_to_nvkms_display_mode(const struct drm_display_mode *src,
-                                     struct NvKmsKapiDisplayMode *dst)
- {
-+#if defined(NV_DRM_DISPLAY_MODE_HAS_VREFRESH)
-     dst->timings.refreshRate  = src->vrefresh * 1000;
-+#else
-+    dst->timings.refreshRate  = drm_mode_vrefresh(src) * 1000;
-+#endif
- 
-     dst->timings.pixelClockHz = src->clock * 1000; /* In Hz */
- 
-diff --git a/kernel/nvidia/nv.c b/kernel/nvidia/nv.c
-index 15983f6..cfb2375 100644
---- a/kernel/nvidia/nv.c
-+++ b/kernel/nvidia/nv.c
-@@ -3872,7 +3872,9 @@ nvidia_probe
- 
- #if defined(CONFIG_VGA_ARB) && !defined(NVCPU_PPC64LE)
- #if defined(VGA_DEFAULT_DEVICE)
-+#if defined(NV_VGA_TRYGET_PRESENT)
-     vga_tryget(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK);
-+#endif
- #endif
-     vga_set_legacy_decoding(dev, VGA_RSRC_NONE);
- #endif
-
-
---- NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia/nvidia.Kbuild~	2020-05-14 12:29:28.000000000 +0200
-+++ NVIDIA-Linux-x86_64-390.138-no-compat32/kernel/nvidia/nvidia.Kbuild	2020-10-21 09:20:14.480482097 +0200
-@@ -205,4 +205,10 @@
- NV_CONFTEST_GENERIC_COMPILE_TESTS += list_cut_position
- NV_CONFTEST_GENERIC_COMPILE_TESTS += vm_fault_t
- 
-+NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_put_unlocked
-+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_display_mode_has_vrefresh
-+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_master_set_has_int_return_type
-+NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_free_object
-+NV_CONFTEST_FUNCTION_COMPILE_TESTS += vga_tryget
-+
- NV_CONFTEST_MACRO_COMPILE_TESTS += INIT_WORK
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/xorg-driver-video-nvidia-legacy-390xx.git/commitdiff/ebe2077a6881d932d844821900a8323627d078ce



More information about the pld-cvs-commit mailing list