Add initial 5.8 compat patch
Based on Isaak I. Aleksandrov's patch https://gitlab.com/snippets/1986228 with small tweaks for compat with other drivers than 440.82
This commit is contained in:
29
PKGBUILD
29
PKGBUILD
@@ -147,7 +147,7 @@ fi
|
||||
|
||||
pkgname=("${_pkgname_array[@]}")
|
||||
pkgver=$_driver_version
|
||||
pkgrel=112
|
||||
pkgrel=113
|
||||
arch=('x86_64')
|
||||
url="http://www.nvidia.com/"
|
||||
license=('custom:NVIDIA')
|
||||
@@ -191,6 +191,7 @@ source=($_source_name
|
||||
'5.6-legacy-includes.diff' # 5.6 includes needed for <440.59(stable) and <440.58.01(vk dev)
|
||||
'5.6-ioremap.diff' # 5.6 additional ioremap workaround (<440.64)
|
||||
'kernel-5.7.patch' # 5.7 workaround
|
||||
'kernel-5.8.patch' # 5.8 workaround
|
||||
)
|
||||
|
||||
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
|
||||
@@ -215,7 +216,8 @@ md5sums=("$_md5sum"
|
||||
'c44e43638e1ab708fbdd6d7aa76afcf2'
|
||||
'84dc2d2eff2846b2f961388b153e2a89'
|
||||
'1f11f5c765e42c471b202e630e3cd407'
|
||||
'd911a0531c6f270926cacabd1dd80f02')
|
||||
'd911a0531c6f270926cacabd1dd80f02'
|
||||
'd1907c16b373e853018eec3232469744')
|
||||
|
||||
if [ "$_autoaddpatch" = "true" ]; then
|
||||
# Auto-add *.patch files from $startdir to source=()
|
||||
@@ -435,6 +437,12 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
_whitelist57=( 396* 410* 415* 418* 430* 435* 440* )
|
||||
fi
|
||||
|
||||
# 5.8
|
||||
if (( $(vercmp "$_kernel" "5.8") >= 0 )); then
|
||||
_kernel58="1"
|
||||
_whitelist58=( 396* 410* 415* 418* 430* 435* 440* 450* )
|
||||
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, "", ...)
|
||||
@@ -473,6 +481,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
if [ "$_patch" = "5.7" ]; then
|
||||
_whitelist=(${_whitelist57[@]})
|
||||
fi
|
||||
if [ "$_patch" = "5.8" ]; then
|
||||
_whitelist=(${_whitelist58[@]})
|
||||
fi
|
||||
|
||||
patchy=0
|
||||
if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then
|
||||
@@ -664,6 +675,20 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# 5.8
|
||||
if [ "$_kernel58" = "1" ]; then
|
||||
patchy=0
|
||||
for yup in "${_whitelist58[@]}"; do
|
||||
[[ $pkgver = $yup ]] && patchy=1
|
||||
done
|
||||
if [ "$patchy" = "1" ]; then
|
||||
msg2 "Applying kernel-5.8.patch for dkms..."
|
||||
patch -Np1 -i "$srcdir"/kernel-5.8.patch
|
||||
else
|
||||
msg2 "Skipping kernel-5.8.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..."
|
||||
|
@@ -3,6 +3,8 @@
|
||||
LIBGLVND compatible, with 32 bit libs and DKMS enabled out of the box (you will still be asked if you want to use the regular package). Installs for all currently installed kernels. Comes with custom patches to enhance kernel compatibility, dynamically applied when you're requesting a driver that's not compatible OOTB with your currently installed kernel(s).
|
||||
Unwanted packages can be disabled with switches in the PKGBUILD. Defaults to complete installation.
|
||||
|
||||
Huge thanks to Isaak I. Aleksandrov who has been much faster at offering compat patches than myself for a good while now! https://gitlab.com/EULA
|
||||
|
||||
You may need/want to add a pacman hook for nvidia depending on your setup : https://wiki.archlinux.org/index.php/NVIDIA#DRM_kernel_mode_setting
|
||||
|
||||
Vulkan dev drivers : https://developer.nvidia.com/vulkan-driver
|
||||
|
108
patches/kernel-5.8.patch
Normal file
108
patches/kernel-5.8.patch
Normal file
@@ -0,0 +1,108 @@
|
||||
diff --git a/kernel-dkms/common/inc/nv-linux.h b/kernel-dkms/common/inc/nv-linux.h
|
||||
index 70d336d..c31ec94 100644
|
||||
--- a/kernel-dkms/common/inc/nv-linux.h
|
||||
+++ b/kernel-dkms/common/inc/nv-linux.h
|
||||
@@ -509,7 +509,13 @@ extern NvBool nvos_is_chipset_io_coherent(void);
|
||||
|
||||
static inline void *nv_vmalloc(unsigned long size)
|
||||
{
|
||||
+#if NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT == 3
|
||||
void *ptr = __vmalloc(size, GFP_KERNEL, PAGE_KERNEL);
|
||||
+#elif NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT == 2
|
||||
+ void *ptr = __vmalloc(size, GFP_KERNEL);
|
||||
+#else
|
||||
+#error "NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT value unrecognized!"
|
||||
+#endif
|
||||
if (ptr)
|
||||
NV_MEMDBG_ADD(ptr, size);
|
||||
return ptr;
|
||||
diff --git a/kernel-dkms/common/inc/nv-mm.h b/kernel-dkms/common/inc/nv-mm.h
|
||||
index 4d75de0..0174626 100644
|
||||
--- a/kernel-dkms/common/inc/nv-mm.h
|
||||
+++ b/kernel-dkms/common/inc/nv-mm.h
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
#include "conftest.h"
|
||||
|
||||
+#if defined(NV_MM_STRUCT_HAS_MMAP_LOCK)
|
||||
+#define mmap_sem mmap_lock
|
||||
+#endif
|
||||
+
|
||||
#if !defined(NV_VM_FAULT_T_IS_PRESENT)
|
||||
typedef int vm_fault_t;
|
||||
#endif
|
||||
diff --git a/kernel-dkms/conftest.sh b/kernel-dkms/conftest.sh
|
||||
index af29636..1dfbca5 100755
|
||||
--- a/kernel-dkms/conftest.sh
|
||||
+++ b/kernel-dkms/conftest.sh
|
||||
@@ -2116,6 +2116,49 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_VZALLOC_PRESENT" "" "functions"
|
||||
;;
|
||||
|
||||
+ vmalloc_argument_count)
|
||||
+ #
|
||||
+ # Determine how many arguments __vmalloc takes.
|
||||
+ #
|
||||
+ # Changed by commit fc3af83c4fca ("mm: remove the pgprot argument
|
||||
+ # to __vmalloc")
|
||||
+ #
|
||||
+ echo "$CONFTEST_PREAMBLE
|
||||
+ #include <linux/mm.h>
|
||||
+ #include <linux/vmalloc.h>
|
||||
+ void conftest_vmalloc_argument_count(void) {
|
||||
+ __vmalloc(0, GFP_KERNEL, PAGE_KERNEL);
|
||||
+ }" > conftest$$.c
|
||||
+
|
||||
+ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||
+ rm -f conftest$$.c
|
||||
+
|
||||
+ if [ -f conftest$$.o ]; then
|
||||
+ echo "#define NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT 3" | append_conftest "functions"
|
||||
+ else
|
||||
+ echo "#define NV_VMALLOC_ARGUMENT_COUNT_ARGUMENT_COUNT 2" | append_conftest "functions"
|
||||
+ fi
|
||||
+
|
||||
+ rm -f conftest$$.o
|
||||
+ ;;
|
||||
+
|
||||
+ mm_struct_has_mmap_lock)
|
||||
+ #
|
||||
+ # Determine if the mm_struct structure has 'mmap_lock'.
|
||||
+ #
|
||||
+ # Changed by commit ea7b54944ef9 ("mmap locking API: rename mmap_sem
|
||||
+ # to mmap_lock")
|
||||
+ #
|
||||
+ CODE="
|
||||
+ #include <linux/mm.h>
|
||||
+
|
||||
+ int conftest_mm_struct_has_mmap_lock(void) {
|
||||
+ return offsetof(struct mm_struct, mmap_lock);
|
||||
+ }"
|
||||
+
|
||||
+ compile_check_conftest "$CODE" "NV_MM_STRUCT_HAS_MMAP_LOCK" "" "types"
|
||||
+ ;;
|
||||
+
|
||||
drm_driver_has_set_busid)
|
||||
#
|
||||
# Determine if the drm_driver structure has a 'set_busid' callback
|
||||
diff --git a/kernel-dkms/nvidia/nvidia.Kbuild b/kernel-dkms/nvidia/nvidia.Kbuild
|
||||
index ddc548d..863775d 100644
|
||||
--- a/kernel-dkms/nvidia/nvidia.Kbuild
|
||||
+++ b/kernel-dkms/nvidia/nvidia.Kbuild
|
||||
@@ -96,6 +96,7 @@
|
||||
|
||||
NV_OBJECTS_DEPEND_ON_CONFTEST += $(NVIDIA_OBJECTS)
|
||||
|
||||
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += vmalloc_argument_count
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += hash__remap_4k_pfn
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_pages_uc
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += list_is_first
|
||||
@@ -172,6 +173,7 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += kmem_cache_has_kobj_remove_work
|
||||
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_map_sg_attrs
|
||||
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_dma_ops
|
||||
|
||||
+NV_CONFTEST_TYPE_COMPILE_TESTS += mm_struct_has_mmap_lock
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += acpi_op_remove
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all
|
||||
NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations
|
||||
|
Reference in New Issue
Block a user