You are not logged in.

#1 2020-10-17 20:49:47

ratcheer
Member
Registered: 2011-10-09
Posts: 912

[Solved] nVidia driver and kernel 5.9

nVidia is advising that their driver is not compatible with kernel 5.9. They expect to have it fixed by mid-November.

https://forums.developer.nvidia.com/t/n … 5-9/157263

Last edited by ratcheer (2020-10-31 12:59:34)

Offline

#2 2020-10-17 21:08:45

loqs
Member
Registered: 2014-03-06
Posts: 18,055

Re: [Solved] nVidia driver and kernel 5.9

Is the driver not working for you?  Are you just posting a statement rather than a request for help?

Offline

#3 2020-10-17 22:57:56

papavlos
Member
Registered: 2017-09-23
Posts: 67

Re: [Solved] nVidia driver and kernel 5.9

From nvidia forum: "Linux Kernel 5.9+ is incompatible with current and previous NVIDIA Linux GPU drivers.".
Yes, this is true. I am using one of older NVIDIA GPUs. The driver for it is in the 390xx version. After today's kernel upgrade to 5.9 my graphical environment didn't start. So I had do revert linux and linu-headers to the latest 5.8.14.

If there is any help before the mid of November, please be so kind and give us a hint.

For sure I can wait a month or so without current upgrades, as my environment is completed and I don't preview any urgent need of installing additional apps...
What's worse, 390xx drivers are in AUR and they have been abandoned...

Last edited by papavlos (2020-10-17 22:58:22)

Offline

#4 2020-10-18 01:38:02

loqs
Member
Registered: 2014-03-06
Posts: 18,055

Re: [Solved] nVidia driver and kernel 5.9

@papavlos if you want to try something for 390xx the following will allow the modules to compile:

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-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/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

Offline

#5 2020-10-18 05:07:28

darkskyabove
Member
Registered: 2014-07-15
Posts: 10

Re: [Solved] nVidia driver and kernel 5.9

Linux 5.9.1 + nvidia 455.28.7 works here except for blender. This post suggests that cuda and opencl are broken: https://www.phoronix.com/forums/forum/p … ost1213261

I tested Desktop (Openbox), YouTube video w/Vivaldi browser, Far Cry 5 w/wine 5.19: all good.

I have RTX 2060.


To emulate flesh machines, I am learning...

Offline

#6 2020-10-18 07:51:16

blispx
Member
Registered: 2017-11-29
Posts: 53

Re: [Solved] nVidia driver and kernel 5.9

KMS doesn't work either- framebuffer

nvidia is getting useless, I set it as discrete card, I only run steam on the docker on it for prime-run

Last edited by blispx (2020-10-18 07:53:03)

Offline

#7 2020-10-18 07:58:41

Gruntz
Member
From: Haskovo, Bulgaria
Registered: 2007-08-31
Posts: 291

Re: [Solved] nVidia driver and kernel 5.9

Using loqs`s patch allowed me to build the nvidia-390 package form AUR.

Thank you, loqs.

Offline

#8 2020-10-18 08:04:06

punio
Member
Registered: 2019-08-23
Posts: 26

Re: [Solved] nVidia driver and kernel 5.9

The nouveau driver seems borked as well. While the driver itself works and my DE loads up (Plasma), it is incredibly glitchy (for example, black bars across my browser window when I scroll, and quite long times switching between windows). Could there be a workaround for this driver?

Offline

#9 2020-10-18 09:53:51

xerxes_
Member
Registered: 2018-04-29
Posts: 788

Re: [Solved] nVidia driver and kernel 5.9

@punio: What GPU do you use? I have GTX750 and have no problems on 5.9.1 (as I can say for this short time), except problems with chromium 86 (as I mentioned in this thread) and some rare nouveau crashes when coping files to old phone, usb stick by doublecmd since 5.8 (mentioned in this thread).

Currently I wait for that crash on 5.9 kernel to try to report it to kernel staff (or wherever I should do this - I have never done this so far).

Offline

#10 2020-10-18 10:29:52

papavlos
Member
Registered: 2017-09-23
Posts: 67

Re: [Solved] nVidia driver and kernel 5.9

Hi @loqs and @Gruntz,

Is the path also applicable to nvidia-390xx-dkms?

----

Never mind, I have just noticed Gruntz comments in AUR with instructions for building it.
Thanks!

Last edited by papavlos (2020-10-18 10:34:02)

Offline

#11 2020-10-18 11:05:22

punio
Member
Registered: 2019-08-23
Posts: 26

Re: [Solved] nVidia driver and kernel 5.9

xerxes_ wrote:

@punio: What GPU do you use?

I use a Quadro 4000. Although I don't seem to be having any problems with the NVS 5100M on my laptop, so this must be a problem with my specific model or architecture...

Offline

#12 2020-10-18 13:08:19

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: [Solved] nVidia driver and kernel 5.9

loqs wrote:

Is the driver not working for you?  Are you just posting a statement rather than a request for help?

I have not updated my kernel, yet.

Yes, I thought people should be warned if it's important enough for nVidia to warn about it.

Offline

#13 2020-10-18 13:11:49

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: [Solved] nVidia driver and kernel 5.9

darkskyabove wrote:

Linux 5.9.1 + nvidia 455.28.7 works here except for blender. This post suggests that cuda and opencl are broken: https://www.phoronix.com/forums/forum/p … ost1213261

I tested Desktop (Openbox), YouTube video w/Vivaldi browser, Far Cry 5 w/wine 5.19: all good.

I have RTX 2060.

I also have RTX 2060. The main reason I bought this new PC was to use openCL for photo image processing. So, I suppose I need to either determine how to not upgrade the kernel, or just not do upgrades until the new driver has been released.

PS - Simple enough: IgnorePkg=linux

Last edited by ratcheer (2020-10-18 13:16:57)

Offline

#14 2020-10-18 13:47:17

papavlos
Member
Registered: 2017-09-23
Posts: 67

Re: [Solved] nVidia driver and kernel 5.9

Thanks a lot for updating nvidia-390xx* packages!!! @loqs and @Gruntz for patching and @jonathon for packaging in AUR.

One small inconvenience: First I had to update only the kernel and headers to 5.9, reboot, and then - in text-only mode - run yay -S nvidia-390xx-dkms update, final reboot. Back in graphical mode. Now I'm on 5.9 kernel. smile
Just if anyone still struggles...

Last edited by papavlos (2020-10-18 13:49:33)

Offline

#15 2020-10-18 16:44:18

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: [Solved] nVidia driver and kernel 5.9

It is card dependent. I'm running a GTX770 (Kepler) on 'nvidia 455.28-7' without problems. Even Blender works properly on CUDA (CUDA kernels might have to be compiled manually as 'compute capability 3.0' cards are abandoned in latest CUDA 11.1).


sys2064

Offline

#16 2020-10-18 18:05:04

loqs
Member
Registered: 2014-03-06
Posts: 18,055

Re: [Solved] nVidia driver and kernel 5.9

If you want nvidia-uvm and linux 5.9 either revert https://git.kernel.org/pub/scm/linux/ke … cbba2bb991 or patch the nvidia module to change the license to GPL.

Offline

#17 2020-10-18 18:14:06

Zethson
Member
Registered: 2016-05-29
Posts: 7

Re: [Solved] nVidia driver and kernel 5.9

How do I correctly downgrade the Kernel and recompile NVIDIA & CUDA correctly?

I downgraded my kernel to 5.8.5 and reinstalled nvidia, CUDA and the nvidia-cuda-toolkit, but always got broken setups.

Offline

#18 2020-10-18 18:17:04

loqs
Member
Registered: 2014-03-06
Posts: 18,055

Re: [Solved] nVidia driver and kernel 5.9

nvidia is the module for the current linux kernel,  switch to nvidia-dkms and remember to install the linux-headers for 5.8.5.

Last edited by loqs (2020-10-18 18:17:18)

Offline

#19 2020-10-18 18:18:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,249

Re: [Solved] nVidia driver and kernel 5.9

downgrade the kernel and the nvidia package to the appropriate versions used at the time, otherwise use the kernel-headers (e.g. linux-headers) package and install nvidia-dkms so that the module build happens on your system. if you don't have the kernel-headers installed see https://wiki.archlinux.org/index.php/Arch_Linux_Archive for how to get old versions.

Though the 5.8.5 seems a bit random, you could go for 5.8.14

Offline

#20 2020-10-18 18:47:12

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 125

Re: [Solved] nVidia driver and kernel 5.9

Hello, is the patch posted by @loqs applicable into 440xx sources? They won't build with 5.9+.

Offline

#21 2020-10-18 19:28:27

loqs
Member
Registered: 2014-03-06
Posts: 18,055

Re: [Solved] nVidia driver and kernel 5.9

@Al.Piotrowicz I would doubt it.  Can you not use 455 if you can use 440xx?

Offline

#22 2020-10-18 20:06:58

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 125

Re: [Solved] nVidia driver and kernel 5.9

I'm currently on the lts kernel, because the latest 455 has the familiar null pointer bug and 440xx doesn't produce the exception for me.

Offline

#23 2020-10-18 20:21:12

loqs
Member
Registered: 2014-03-06
Posts: 18,055

Re: [Solved] nVidia driver and kernel 5.9

Please try the following

diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
index aa8e500..0759be6 100644
--- a/kernel/common/inc/nv-linux.h
+++ b/kernel/common/inc/nv-linux.h
@@ -155,11 +155,6 @@ static inline uid_t __kuid_val(uid_t uid)
 }
 #endif
 
-#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL)
-#include <linux/syscalls.h>         /* sys_ioctl()                      */
-#include <linux/ioctl32.h>          /* register_ioctl32_conversion()    */
-#endif
-
 #if defined(CONFIG_VGA_ARB)
 #include <linux/vgaarb.h>
 #endif
diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
index 0174626..7da5a95 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
 
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index 7bd1147..42698cf 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -2558,6 +2558,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
@@ -2587,14 +2588,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
 
-            # conftest #3: check if get_user_pages_remote() has locked argument
+            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,
@@ -2612,13 +2619,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)
diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
index 7e75bff..6bc4570 100644
--- a/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -470,8 +470,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);
 
@@ -482,6 +482,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,
@@ -687,7 +702,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 222c385..ed4bcd3 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 eba1908..3e2a2d9 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-uvm/uvm8_tools.c b/kernel/nvidia-uvm/uvm8_tools.c
index 0415d26..2e94adb 100644
--- a/kernel/nvidia-uvm/uvm8_tools.c
+++ b/kernel/nvidia-uvm/uvm8_tools.c
@@ -192,7 +192,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 d7a8c3a..5afd189 100644
--- a/kernel/nvidia-uvm/uvm8_va_range.h
+++ b/kernel/nvidia-uvm/uvm8_va_range.h
@@ -761,7 +761,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/nvidia/nv-pci.c b/kernel/nvidia/nv-pci.c
index 462b523..8bbdea9 100644
--- a/kernel/nvidia/nv-pci.c
+++ b/kernel/nvidia/nv-pci.c
@@ -405,7 +405,9 @@ nv_pci_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(pci_dev, VGA_RSRC_NONE);
 #endif

Offline

#24 2020-10-18 21:06:47

Al.Piotrowicz
Member
Registered: 2017-08-07
Posts: 125

Re: [Solved] nVidia driver and kernel 5.9

Thanks @loqs it succeeded, BTW it failed with the lts kernel with :

/var/lib/dkms/nvidia/440.100/build/nvidia-drm/nvidia-drm-drv.c: In function ‘nv_drm_update_drm_driver_features’:
/var/lib/dkms/nvidia/440.100/build/nvidia-drm/nvidia-drm-drv.c:767:36: error: assignment to ‘int (*)(struct drm_device *, struct drm_file *, bool)’ {aka ‘int (*)(struct drm_device *, struct drm_file *, _Bool)’} from incompatible pointer type ‘void (*)(struct drm_device *, struct drm_file *, bool)’ {aka ‘void (*)(struct drm_device *, struct drm_file *, _Bool)’} [-Werror=incompatible-pointer-types]
  767 |     nv_drm_driver.master_set       = nv_drm_master_set;
      |                                    ^
  CC [M]  /var/lib/dkms/nvidia/440.100/build/nvidia-drm/nvidia-drm-encoder.o
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:266: /var/lib/dkms/nvidia/440.100/build/nvidia-drm/nvidia-drm-drv.o] Błąd 1
make[2]: *** Oczekiwanie na niezakończone zadania....
make[1]: *** [Makefile:1729: /var/lib/dkms/nvidia/440.100/build] Błąd 2
make[1]: Opuszczenie katalogu '/usr/lib/modules/5.4.72-1-lts/build'
make: *** [Makefile:81: modules] Błąd 2

Is it possible to install the DKMS sources without triggering a pacman dkms alpm hooks?

Offline

#25 2020-10-18 22:20:06

loqs
Member
Registered: 2014-03-06
Posts: 18,055

Re: [Solved] nVidia driver and kernel 5.9

Not a good idea as the next update of linux-lts will then be incompatible with the module that has not been updated.
Will try to produce a patch that works with both kernels by dropping using conftest and using version testing instead.
Edit

diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
index aa8e500..0759be6 100644
--- a/kernel/common/inc/nv-linux.h
+++ b/kernel/common/inc/nv-linux.h
@@ -155,11 +155,6 @@ static inline uid_t __kuid_val(uid_t uid)
 }
 #endif
 
-#if defined(NVCPU_X86_64) && !defined(HAVE_COMPAT_IOCTL)
-#include <linux/syscalls.h>         /* sys_ioctl()                      */
-#include <linux/ioctl32.h>          /* register_ioctl32_conversion()    */
-#endif
-
 #if defined(CONFIG_VGA_ARB)
 #include <linux/vgaarb.h>
 #endif
diff --git a/kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
index 0174626..7da5a95 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
 
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index 7bd1147..42698cf 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -2558,6 +2558,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
@@ -2587,14 +2588,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
 
-            # conftest #3: check if get_user_pages_remote() has locked argument
+            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,
@@ -2612,13 +2619,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)
diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
index 7e75bff..26b452d 100644
--- a/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -470,8 +470,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);
 
@@ -482,6 +482,22 @@ static int nv_drm_master_set(struct drm_device *dev,
     return 0;
 }
 
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
+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,
@@ -687,7 +703,9 @@ static struct drm_driver nv_drm_driver = {
 #endif
                                DRIVER_GEM  | DRIVER_RENDER,
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
     .gem_free_object        = nv_drm_gem_free,
+#endif
 
     .ioctls                 = nv_drm_ioctls,
     .num_ioctls             = ARRAY_SIZE(nv_drm_ioctls),
@@ -727,6 +745,7 @@ static struct drm_driver nv_drm_driver = {
 #else
     .device_list            = LIST_HEAD_INIT(nv_drm_driver.device_list),
 #endif
+    .gem_vm_ops             = &nv_drm_gem_vma_ops,
 };
 
 
@@ -753,8 +772,6 @@ static void nv_drm_update_drm_driver_features(void)
     nv_drm_driver.dumb_create      = nv_drm_dumb_create;
     nv_drm_driver.dumb_map_offset  = nv_drm_dumb_map_offset;
     nv_drm_driver.dumb_destroy     = drm_gem_dumb_destroy;
-
-    nv_drm_driver.gem_vm_ops       = &nv_drm_gem_vma_ops;
 #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
 }
 
diff --git a/kernel/nvidia-drm/nvidia-drm-gem.h b/kernel/nvidia-drm/nvidia-drm-gem.h
index 222c385..4a42c6c 100644
--- a/kernel/nvidia-drm/nvidia-drm-gem.h
+++ b/kernel/nvidia-drm/nvidia-drm-gem.h
@@ -87,7 +87,14 @@ static inline void
 nv_drm_gem_object_unreference_unlocked(struct nv_drm_gem_object *nv_gem)
 {
 #if defined(NV_DRM_GEM_OBJECT_GET_PRESENT)
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
     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 eba1908..003fa97 100644
--- a/kernel/nvidia-drm/nvidia-drm-utils.c
+++ b/kernel/nvidia-drm/nvidia-drm-utils.c
@@ -103,7 +103,10 @@ void
 nvkms_display_mode_to_drm_mode(const struct NvKmsKapiDisplayMode *displayMode,
                                struct drm_display_mode *mode)
 {
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
     mode->vrefresh    = (displayMode->timings.refreshRate + 500) / 1000; /* In Hz */
+#endif
 
     mode->clock       = (displayMode->timings.pixelClockHz + 500) / 1000; /* In Hz */
 
@@ -189,7 +192,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 LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
     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-uvm/uvm8_tools.c b/kernel/nvidia-uvm/uvm8_tools.c
index 0415d26..2e94adb 100644
--- a/kernel/nvidia-uvm/uvm8_tools.c
+++ b/kernel/nvidia-uvm/uvm8_tools.c
@@ -192,7 +192,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 d7a8c3a..5afd189 100644
--- a/kernel/nvidia-uvm/uvm8_va_range.h
+++ b/kernel/nvidia-uvm/uvm8_va_range.h
@@ -761,7 +761,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/nvidia/nv-pci.c b/kernel/nvidia/nv-pci.c
index 462b523..78010f0 100644
--- a/kernel/nvidia/nv-pci.c
+++ b/kernel/nvidia/nv-pci.c
@@ -405,7 +405,10 @@ nv_pci_probe
 
 #if defined(CONFIG_VGA_ARB) && !defined(NVCPU_PPC64LE)
 #if defined(VGA_DEFAULT_DEVICE)
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
     vga_tryget(VGA_DEFAULT_DEVICE, VGA_RSRC_LEGACY_MASK);
+#endif
 #endif
     vga_set_legacy_decoding(pci_dev, VGA_RSRC_NONE);
 #endif

Last edited by loqs (2020-10-18 23:07:08)

Offline

Board footer

Powered by FluxBB