Package: nvidia-legacy-390xx-kernel-dkms Version: 390.144-1 Severity: normal Tags: patch
Hi, today I've upgraded to linux-image-5.14.0-1-amd64-unsigned, and nvidia-legacy-390xx-kernel-dkms failed to build with the following error: /var/lib/dkms/nvidia-legacy-390xx/390.144/build/nvidia/os-interface.c:583:18: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’? 583 | current->state = TASK_INTERRUPTIBLE; | ^~~~~ | __state Other than the changes to struct task_struct, the other relevant news in Linux 5.14 is that the pdev field is now gone from struct drm_device (see https://gist.github.com/joanbm/144a965c36fc1dc0d1f1b9be3438a368). /var/lib/dkms/nvidia-legacy-390xx/390.144/build/nvidia-drm/nvidia-drm-drv.c:814:10: error: ‘struct drm_device’ has no member named ‘pdev’; did you mean ‘dev’? 814 | dev->pdev = pdev; | ^~~~ | dev The attached changes to /usr/src/nvidia-legacy-390xx-390.144 fix the driver with 5.14 on my workstation. Thanks, Emanuele
--- /usr/src/nvidia-legacy-390xx-390.144/nvidia/os-interface.c.orig 2021-09-21 10:03:57.965273627 +0200 +++ /usr/src/nvidia-legacy-390xx-390.144/nvidia/os-interface.c 2021-09-21 10:10:30.581119711 +0200 @@ -8,6 +8,8 @@ * _NVRM_COPYRIGHT_END_ */ +#include <linux/version.h> + #define __NO_VERSION__ #include "nv-misc.h" @@ -580,7 +582,11 @@ // 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 + WRITE_ONCE(current->__state, TASK_INTERRUPTIBLE); +#endif do { schedule_timeout(jiffies); --- /usr/src/nvidia-legacy-390xx-390.144/nvidia/nvlink_linux.c.orig 2021-09-21 10:15:06.578262557 +0200 +++ /usr/src/nvidia-legacy-390xx-390.144/nvidia/nvlink_linux.c 2021-09-21 10:14:02.386927630 +0200 @@ -21,6 +21,7 @@ *******************************************************************************/ +#include <linux/version.h> #include "conftest.h" #include "nvlink_common.h" @@ -597,7 +598,11 @@ // 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 + WRITE_ONCE(current->__state, TASK_INTERRUPTIBLE); +#endif do { schedule_timeout(jiffies); --- /usr/src/nvidia-legacy-390xx-390.144/nvidia-drm/nvidia-drm-drv.c.orig 2021-09-21 10:18:02.980433147 +0200 +++ /usr/src/nvidia-legacy-390xx-390.144/nvidia-drm/nvidia-drm-drv.c 2021-09-21 10:21:21.454372046 +0200 @@ -59,6 +59,7 @@ #include <drm/drm_ioctl.h> #endif +#include <linux/version.h> #include <linux/pci.h> /* @@ -811,7 +812,10 @@ 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) dev->pdev = pdev; +#endif /* Register DRM device to DRM sub-system */