Tk-Glitch 2020-11-30 15:20:04 +01:00
parent 321594ced0
commit d7a0a9ebd0
2 changed files with 61 additions and 2 deletions

View File

@ -155,7 +155,7 @@ fi
pkgname=("${_pkgname_array[@]}")
pkgver=$_driver_version
pkgrel=141
pkgrel=142
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom:NVIDIA')
@ -204,6 +204,7 @@ source=($_source_name
'kernel-5.9.patch' # 5.9 workaround
'5.9-gpl.diff' # 5.9 cuda/nvenc workaround
'kernel-5.10.patch' # 5.10 workaround
'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
)
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
@ -233,7 +234,8 @@ md5sums=("$_md5sum"
'd67bf0a9aa5c19f07edbaf6bd157d661'
'888d12b9aea711e6a025835b8ad063e2'
'0758046ed7c50463fd0ec378e9e34f95'
'bcdd512edad1bad8331a8872259d2581')
'bcdd512edad1bad8331a8872259d2581'
'08bec554de265ce5fdcfdbd55fb608fc')
if [ "$_autoaddpatch" = "true" ]; then
# Auto-add *.patch files from $startdir to source=()
@ -324,6 +326,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
cd "$srcdir"/"$_pkg"/kernel-$_kernel
msg2 "Applying linux-version.diff for $_kernel..."
patch -p2 -i "$srcdir"/linux-version.diff
# https://forums.developer.nvidia.com/t/455-23-04-page-allocation-failure-in-kernel-module-at-random-points/155250/77
if [[ $pkgver = 455* ]]; then
msg2 "Applying 455 crashfix for $_kernel..."
patch -p2 -i "$srcdir"/455-crashfix.diff
fi
cd ..
## kernel version variables, quirks & driver patch whitelists
@ -565,6 +573,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
msg2 "Applying linux-version.diff for dkms..."
patch -Np1 -i "$srcdir"/linux-version.diff
# https://forums.developer.nvidia.com/t/455-23-04-page-allocation-failure-in-kernel-module-at-random-points/155250/77
if [[ $pkgver = 455* ]]; then
msg2 "Applying 455 crashfix for dkms..."
patch -Np1 -i "$srcdir"/455-crashfix.diff
fi
# 4.16
if [ "$_kernel416" = "1" ]; then
patchy=0

45
patches/455-crashfix.diff Normal file
View File

@ -0,0 +1,45 @@
diff --git a/kernel-dkms/nvidia-modeset/nvidia-modeset-linux.c b/kernel-dkms/nvidia-modeset/nvidia-modeset-linux.c
index ffbbeb9..2302541 100644
--- a/kernel-dkms/nvidia-modeset/nvidia-modeset-linux.c
+++ b/kernel-dkms/nvidia-modeset/nvidia-modeset-linux.c
@@ -21,6 +21,8 @@
#include <linux/file.h>
#include <linux/list.h>
#include <linux/rwsem.h>
+#include <linux/mm.h>
+#include <linux/version.h>
#include "nvstatus.h"
@@ -169,8 +171,9 @@ static inline void nvkms_write_unlock_pm_lock(void)
* are called while nvkms_lock is held.
*************************************************************************/
-/* Don't use kmalloc for allocations larger than 128k */
-#define KMALLOC_LIMIT (128 * 1024)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+/* Don't use kmalloc for allocations larger than PAGE_SIZE */
+#define KMALLOC_LIMIT (PAGE_SIZE)
void* NVKMS_API_CALL nvkms_alloc(size_t size, NvBool zero)
{
@@ -197,6 +200,19 @@ void NVKMS_API_CALL nvkms_free(void *ptr, size_t size)
vfree(ptr);
}
}
+#else
+void* NVKMS_API_CALL nvkms_alloc(size_t size, NvBool zero)
+{
+ if (zero)
+ return kvzalloc(size, GFP_KERNEL);
+ return kvmalloc(size, GFP_KERNEL);
+}
+
+void NVKMS_API_CALL nvkms_free(void *ptr, size_t size)
+{
+ kvfree(ptr);
+}
+#endif
void* NVKMS_API_CALL nvkms_memset(void *ptr, NvU8 c, size_t size)
{