Add kernel 5.17 patch for 470 and 495 (#89)

Credits for the patch go to @joanbm (Joan Bruguera)
https://gist.github.com/joanbm/6c7b027b9436bf31ce979927e544e9d5
pull/93/head
Matej Dian 2 years ago committed by GitHub
parent d4d8346e63
commit 410a369ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -234,7 +234,7 @@ fi
pkgname=("${_pkgname_array[@]}")
pkgver=$_driver_version
pkgrel=195
pkgrel=196
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom:NVIDIA')
@ -292,6 +292,7 @@ source=($_source_name
'kernel-5.14.patch' # 5.14 workaround
'kernel-5.16.patch' # 5.16 workaround
'kernel-5.16-std.diff' # 5.16 workaround for 470.6x
'kernel-5.17.patch' # 5.17 workaround
)
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
@ -330,7 +331,8 @@ md5sums=("$_md5sum"
'3980770412a1d4d7bd3a16c9042200df'
'f5fd091893f513d2371654e83049f099'
'd684ca11fdc9894c14ead69cb35a5946'
'0f987607c98eb6faeb7d691213de6a70')
'0f987607c98eb6faeb7d691213de6a70'
'a70bc9cbbc7e8563b48985864a11de71')
if [ "$_autoaddpatch" = "true" ]; then
# Auto-add *.patch files from $startdir to source=()
@ -669,6 +671,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
fi
fi
# 5.17
if (( $(vercmp "$_kernel" "5.17") >= 0 )); then
_kernel517="1"
_whitelist517=( 470* 495*)
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, "", ...)
@ -728,6 +736,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
if [ "$_patch" = "5.16" ]; then
_whitelist=(${_whitelist516[@]})
fi
if [ "$_patch" = "5.17" ]; then
_whitelist=(${_whitelist517[@]})
fi
patchy=0
if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then
@ -1048,6 +1059,20 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
fi
fi
# 5.17
if [ "$_kernel517" = "1" ]; then
patchy=0
for yup in "${_whitelist517[@]}"; do
[[ $pkgver = $yup ]] && patchy=1
done
if [ "$patchy" = "1" ]; then
msg2 "Applying kernel-5.17.patch for dkms..."
patch -Np1 -i "$srcdir"/kernel-5.17.patch
else
msg2 "Skipping kernel-5.17.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..."

@ -0,0 +1,35 @@
From 026a2a54a234cdb7bf78c17be7ea29d8dcf9f390 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Sun, 23 Jan 2022 16:28:18 +0100
Subject: [PATCH] Tentative fix for NVIDIA 470.94 driver for Linux 5.17-rc1
See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=359745d78351c6f5442435f81549f0207ece28aa
---
common/inc/nv-procfs-utils.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/inc/nv-procfs-utils.h b/common/inc/nv-procfs-utils.h
index 7c3e1a3..462eac1 100644
--- a/kernel-dkms/common/inc/nv-procfs-utils.h
+++ b/kernel-dkms/common/inc/nv-procfs-utils.h
@@ -10,6 +10,7 @@
#ifndef _NV_PROCFS_UTILS_H
#define _NV_PROCFS_UTILS_H
+#include <linux/version.h>
#include "conftest.h"
#ifdef CONFIG_PROC_FS
@@ -87,6 +88,8 @@ typedef struct file_operations nv_proc_ops_t;
#if defined(NV_PDE_DATA_PRESENT)
# define NV_PDE_DATA(inode) PDE_DATA(inode)
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
+# define NV_PDE_DATA(inode) pde_data(inode)
#else
# define NV_PDE_DATA(inode) PDE(inode)->data
#endif
--
2.34.1
Loading…
Cancel
Save