Add all 6.1x support patches

Also, add an option to disable them to gracefully still allow the module to build on 6.8 and earlier kernels.
This commit is contained in:
Lily Tsuru 2024-09-29 23:35:56 -04:00
parent 93dd13b3d1
commit 89d0c5e0ab
2 changed files with 47 additions and 0 deletions

View file

@ -1,5 +1,12 @@
# Maintainer: Lily Tsuru <lily.modeco80@protonmail.ch>
# Options
# Use patches for running on 6.1x Linux kernels
# (default true). Set to any other value during makepkg invocation
# to disable the new patches.
[[ -z "${_use_new_patches}" ]] && _use_new_patches="true"
pkgbase='nvidia-merged'
pkgname=('lib32-nvidia-merged-utils' 'lib32-opencl-nvidia-merged' 'nvidia-merged-dkms' 'nvidia-merged-settings' 'nvidia-merged-utils' 'opencl-nvidia-merged' 'vgpu-unlock-rs')
pkgrel=2
@ -32,6 +39,7 @@ source=(
'nvidia-iommu-api-fix.patch'
'nvidia-drm-defs-fix.patch'
'nvidia-eventfd-fix.patch'
'nvidia-follow-pfn-reimpl.patch'
'nvidia-smi'
'nvidia-vgpu.conf'
@ -51,6 +59,7 @@ sha256sums=('ae6b1cf5cc5e177e5502ebed4b64f058524bf5514e1d6cda911e2966b2749b16'
'437232dfa868999dd252ee95ee88625fb3e8231c0b705510904b6822512c56ba'
'f1e9e0d4ebbd35d14ef28c79f8ed8a0c22ff5e49765dd42119106f39078b4682'
'a26f0ee66e140be1f93e52ff965da59490a33b13f40c56629071eab2553ce48f'
'bd3f975e4b87bdc5135f4268bb99c6ae9c2719448221e80409bc10bdb9493764'
'eb51808257e7898d37d4575f40ada424cabf5dcad61017dd677ff5a0b25dead4'
'5ea0d9edfcf282cea9b204291716a9a4d6d522ba3a6bc28d78edf505b6dc7949'
'eafb28461fbe8a37cef3121f4b0ad53ad459ba389d9afb91e79c6c8d93ba5ea9'
@ -90,6 +99,12 @@ prepare() {
patch -p1 < ../dkms-conftest-iosys-fix.patch
patch -p1 < ../nvidia-iommu-api-fix.patch
patch -p1 < ../nvidia-drm-defs-fix.patch
[[ "${_use_new_patches}" == "true" ]] && {
echo "Enabling linux 6.1x support patches"
patch -p1 < ../nvidia-eventfd-fix.patch
patch -p1 < ../nvidia-follow-pfn-reimpl.patch
};
bsdtar -xf nvidia-persistenced-init.tar.bz2

View file

@ -0,0 +1,32 @@
diff --git a/kernel-orig/nvidia/os-mlock.c b/kernel/nvidia/os-mlock.c
index e378245..37c5daf 100644
--- a/kernel-orig/nvidia/os-mlock.c
+++ b/kernel/nvidia/os-mlock.c
@@ -30,11 +30,22 @@ static inline int nv_follow_pfn(struct vm_area_struct *vma,
unsigned long address,
unsigned long *pfn)
{
-#if defined(NV_UNSAFE_FOLLOW_PFN_PRESENT)
- return unsafe_follow_pfn(vma, address, pfn);
-#else
- return follow_pfn(vma, address, pfn);
-#endif
+ /* follow_pfn was removed in Linux 6.10. */
+ int status = 0;
+ spinlock_t *ptl;
+ pte_t *ptep;
+
+ if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
+ return status;
+
+ status = follow_pte(vma, address, &ptep, &ptl);
+ if (status)
+ return status;
+ *pfn = pte_pfn(ptep_get(ptep));
+
+ // The lock is acquired inside follow_pte()
+ pte_unmap_unlock(ptep, ptl);
+ return 0;
}
/*!