commit 00fa21adaaa65a45b7d32a772ca523ba6db92283
Author: Nicolas Viéville <nicolas.vieville(a)uphf.fr>
Date: Mon Dec 16 19:33:28 2024 +0100
Update and fix patch for kernel >= 6.12
Signed-off-by: Nicolas Viéville <nicolas.vieville(a)uphf.fr>
...ia-390xx-kmod-0093-kernel-6.12-adaptation.patch | 117 +++++++++++++++++++++
...6.12-removed-output_poll_changed-function.patch | 93 ----------------
nvidia-390xx-kmod.spec | 2 +-
3 files changed, 118 insertions(+), 94 deletions(-)
---
diff --git a/nvidia-390xx-kmod-0093-kernel-6.12-adaptation.patch
b/nvidia-390xx-kmod-0093-kernel-6.12-adaptation.patch
new file mode 100644
index 0000000..5ab23e5
--- /dev/null
+++ b/nvidia-390xx-kmod-0093-kernel-6.12-adaptation.patch
@@ -0,0 +1,117 @@
+From bf29f9a510ddd01412e11b6bf578a1fa1b32ae4a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nicolas=20Vi=C3=A9ville?= <nicolas.vieville(a)uphf.fr>
+Date: Mon, 16 Dec 2024 17:43:36 +0100
+Subject: [PATCH] Linux 6.12: nvidia-drm-drv.c adaptation inspired from
+ Archlinux and Joan Bruguera gist repository
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Nicolas Viéville <nicolas.vieville(a)uphf.fr>
+---
+ kernel/nvidia-drm/nvidia-drm-drv.c | 53 ++++++++++++++++++++++++++++++
+ 1 file changed, 53 insertions(+)
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index f649202..a0887ff 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,15 @@ 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)
++ // Removed by commit 446d0f4849b101bfc35c0d00835c3e3a4804616d
++ // "drm: Remove struct drm_mode_config_funcs.output_poll_changed" in
++ // kernel 6.12 - Thomas Zimmermann, 12 Aug 2024.
++ // Hotplug event support is handled through the fbdev emulation interface
++ // going forward (required for for example /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 +664,13 @@ static const struct file_operations nv_drm_fops = {
+ .read = drm_read,
+
+ .llseek = noop_llseek,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
++ // Removed by commit 641bb4394f405cba498b100b44541ffc0aed5be1
++ // "fs: move FMODE_UNSIGNED_OFFSET to fop_flags" the
FMODE_UNSIGNED_OFFSET
++ // flag has been moved to fop_flags and renamed
++ // Christian Brauner, 9 Aug 2024.
++ .fop_flags = FOP_UNSIGNED_OFFSET,
++#endif
+ };
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
+@@ -796,6 +815,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
+
+
+ /*
+@@ -850,6 +881,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;
+@@ -857,6 +902,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);
+--
+2.47.1
+
diff --git a/nvidia-390xx-kmod.spec b/nvidia-390xx-kmod.spec
index 8818d70..63888d6 100644
--- a/nvidia-390xx-kmod.spec
+++ b/nvidia-390xx-kmod.spec
@@ -106,7 +106,7 @@ Patch155:
nvidia-390xx-kmod-0089-kernel-6.10-removed-follow_pfn-function.patch
Patch156:
nvidia-390xx-kmod-0090-fix_warning_suggested_braces_around_empty_body_in_if.patch
Patch157: nvidia-390xx-kmod-0091-fix_warning_old_style_declaration_.patch
Patch158: nvidia-390xx-kmod-0092-fix_index_0_is_out_of_range_kernel_6.8_traces.patch
-Patch159: nvidia-390xx-kmod-0093-kernel-6.12-removed-output_poll_changed-function.patch
+Patch159: nvidia-390xx-kmod-0093-kernel-6.12-adaptation.patch
# build system updates
Patch30: use-kbuild-compiler.patch