Add edited kernel-6.12.patch from Joan Bruguera

This commit is contained in:
vnctdj 2024-11-26 00:14:59 +01:00
parent ebb48c240c
commit 94dffc01e2
3 changed files with 103 additions and 2 deletions

View file

@ -1,6 +1,6 @@
pkgbase = nvidia-390xx-utils
pkgver = 390.157
pkgrel = 12
pkgrel = 13
url = https://www.nvidia.com/
arch = x86_64
license = custom
@ -19,6 +19,7 @@ pkgbase = nvidia-390xx-utils
source = kernel-6.8.patch
source = gcc-14.patch
source = kernel-6.10.patch
source = kernel-6.12.patch
source = kernel-4.16+-memory-encryption.patch
b2sums = 8e24aea70b139185bd682b080d32aeda673e6e92b45a90e6f6e0d736674180400bc8bd1aa5c66b8d033fc9d5e0cfffed456a87298bd93a3afbbc30b8dc48c4e9
b2sums = c1da4ce5784e43385465913a95053a3e54f800aac6f1b49f33e2a77504d76da5e6db6ec7074fbe7ba5f52dcef9e1ebaa620942c33ff825a56caba5c9c8b0d1be
@ -34,6 +35,7 @@ pkgbase = nvidia-390xx-utils
b2sums = d7059792166bd0d1fce8f494d869b13e95aefd31af8d626651f5087e87f9c728655d1fbffbc8b6c2e1ee5d9e96f2a3fafadf7a3e06c28bdbfd266319c32c7704
b2sums = 2382cc3e1ce89931cc5943fa1e96094f592915bd64bc88ff9b087e0c127347b440dd969cce149c01ee894f1ec9c059c616eee6f20cd4af2ba2c81fbd690e498b
b2sums = a06b47d59e11ab2f8bd7af97042a3ed15ac97559b3c507a03fa453481b86727d98f8a34e95c6fc38fe82f803d0b67282dba4f27d4f714d2c68eb2eb0ce98e575
b2sums = aaa0597ab9d33be3c6e020fab0d54890d32f32c5ce70571e2bc989a788dbe2317e826475966bc1026bf7f7ff6672bd9a2f7f8e48dcebd2f91d33d9181eee1208
b2sums = a8234f542c2324ad698443e3decf7b6eacf3cb420b7aded787f102a8d32b64c2a8d45ea58e37a5e3b6f2f060f0cccd63d3a182065f57c606006d0ff8c7f6bb05
pkgname = nvidia-390xx-utils

View file

@ -8,7 +8,7 @@
pkgbase=nvidia-390xx-utils
pkgname=('nvidia-390xx-utils' 'opencl-nvidia-390xx' 'nvidia-390xx-dkms')
pkgver=390.157
pkgrel=12
pkgrel=13
arch=('x86_64')
url="https://www.nvidia.com/"
license=('custom')
@ -28,6 +28,7 @@ source=('nvidia-drm-outputclass.conf'
kernel-6.8.patch
gcc-14.patch
kernel-6.10.patch
kernel-6.12.patch
kernel-4.16+-memory-encryption.patch)
b2sums=('8e24aea70b139185bd682b080d32aeda673e6e92b45a90e6f6e0d736674180400bc8bd1aa5c66b8d033fc9d5e0cfffed456a87298bd93a3afbbc30b8dc48c4e9'
'c1da4ce5784e43385465913a95053a3e54f800aac6f1b49f33e2a77504d76da5e6db6ec7074fbe7ba5f52dcef9e1ebaa620942c33ff825a56caba5c9c8b0d1be'
@ -43,6 +44,7 @@ b2sums=('8e24aea70b139185bd682b080d32aeda673e6e92b45a90e6f6e0d736674180400bc8bd1
'd7059792166bd0d1fce8f494d869b13e95aefd31af8d626651f5087e87f9c728655d1fbffbc8b6c2e1ee5d9e96f2a3fafadf7a3e06c28bdbfd266319c32c7704'
'2382cc3e1ce89931cc5943fa1e96094f592915bd64bc88ff9b087e0c127347b440dd969cce149c01ee894f1ec9c059c616eee6f20cd4af2ba2c81fbd690e498b'
'a06b47d59e11ab2f8bd7af97042a3ed15ac97559b3c507a03fa453481b86727d98f8a34e95c6fc38fe82f803d0b67282dba4f27d4f714d2c68eb2eb0ce98e575'
'aaa0597ab9d33be3c6e020fab0d54890d32f32c5ce70571e2bc989a788dbe2317e826475966bc1026bf7f7ff6672bd9a2f7f8e48dcebd2f91d33d9181eee1208'
'a8234f542c2324ad698443e3decf7b6eacf3cb420b7aded787f102a8d32b64c2a8d45ea58e37a5e3b6f2f060f0cccd63d3a182065f57c606006d0ff8c7f6bb05')
create_links() {
@ -90,6 +92,9 @@ prepare() {
# From Ike Devolder, edited by drankinatty
patch -Np1 -i ../kernel-6.10.patch
# From Joan Bruguera (https://gist.github.com/joanbm/a6d3f7f873a60dec0aa4a734c0f1d64e), edited by drankinatty
patch -Np1 -i ../kernel-6.12.patch
cd kernel
sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf

94
kernel-6.12.patch Normal file
View file

@ -0,0 +1,94 @@
diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
index 1291893..53dfad8 100644
--- a/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -84,6 +84,10 @@
#include <drm/drm_atomic_helper.h>
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+#include <drm/drm_client.h>
+#endif
+
static struct nv_drm_device *dev_list = NULL;
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
@@ -168,7 +172,12 @@ static const struct drm_mode_config_funcs nv_mode_config_funcs = {
.atomic_check = nv_drm_atomic_check,
.atomic_commit = nv_drm_atomic_commit,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
+ // Rel. commit. "drm: Remove struct drm_mode_config_funcs.output_poll_changed" (Thomas Zimmermann, 12 Aug 2024)
+ // Replace this callback with a DRM client's hotplug callback.
+ // This is required for e.g. /sys/class/drm/card*/modes to work.
.output_poll_changed = nv_drm_output_poll_changed,
+#endif
};
static void nv_drm_event_callback(const struct NvKmsKapiEvent *event)
@@ -652,6 +661,10 @@ static const struct file_operations nv_drm_fops = {
.read = drm_read,
.llseek = noop_llseek,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+ // Rel. commit. "fs: move FMODE_UNSIGNED_OFFSET to fop_flags" (Christian Brauner, 9 Aug 2024)
+ .fop_flags = FOP_UNSIGNED_OFFSET,
+#endif
};
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
@@ -790,7 +803,18 @@ static void nv_drm_update_drm_driver_features(void)
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+static int hotplug_helper_client_hotplug(struct drm_client_dev *client)
+{
+ nv_drm_output_poll_changed(client->dev);
+ return 0;
+}
+static const struct drm_client_funcs nv_hotplug_helper_client_funcs = {
+ .owner = THIS_MODULE,
+ .hotplug = hotplug_helper_client_hotplug,
+};
+#endif
/*
* Helper function for allocate/register DRM device for given NVIDIA GPU ID.
@@ -844,6 +868,20 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
goto failed_drm_register;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+ /* Register a DRM client for receiving hotplug events */
+ struct drm_client_dev *client = kzalloc(sizeof(*client), GFP_KERNEL);
+ if (client == NULL || drm_client_init(dev, client,
+ "nv-hotplug-helper", &nv_hotplug_helper_client_funcs)) {
+ printk(KERN_WARNING "Failed to initialize the nv-hotplug-helper DRM client"
+ " (ensure DRM kernel mode setting is enabled via nvidia-drm.modeset=1).\n");
+ goto failed_drm_client_init;
+ }
+
+ drm_client_register(client);
+ pr_info("Registered the nv-hotplug-helper DRM client.\n");
+#endif
+
/* Add NVIDIA-DRM device into list */
nv_dev->next = dev_list;
@@ -851,6 +889,14 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
return; /* Success */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+failed_drm_client_init:
+
+ kfree(client);
+ drm_dev_unregister(dev);
+
+#endif
+
failed_drm_register:
nv_drm_dev_free(dev);