x11-drivers/nvidia-drivers: bump KERNEL_MAX to 6.15 where possible

Which currently is only 570.153.02 with USE=kernel-open.

Normally do not add patches for this, but feel that this situation
may last so adding CachyOS' workaround for USE=-kernel-open.

575 is more broken, but not going to bother with that one as it's
unkeyworded.

Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2025-05-26 16:08:44 -04:00
parent ab5b4e4bee
commit d9dc2792d5
2 changed files with 73 additions and 1 deletions

View File

@@ -0,0 +1,71 @@
Only needed with USE=-kernel-open to avoid GPL-only __vma_start_write,
not really runtime-tested but at least code does nothing for stable users
with <6.15..
https://github.com/NVIDIA/open-gpu-kernel-modules/issues/840#issuecomment-2906864735
https://github.com/CachyOS/kernel-patches/commit/914aea4298e3
--- a/kernel/nvidia/nv-mmap.c
+++ b/kernel/nvidia/nv-mmap.c
@@ -24,8 +24,15 @@
#define __NO_VERSION__
+#include <linux/version.h>
+
#include "os-interface.h"
#include "nv-linux.h"
#include "nv_speculation_barrier.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
+#define nv_vm_flags_set(v, f) vm_flags_reset((v), (v)->vm_flags | (f))
+#define nv_vm_flags_clear(v, f) vm_flags_reset((v), (v)->vm_flags & ~(f))
+#endif
+
/*
* The 'struct vm_operations' open() callback is called by the Linux
--- a/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
+++ b/kernel/nvidia-drm/nvidia-drm-gem-user-memory.c
@@ -45,4 +45,11 @@
#endif
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
+#define nv_vm_flags_set(v, f) vm_flags_reset((v), (v)->vm_flags | (f))
+#define nv_vm_flags_clear(v, f) vm_flags_reset((v), (v)->vm_flags & ~(f))
+#endif
+
static inline
void __nv_drm_gem_user_memory_free(struct nv_drm_gem_object *nv_gem)
--- a/kernel/nvidia-drm/nvidia-drm-gem.c
+++ b/kernel/nvidia-drm/nvidia-drm-gem.c
@@ -52,4 +52,11 @@
#include "nv-mm.h"
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
+#define nv_vm_flags_set(v, f) vm_flags_reset((v), (v)->vm_flags | (f))
+#define nv_vm_flags_clear(v, f) vm_flags_reset((v), (v)->vm_flags & ~(f))
+#endif
+
void nv_drm_gem_free(struct drm_gem_object *gem)
{
--- a/kernel/nvidia-uvm/uvm.c
+++ b/kernel/nvidia-uvm/uvm.c
@@ -22,4 +22,6 @@
*******************************************************************************/
+#include <linux/version.h>
+
#include "uvm_api.h"
#include "uvm_global.h"
@@ -41,4 +43,9 @@
#define NVIDIA_UVM_DEVICE_NAME "nvidia-uvm"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
+#define nv_vm_flags_set(v, f) vm_flags_reset((v), (v)->vm_flags | (f))
+#define nv_vm_flags_clear(v, f) vm_flags_reset((v), (v)->vm_flags & ~(f))
+#endif
+
static dev_t g_uvm_base_dev;
static struct cdev g_uvm_cdev;

View File

@@ -7,7 +7,7 @@ MODULES_OPTIONAL_IUSE=+modules
inherit desktop dot-a eapi9-pipestatus eapi9-ver flag-o-matic linux-mod-r1
inherit readme.gentoo-r1 systemd toolchain-funcs unpacker user-info
MODULES_KERNEL_MAX=6.14
MODULES_KERNEL_MAX=6.15
NV_URI="https://download.nvidia.com/XFree86/"
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
@@ -95,6 +95,7 @@ QA_PREBUILT="lib/firmware/* usr/bin/* usr/lib*"
PATCHES=(
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
"${FILESDIR}"/nvidia-settings-530.30.02-desktop.patch
"${FILESDIR}"/nvidia-drivers-570.153.02-kernel-6.15.patch
)
pkg_setup() {