mirror of
https://github.com/Frogging-Family/nvidia-all
synced 2024-10-30 15:20:10 +00:00
Add Linux 6.5 patch for 525 and 530 driver branches
This commit is contained in:
parent
a6d0ac095d
commit
a714521eca
27
PKGBUILD
27
PKGBUILD
@ -356,6 +356,7 @@ source=($_source_name
|
||||
'kernel-6.2.patch'
|
||||
'kernel-6.3.patch'
|
||||
'kernel-6.4.patch'
|
||||
'kernel-6.5.patch'
|
||||
)
|
||||
|
||||
msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If the driver is "known", return md5sum. If it isn't, return SKIP
|
||||
@ -401,7 +402,8 @@ md5sums=("$_md5sum"
|
||||
'0b9b855d9be313153a5903e46e774a30'
|
||||
'5d573b1aa0712b9bd2000c9fefdf84c2'
|
||||
'a6acbba08173769399658914eb86a212'
|
||||
'4f855bb0e0b84e8e5d072c687256767a')
|
||||
'4f855bb0e0b84e8e5d072c687256767a'
|
||||
'd409945e14af98ecbf91cf32d25e5ca1')
|
||||
|
||||
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")
|
||||
@ -812,6 +814,11 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
_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* )
|
||||
fi
|
||||
# 6.5
|
||||
if (( $(vercmp "$_kernel" "6.5") >= 0 )); then
|
||||
_kernel65="1"
|
||||
_whitelist65=(525* 530* 535.5* 535.43.02)
|
||||
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
|
||||
@ -887,7 +894,9 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
if [ "$_patch" = "6.4" ]; then
|
||||
_whitelist=(${_whitelist64[@]})
|
||||
fi
|
||||
|
||||
if [ "$_patch" = "6.5" ]; then
|
||||
_whitelist=(${_whitelist65[@]})
|
||||
fi
|
||||
patchy=0
|
||||
if (( $(vercmp "$_kernel" "$_patch") >= 0 )); then
|
||||
for yup in "${_whitelist[@]}"; do
|
||||
@ -1280,7 +1289,19 @@ DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
|
||||
msg2 "Skipping kernel-6.4.patch as it doesn't apply to this driver version..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# 6.5
|
||||
if [ "$_kernel65" = "1" ]; then
|
||||
patchy=0
|
||||
for yup in "${_whitelist65[@]}"; do
|
||||
[[ $pkgver = $yup ]] && patchy=1
|
||||
done
|
||||
if [ "$patchy" = "1" ]; then
|
||||
msg2 "Applying kernel-6.5.patch for dkms..."
|
||||
patch -Np1 -i "$srcdir"/kernel-6.5.patch
|
||||
else
|
||||
msg2 "Skipping kernel-6.5.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..."
|
||||
|
99
patches/kernel-6.5.patch
Normal file
99
patches/kernel-6.5.patch
Normal file
@ -0,0 +1,99 @@
|
||||
Works around get_user_pages argument error when compiling for kernel 6.5 or newer
|
||||
Should work with 525xx, 530xx 535xx prior to 535.86(?), potentially some older versions?
|
||||
Original patch by Fjodor42 - this just changes some driver-specific lines
|
||||
See: https://gist.github.com/joanbm/dfe8dc59af1c83e2530a1376b77be8ba
|
||||
Original original patch for 470xx by Joan Bruguera at https://gist.github.com/joanbm/dfe8dc59af1c83e2530a1376b77be8ba
|
||||
|
||||
--- 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)
|
||||
@@ -41,7 +42,16 @@ typedef int vm_fault_t;
|
||||
#include <linux/mm.h>
|
||||
#include <linux/sched.h>
|
||||
#if defined(NV_PIN_USER_PAGES_PRESENT)
|
||||
- #define NV_PIN_USER_PAGES pin_user_pages
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
|
||||
+ static inline long NV_PIN_USER_PAGES(unsigned long start, unsigned long nr_pages,
|
||||
+ unsigned int gup_flags, struct page **pages,
|
||||
+ struct vm_area_struct **vmas) {
|
||||
+ return pin_user_pages(start, nr_pages, gup_flags, pages);
|
||||
+ }
|
||||
+ #else
|
||||
+ #define NV_PIN_USER_PAGES pin_user_pages
|
||||
+ #endif
|
||||
+
|
||||
#define NV_UNPIN_USER_PAGE unpin_user_page
|
||||
#else
|
||||
#define NV_PIN_USER_PAGES NV_GET_USER_PAGES
|
||||
@@ -66,7 +76,25 @@ typedef int vm_fault_t;
|
||||
*
|
||||
*/
|
||||
|
||||
-#if defined(NV_GET_USER_PAGES_HAS_ARGS_FLAGS)
|
||||
+// 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)
|
||||
+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_ARGS_FLAGS)
|
||||
#define NV_GET_USER_PAGES get_user_pages
|
||||
#elif defined(NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS)
|
||||
#define NV_GET_USER_PAGES(start, nr_pages, flags, pages, vmas) \
|
||||
@@ -103,7 +131,14 @@ typedef int vm_fault_t;
|
||||
*/
|
||||
|
||||
#if defined(NV_PIN_USER_PAGES_REMOTE_PRESENT)
|
||||
- #if defined (NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK)
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
|
||||
+ static inline long NV_PIN_USER_PAGES_REMOTE(struct mm_struct *mm,
|
||||
+ unsigned long start, unsigned long nr_pages,
|
||||
+ unsigned int gup_flags, struct page **pages,
|
||||
+ struct vm_area_struct **vmas, int *locked) {
|
||||
+ return pin_user_pages_remote(mm, start, nr_pages, gup_flags, pages, locked);
|
||||
+ }
|
||||
+ #elif defined (NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK)
|
||||
#define NV_PIN_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
||||
pin_user_pages_remote(NULL, mm, start, nr_pages, flags, pages, vmas, locked)
|
||||
#else
|
||||
@@ -137,7 +172,20 @@ typedef int vm_fault_t;
|
||||
*
|
||||
*/
|
||||
|
||||
-#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
|
||||
+//#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 mm_struct *mm,
|
||||
+ unsigned long start,
|
||||
+ unsigned long nr_pages,
|
||||
+ unsigned int gup_flags,
|
||||
+ struct page **pages,
|
||||
+ struct vm_area_struct **vmas,
|
||||
+ int *locked)
|
||||
+{
|
||||
+ return get_user_pages_remote(mm, start, nr_pages, gup_flags, pages, locked);
|
||||
+}
|
||||
+#elif defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
|
||||
#if defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED)
|
||||
#define NV_GET_USER_PAGES_REMOTE get_user_pages_remote
|
Loading…
Reference in New Issue
Block a user