Initial 5.12 (release) kernel patch for 455 series - Thanks to @openglfreak

This commit is contained in:
Tk-Glitch 2021-04-27 16:56:30 +02:00
parent 9a490636ed
commit 2e186a254a
2 changed files with 58 additions and 3 deletions

View File

@ -48,7 +48,7 @@ if [ -z "$_driver_version" ] || [ "$_driver_version" = "latest" ] || [ -z "$_dri
fi
fi
if [[ -z $CONDITION ]]; then
read -p " What driver version do you want?`echo $'\n > 1.Vulkan dev: 455.50.14 (kernel 5.11 or lower)\n 2.465 series: 465.24.02\n 3.460 series: 460.73.01\n 4.455 series: 455.45.01 (kernel 5.11 or lower)\n 5.450 series: 450.102.04 (kernel 5.11 or lower)\n 6.440 series: 440.100 (kernel 5.8 or lower)\n 7.435 series: 435.21 (kernel 5.6 or lower)\n 8.430 series: 430.64 (kernel 5.5 or lower)\n 9.418 series: 418.113 (kernel 5.5 or lower)\n 10.415 series: 415.27 (kernel 5.4 or lower)\n 11.410 series: 410.104 (kernel 5.5 or lower)\n 12.396 series: 396.54 (kernel 5.3 or lower, 5.1 or lower recommended)\n 13.Custom version (396.xx series or higher)\n choice[1-13?]: '`" CONDITION;
read -p " What driver version do you want?`echo $'\n > 1.Vulkan dev: 455.50.14\n 2.465 series: 465.24.02\n 3.460 series: 460.73.01\n 4.455 series: 455.45.01\n 5.450 series: 450.102.04 (kernel 5.11 or lower)\n 6.440 series: 440.100 (kernel 5.8 or lower)\n 7.435 series: 435.21 (kernel 5.6 or lower)\n 8.430 series: 430.64 (kernel 5.5 or lower)\n 9.418 series: 418.113 (kernel 5.5 or lower)\n 10.415 series: 415.27 (kernel 5.4 or lower)\n 11.410 series: 410.104 (kernel 5.5 or lower)\n 12.396 series: 396.54 (kernel 5.3 or lower, 5.1 or lower recommended)\n 13.Custom version (396.xx series or higher)\n choice[1-13?]: '`" CONDITION;
fi
# This will be treated as the latest regular driver.
if [ "$CONDITION" = "2" ]; then
@ -222,7 +222,7 @@ fi
pkgname=("${_pkgname_array[@]}")
pkgver=$_driver_version
pkgrel=160
pkgrel=161
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom:NVIDIA')
@ -275,6 +275,7 @@ source=($_source_name
'kernel-5.11.patch' # 5.11 workaround
'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
)
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
@ -307,7 +308,8 @@ md5sums=("$_md5sum"
'bcdd512edad1bad8331a8872259d2581'
'fd0d6e14e675a61f32279558678cfc36'
'8764cc714e61363cc8f818315957ad17'
'08bec554de265ce5fdcfdbd55fb608fc')
'08bec554de265ce5fdcfdbd55fb608fc'
'3980770412a1d4d7bd3a16c9042200df')
if [ "$_autoaddpatch" = "true" ]; then
# Auto-add *.patch files from $startdir to source=()
@ -597,6 +599,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
fi
fi
# 5.12
if (( $(vercmp "$_kernel" "5.12") >= 0 )); then
_kernel512="1"
_whitelist512=( 455.4* 455.5* )
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, "", ...)
@ -647,6 +655,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
if [ "$_patch" = "5.11" ]; then
_whitelist=(${_whitelist511[@]})
fi
if [ "$_patch" = "5.12" ]; then
_whitelist=(${_whitelist512[@]})
fi
patchy=0
if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then
@ -919,6 +930,20 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
fi
fi
# 5.12
if [ "$_kernel512" = "1" ]; then
patchy=0
for yup in "${_whitelist512[@]}"; do
[[ $pkgver = $yup ]] && patchy=1
done
if [ "$patchy" = "1" ]; then
msg2 "Applying kernel-5.12.patch for dkms..."
patch -Np1 -i "$srcdir"/kernel-5.12.patch
else
msg2 "Skipping kernel-5.12.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..."

30
patches/kernel-5.12.patch Normal file
View File

@ -0,0 +1,30 @@
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
index ef89513..7f0707d 100644
--- a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
@@ -855,7 +855,9 @@ 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;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
nv_drm_driver.dumb_destroy = drm_gem_dumb_destroy;
+#endif
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
}
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-gem-user-memory.c b/kernel-dkms/nvidia-drm/nvidia-drm-gem-user-memory.c
index 89ab321..f29b644 100644
--- a/kernel-dkms/nvidia-drm/nvidia-drm-gem-user-memory.c
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-gem-user-memory.c
@@ -208,7 +208,11 @@ struct nv_drm_gem_user_memory *nv_drm_gem_user_memory_import_sg_table(
return NULL;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0))
if (drm_prime_sg_to_page_addr_arrays(sgt, pages, NULL, pages_count) < 0) {
+#else
+ if (drm_prime_sg_to_page_array(sgt, pages, pages_count) < 0) {
+#endif
nv_drm_free(nv_user_memory);
nv_drm_free(pages);
return NULL;