-
-
Save joanbm/144a965c36fc1dc0d1f1b9be3438a368 to your computer and use it in GitHub Desktop.
From f18c541edc5e122b06b0c1e65d0a422f0b8109e7 Mon Sep 17 00:00:00 2001 | |
From: Joan Bruguera <[email protected]> | |
Date: Fri, 2 Jul 2021 02:09:58 +0200 | |
Subject: [PATCH] Tentative fix for NVIDIA 465.31 driver for Linux 5.14-rc1 | |
--- | |
common/inc/nv-time.h | 6 ++++++ | |
nvidia-drm/nvidia-drm-drv.c | 4 ++++ | |
2 files changed, 10 insertions(+) | |
diff --git a/common/inc/nv-time.h b/common/inc/nv-time.h | |
index dc80806..cc343a5 100644 | |
--- a/common/inc/nv-time.h | |
+++ b/common/inc/nv-time.h | |
@@ -23,6 +23,7 @@ | |
#ifndef __NV_TIME_H__ | |
#define __NV_TIME_H__ | |
+#include <linux/version.h> | |
#include "conftest.h" | |
#include <linux/sched.h> | |
#include <linux/delay.h> | |
@@ -205,7 +206,12 @@ static inline NV_STATUS nv_sleep_ms(unsigned int ms) | |
// the requested timeout has expired, loop until less | |
// than a jiffie of the desired delay remains. | |
// | |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)) | |
current->state = TASK_INTERRUPTIBLE; | |
+#else | |
+ // Rel. commit "sched: Change task_struct::state" (Peter Zijlstra, Jun 11 2021) | |
+ WRITE_ONCE(current->__state, TASK_INTERRUPTIBLE); | |
+#endif | |
do | |
{ | |
schedule_timeout(jiffies); | |
diff --git a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c | |
index 84d4479..99ea552 100644 | |
--- a/nvidia-drm/nvidia-drm-drv.c | |
+++ b/nvidia-drm/nvidia-drm-drv.c | |
@@ -20,6 +20,7 @@ | |
* DEALINGS IN THE SOFTWARE. | |
*/ | |
+#include <linux/version.h> | |
#include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */ | |
#include "nvidia-drm-priv.h" | |
@@ -903,9 +904,12 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info) | |
dev->dev_private = nv_dev; | |
nv_dev->dev = dev; | |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)) | |
+ // Rel. commit "drm: Remove pdev field from struct drm_device" (Thomas Zimmermann, 3 May 2021) | |
if (device->bus == &pci_bus_type) { | |
dev->pdev = to_pci_dev(device); | |
} | |
+#endif | |
/* Register DRM device to DRM sub-system */ | |
-- | |
2.32.0 | |
Hi @jpargudo,
Newer versions of the NVIDIA driver such as 470.63.01 already build on Linux 5.14 out-of-the-box, without the need for any patch, that's probably your best bet.
Otherwise the patch should apply cleanly over 465.31 without any need for manual fixes, e.g.
$ sh NVIDIA-Linux-x86_64-465.31.run --extract-only
[...]
$ cd NVIDIA-Linux-x86_64-465.31/kernel/
$ patch -Np1 -i ../../nvidia-fix-linux-5.14.patch
patching file common/inc/nv-time.h
patching file nvidia-drm/nvidia-drm-drv.c
$ SYSSRC=/lib/modules/5.14.0-1-mainline-git/build make -j$(nproc)
[...build OK]
Otherwise, check if the system boots without driver or with Nouveau, increase kernel printk to see if it prints anything of interest, etc.
This got my EndeavourOS system working again, thanks!
This patch worked well with the outdated Nvidia drivers that were available on the Rpmfusion repo for Fedora recently. Besides the patch, I also had to install a non-debug kernel, available from a special repo mentioned on the Rpmfusion driver page to get it to compile.
Hey there I'm a bit of a noob on linux. Can you explain how can I apply this patch?
Hey there I'm a bit of a noob on linux. Can you explain how can I apply this patch?
Hi @juricajelaca, this patch was only useful for testing Linux kernel release candidates as they came out.
There's a new version of the NVIDIA proprietary Linux drivers that already supports Linux 5.14 without any patch, this is probably what you want to install (download it from your distribution's repositories if you can):
https://us.download.nvidia.com/XFree86/Linux-x86_64/470.74/NVIDIA-Linux-x86_64-470.74.run
If you really want to install use the old version of the NVIDIA drivers with this patch, you should do it like this from a terminal:
$ sh NVIDIA-Linux-x86_64-465.31.run --extract-only
$ cd NVIDIA-Linux-x86_64-465.31/kernel/
$ patch -Np1 -i ../../nvidia-fix-linux-5.14.patch
$ cd ..
$ sudo ./nvidia-installer
Hey there I'm a bit of a noob on linux. Can you explain how can I apply this patch?
Hi @juricajelaca, this patch was only useful for testing Linux kernel release candidates as they came out.
There's a new version of the NVIDIA proprietary Linux drivers that already supports Linux 5.14 without any patch, this is probably what you want to install (download it from your distribution's repositories if you can): https://us.download.nvidia.com/XFree86/Linux-x86_64/470.74/NVIDIA-Linux-x86_64-470.74.run
If you really want to install use the old version of the NVIDIA drivers with this patch, you should do it like this from a terminal:
$ sh NVIDIA-Linux-x86_64-465.31.run --extract-only $ cd NVIDIA-Linux-x86_64-465.31/kernel/ $ patch -Np1 -i ../../nvidia-fix-linux-5.14.patch $ cd .. $ sudo ./nvidia-installer
Woah, thanks for the fast reply :). Guess I'm having some other problems then, cause my graphics won't change from Integrated to nvidia for some reason, even if I installed the latest driver.
thank you soo much! this solved my problem with the 5.14 kernel!!!!
Hi there!
Just a comment. I tried your patch, since I had to upgrade to 5.14 for my Quantum JBL Headset to work (support added by 5.14-rc3 or so). It worked well, since dkms builded and so on. But at reboot time, it hanged somewhere I can tell much where :-(
Feel free to ask for further testing..
I had to manually patch nvidia-drm-drv.c since it was not at line 903 but somewhere before at 863.. Maybe I have the wrong dkms sources?
Cheers,