mirror of
https://github.com/Frogging-Family/nvidia-all
synced 2024-10-30 15:20:10 +00:00
legacy: Add 470.199.x kernel support patches for 6.4, 6.5 and 6.6rc
Thanks to @joanbm https://gist.github.com/joanbm/2ec3c512a1ac21f5f5c6b3c1a4dbef35 https://gist.github.com/joanbm/dfe8dc59af1c83e2530a1376b77be8ba https://gist.github.com/joanbm/77f0650d45747b9a4dc8e330ade2bf5c
This commit is contained in:
parent
f10baedc66
commit
264a2e067b
56
PKGBUILD
56
PKGBUILD
@ -355,8 +355,11 @@ source=($_source_name
|
||||
'kernel-6.0-470.patch' # acpi backports from 515.x for 470.x
|
||||
'kernel-6.2.patch'
|
||||
'kernel-6.3.patch'
|
||||
'legacy-kernel-6.4.diff'
|
||||
'kernel-6.4.patch'
|
||||
'legacy-kernel-6.5.diff'
|
||||
'kernel-6.5.patch'
|
||||
'legacy-kernel-6.6.diff'
|
||||
)
|
||||
|
||||
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
|
||||
@ -402,8 +405,11 @@ md5sums=("$_md5sum"
|
||||
'0b9b855d9be313153a5903e46e774a30'
|
||||
'5d573b1aa0712b9bd2000c9fefdf84c2'
|
||||
'a6acbba08173769399658914eb86a212'
|
||||
'f0173a8bce0124b2d62a54f2e22d1552'
|
||||
'4f855bb0e0b84e8e5d072c687256767a'
|
||||
'b81cac7573842ebd7af30fdf851c63f9')
|
||||
'50d3eac54d14d44d70df92770a3a9abf'
|
||||
'b81cac7573842ebd7af30fdf851c63f9'
|
||||
'd11cb3bd76ab61a0f086aea9a0c53087')
|
||||
|
||||
if [ "$_open_source_modules" = "true" ]; then
|
||||
source+=("$pkgname-$pkgver.tar.gz::https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${pkgver}.tar.gz")
|
||||
@ -813,11 +819,34 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
if (( $(vercmp "$_kernel" "6.4") >= 0 )); then
|
||||
_kernel64="1"
|
||||
_whitelist64=( 470.4* 470.5* 470.6* 470.7* 470.8* 470.9* 470.10* 470.12* 470.14* 470.16* 470.18* 530* )
|
||||
if [[ $pkgver = 470.199* ]]; then
|
||||
cd "$srcdir"/"$_pkg"/kernel-$_kernel
|
||||
msg2 "Applying legacy-kernel-6.4.patch for $_kernel..."
|
||||
patch -Np2 -i "$srcdir"/legacy-kernel-6.4.diff
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
# 6.5
|
||||
if (( $(vercmp "$_kernel" "6.5") >= 0 )); then
|
||||
_kernel65="1"
|
||||
_whitelist65=(525* 530* 535.5* 535.43.02)
|
||||
if [[ $pkgver = 470.199* ]]; then
|
||||
cd "$srcdir"/"$_pkg"/kernel-$_kernel
|
||||
msg2 "Applying legacy-kernel-6.5.patch for $_kernel..."
|
||||
patch -Np2 -i "$srcdir"/legacy-kernel-6.5.diff
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
# 6.6
|
||||
if (( $(vercmp "$_kernel" "6.6") >= 0 )); then
|
||||
_kernel66="1"
|
||||
_whitelist66=()
|
||||
if [[ $pkgver = 470.199* ]]; then
|
||||
cd "$srcdir"/"$_pkg"/kernel-$_kernel
|
||||
msg2 "Applying legacy-kernel-6.6.patch for $_kernel..."
|
||||
patch -Np2 -i "$srcdir"/legacy-kernel-6.6.diff
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
|
||||
# Loop patches (linux-4.15.patch, lol.patch, ...)
|
||||
@ -897,6 +926,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
if [ "$_patch" = "6.5" ]; then
|
||||
_whitelist=(${_whitelist65[@]})
|
||||
fi
|
||||
if [ "$_patch" = "6.6" ]; then
|
||||
_whitelist=(${_whitelist66[@]})
|
||||
fi
|
||||
patchy=0
|
||||
if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then
|
||||
for yup in "${_whitelist[@]}"; do
|
||||
@ -1288,6 +1320,10 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
else
|
||||
msg2 "Skipping kernel-6.4.patch as it doesn't apply to this driver version..."
|
||||
fi
|
||||
if [[ $pkgver = 470.199.* ]]; then
|
||||
msg2 "Applying legacy-kernel-6.4.patch for dkms..."
|
||||
patch -Np1 -i "$srcdir"/legacy-kernel-6.4.diff
|
||||
fi
|
||||
fi
|
||||
# 6.5
|
||||
if [ "$_kernel65" = "1" ]; then
|
||||
@ -1301,6 +1337,24 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
else
|
||||
msg2 "Skipping kernel-6.5.patch as it doesn't apply to this driver version..."
|
||||
fi
|
||||
if [[ $pkgver = 470.199.* ]]; then
|
||||
msg2 "Applying legacy-kernel-6.5.patch for dkms..."
|
||||
patch -Np1 -i "$srcdir"/legacy-kernel-6.5.diff
|
||||
fi
|
||||
fi
|
||||
# 6.6
|
||||
if [ "$_kernel66" = "1" ]; then
|
||||
patchy=0
|
||||
for yup in "${_whitelist66[@]}"; do
|
||||
[[ $pkgver = $yup ]] && patchy=1
|
||||
done
|
||||
if [ "$patchy" = "1" ]; then
|
||||
msg2 "Skipping kernel-6.6.patch as it doesn't apply to this driver version..."
|
||||
fi
|
||||
if [[ $pkgver = 470.199.* ]]; then
|
||||
msg2 "Applying legacy-kernel-6.6.patch for dkms..."
|
||||
patch -Np1 -i "$srcdir"/legacy-kernel-6.6.diff
|
||||
fi
|
||||
fi
|
||||
# Legacy quirks
|
||||
if [ "$_oldstuff" = "1" ]; then
|
||||
|
35
patches/legacy-kernel-6.4.diff
Normal file
35
patches/legacy-kernel-6.4.diff
Normal file
@ -0,0 +1,35 @@
|
||||
From 4981428cda825b415eea60313f71bf386cc9f7e1 Mon Sep 17 00:00:00 2001
|
||||
From: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
Date: Sat, 25 Feb 2023 10:57:26 +0000
|
||||
Subject: [PATCH] Tentative fix for NVIDIA 470.199.02 driver for Linux 6.4-rc1
|
||||
|
||||
---
|
||||
kernel-dkms/nvidia-drm/nvidia-drm-drv.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
@@ -20,6 +20,7 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
+#include <linux/version.h>
|
||||
#include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
|
||||
|
||||
#include "nvidia-drm-priv.h"
|
||||
@@ -873,9 +874,13 @@
|
||||
|
||||
nv_drm_driver.dumb_create = nv_drm_dumb_create;
|
||||
nv_drm_driver.dumb_map_offset = nv_drm_dumb_map_offset;
|
||||
+// Rel. commit "drm: remove dumb_destroy callback" (Christian König, 26 Jan 2023)
|
||||
+// NB: No resources are leaked, the kernel releases the same resources by default
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
|
||||
#if defined(NV_DRM_DRIVER_HAS_DUMB_DESTROY)
|
||||
nv_drm_driver.dumb_destroy = nv_drm_dumb_destroy;
|
||||
#endif /* NV_DRM_DRIVER_HAS_DUMB_DESTROY */
|
||||
+#endif
|
||||
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
||||
}
|
||||
|
||||
--
|
||||
2.40.1
|
81
patches/legacy-kernel-6.5.diff
Normal file
81
patches/legacy-kernel-6.5.diff
Normal file
@ -0,0 +1,81 @@
|
||||
From 0ca9614e5b074d3dd01e95f47b3555f48e74f622 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <joanbrugueram@gmail.com>
|
||||
Date: Wed, 17 May 2023 21:54:08 +0000
|
||||
Subject: [PATCH] Tentative fix for NVIDIA 470.182.03 driver for Linux 6.5-rc1
|
||||
|
||||
---
|
||||
kernel-dkms/common/inc/nv-mm.h | 45 +++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 43 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/kernel-dkms/common/inc/nv-mm.h b/kernel-dkms/common/inc/nv-mm.h
|
||||
index 54f6f60..25333e8 100644
|
||||
--- a/kernel-dkms/common/inc/nv-mm.h
|
||||
+++ b/kernel-dkms/common/inc/nv-mm.h
|
||||
@@ -23,6 +23,7 @@
|
||||
#ifndef __NV_MM_H__
|
||||
#define __NV_MM_H__
|
||||
|
||||
+#include <linux/version.h>
|
||||
#include "conftest.h"
|
||||
|
||||
#if !defined(NV_VM_FAULT_T_IS_PRESENT)
|
||||
@@ -47,7 +48,27 @@ typedef int vm_fault_t;
|
||||
*
|
||||
*/
|
||||
|
||||
-#if defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT)
|
||||
+// Rel. commit. "mm/gup: remove unused vmas parameter from get_user_pages()" (Lorenzo Stoakes, 14 May 2023)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
|
||||
+#include <linux/mm.h>
|
||||
+
|
||||
+static inline long NV_GET_USER_PAGES(unsigned long start,
|
||||
+ unsigned long nr_pages,
|
||||
+ int write,
|
||||
+ int force,
|
||||
+ struct page **pages,
|
||||
+ struct vm_area_struct **vmas)
|
||||
+{
|
||||
+ unsigned int flags = 0;
|
||||
+
|
||||
+ if (write)
|
||||
+ flags |= FOLL_WRITE;
|
||||
+ if (force)
|
||||
+ flags |= FOLL_FORCE;
|
||||
+
|
||||
+ return get_user_pages(start, nr_pages, flags, pages);
|
||||
+}
|
||||
+#elif defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT)
|
||||
#if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
|
||||
#define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \
|
||||
get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
|
||||
@@ -130,7 +151,27 @@ typedef int vm_fault_t;
|
||||
*
|
||||
*/
|
||||
|
||||
-#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
|
||||
+// Rel. commit. "mm/gup: remove unused vmas parameter from get_user_pages_remote()" (Lorenzo Stoakes, 14 May 2023)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
|
||||
+static inline long NV_GET_USER_PAGES_REMOTE(struct task_struct *tsk,
|
||||
+ struct mm_struct *mm,
|
||||
+ unsigned long start,
|
||||
+ unsigned long nr_pages,
|
||||
+ int write,
|
||||
+ int force,
|
||||
+ struct page **pages,
|
||||
+ struct vm_area_struct **vmas)
|
||||
+{
|
||||
+ unsigned int flags = 0;
|
||||
+
|
||||
+ if (write)
|
||||
+ flags |= FOLL_WRITE;
|
||||
+ if (force)
|
||||
+ flags |= FOLL_FORCE;
|
||||
+
|
||||
+ return get_user_pages_remote(mm, start, nr_pages, flags, pages, NULL);
|
||||
+}
|
||||
+#elif defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
|
||||
#if defined(NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS)
|
||||
#define NV_GET_USER_PAGES_REMOTE get_user_pages_remote
|
||||
#else
|
||||
--
|
||||
2.41.0
|
29
patches/legacy-kernel-6.6.diff
Normal file
29
patches/legacy-kernel-6.6.diff
Normal file
@ -0,0 +1,29 @@
|
||||
From a1879549b0bf049de790c0775c25971c82da8638 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <joanbrugueram@gmail.com>
|
||||
Date: Sat, 15 Jul 2023 22:26:18 +0000
|
||||
Subject: [PATCH] Tentative fix for NVIDIA 470.199.02 driver for Linux 6.6-rc1
|
||||
|
||||
---
|
||||
kernel-dkms/nvidia-drm/nvidia-drm-drv.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
index b93642a..1b310f3 100644
|
||||
--- a/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
+++ b/kernel-dkms/nvidia-drm/nvidia-drm-drv.c
|
||||
@@ -808,8 +808,12 @@ static struct drm_driver nv_drm_driver = {
|
||||
.ioctls = nv_drm_ioctls,
|
||||
.num_ioctls = ARRAY_SIZE(nv_drm_ioctls),
|
||||
|
||||
+// Rel. commit "drm/prime: Unexport helpers for fd/handle conversion" (Thomas Zimmermann, 20 Jun 2023)
|
||||
+// Those functions are no longer exported, but leaving them to NULL is equivalent
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
+#endif
|
||||
.gem_prime_import = nv_drm_gem_prime_import,
|
||||
.gem_prime_import_sg_table = nv_drm_gem_prime_import_sg_table,
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
Loading…
Reference in New Issue
Block a user