diff --git a/PKGBUILD b/PKGBUILD index 4e33a23..6273ee6 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -226,12 +226,11 @@ fi pkgname=("${_pkgname_array[@]}") pkgver=$_driver_version -pkgrel=169 +pkgrel=170 arch=('x86_64') url="http://www.nvidia.com/" license=('custom:NVIDIA') optdepends=('linux-headers' 'linux-lts-headers: Build the module for LTS Arch kernel') -makedepends=('pahole') options=('!strip') cp "$where"/patches/* "$where" && cp -r "$where"/system/* "$where" @@ -280,6 +279,7 @@ source=($_source_name '5.11-legacy.diff' # 5.11 additional workaround (<460.32.03) '455-crashfix.diff' # 455 drivers fix - https://forums.developer.nvidia.com/t/455-23-04-page-allocation-failure-in-kernel-module-at-random-points/155250/79 'kernel-5.12.patch' # 5.12 workaround + 'kernel-5.14.patch' # 5.14 workaround ) msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP @@ -313,7 +313,8 @@ md5sums=("$_md5sum" 'fd0d6e14e675a61f32279558678cfc36' '8764cc714e61363cc8f818315957ad17' '08bec554de265ce5fdcfdbd55fb608fc' - '3980770412a1d4d7bd3a16c9042200df') + '3980770412a1d4d7bd3a16c9042200df' + 'f5fd091893f513d2371654e83049f099') if [ "$_autoaddpatch" = "true" ]; then # Auto-add *.patch files from $startdir to source=() @@ -620,6 +621,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf _whitelist512=( 455.4* 455.5* ) fi + # 5.14 + if (( $(vercmp "$_kernel" "5.14") >= 0 )); then + _kernel514="1" + _whitelist514=( 465* 470* ) + fi + # Loop patches (linux-4.15.patch, lol.patch, ...) for _p in $(printf -- '%s\n' ${source[@]} | grep .patch); do # https://stackoverflow.com/a/21058239/1821548 # Patch version (4.15, "", ...) @@ -673,6 +680,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf if [ "$_patch" = "5.12" ]; then _whitelist=(${_whitelist512[@]}) fi + if [ "$_patch" = "5.14" ]; then + _whitelist=(${_whitelist514[@]}) + fi patchy=0 if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then @@ -959,6 +969,20 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf fi fi + # 5.14 + if [ "$_kernel514" = "1" ]; then + patchy=0 + for yup in "${_whitelist514[@]}"; do + [[ $pkgver = $yup ]] && patchy=1 + done + if [ "$patchy" = "1" ]; then + msg2 "Applying kernel-5.14.patch for dkms..." + patch -Np1 -i "$srcdir"/kernel-5.14.patch + else + msg2 "Skipping kernel-5.14.patch as it doesn't apply to this driver version..." + fi + fi + # Legacy quirks if [ "$_oldstuff" = "1" ]; then msg2 "Applying 01-ipmi-vm.diff for dkms..." diff --git a/patches/kernel-5.14.patch b/patches/kernel-5.14.patch new file mode 100644 index 0000000..534c0b7 --- /dev/null +++ b/patches/kernel-5.14.patch @@ -0,0 +1,63 @@ +From f18c541edc5e122b06b0c1e65d0a422f0b8109e7 Mon Sep 17 00:00:00 2001 +From: Joan Bruguera +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/kernel-dkms/common/inc/nv-time.h b/kernel-dkms/common/inc/nv-time.h +index dc80806..cc343a5 100644 +--- a/kernel-dkms/common/inc/nv-time.h ++++ b/kernel-dkms/common/inc/nv-time.h +@@ -23,6 +23,7 @@ + #ifndef __NV_TIME_H__ + #define __NV_TIME_H__ + ++#include + #include "conftest.h" + #include + #include +@@ -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/kernel-dkms/nvidia-drm/nvidia-drm-drv.c b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c +index 84d4479..99ea552 100644 +--- a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c ++++ b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c +@@ -20,6 +20,7 @@ + * DEALINGS IN THE SOFTWARE. + */ + ++#include + #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 +