diff --git a/6.12/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch b/6.12/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch index 3936c89a..d1c20b2d 100644 --- a/6.12/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch +++ b/6.12/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch @@ -1,4 +1,4 @@ -From 0638bf38e24b9fd304805686b4b8b4d8d127d21d Mon Sep 17 00:00:00 2001 +From c0bf5aa9ab8205c5cf74356c3af6cbeb016765e6 Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Fri, 18 Oct 2024 22:40:38 +0200 Subject: [PATCH 2/6] Do not error on unkown CPU Type and add Zen5 support diff --git a/6.12/misc/nvidia/0004-Fix-for-6.12.0-rc1-drm_mode_config_funcs.output_poll.patch b/6.12/misc/nvidia/0004-Fix-for-6.12.0-rc1-drm_mode_config_funcs.output_poll.patch deleted file mode 100644 index 1b0d9dc4..00000000 --- a/6.12/misc/nvidia/0004-Fix-for-6.12.0-rc1-drm_mode_config_funcs.output_poll.patch +++ /dev/null @@ -1,121 +0,0 @@ -From d9c29dc72db55db98c2430dc3783835ef881da5e Mon Sep 17 00:00:00 2001 -From: Peter Jung -Date: Fri, 18 Oct 2024 22:42:42 +0200 -Subject: [PATCH 4/7] Fix for 6.12.0-rc1 - drm_mode_config_funcs.output_poll_changed removal - -Tentative fix for NVIDIA 560.35.03 driver for Linux 6.12-rc1. - -Based on https://gist.github.com/joanbm/a6d3f7f873a60dec0aa4a734c0f1d64e - -Signed-off-by: Peter Jung ---- - kernel-open/nvidia-drm/nvidia-drm-drv.c | 48 +++++++++++++++++++++++-- - 1 file changed, 45 insertions(+), 3 deletions(-) - -diff --git a/kernel-open/nvidia-drm/nvidia-drm-drv.c b/kernel-open/nvidia-drm/nvidia-drm-drv.c -index 8cb94219..c82feef6 100644 ---- a/kernel-open/nvidia-drm/nvidia-drm-drv.c -+++ b/kernel-open/nvidia-drm/nvidia-drm-drv.c -@@ -100,6 +100,11 @@ - #include - #endif - -+#include -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) -+#include -+#endif -+ - static int nv_drm_revoke_modeset_permission(struct drm_device *dev, - struct drm_file *filep, - NvU32 dpyId); -@@ -147,7 +152,7 @@ static char* nv_get_transfer_function_name( - - #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) - --#if defined(NV_DRM_OUTPUT_POLL_CHANGED_PRESENT) -+//#if defined(NV_DRM_OUTPUT_POLL_CHANGED_PRESENT) - static void nv_drm_output_poll_changed(struct drm_device *dev) - { - struct drm_connector *connector = NULL; -@@ -191,7 +196,7 @@ static void nv_drm_output_poll_changed(struct drm_device *dev) - nv_drm_connector_list_iter_end(&conn_iter); - #endif - } --#endif /* NV_DRM_OUTPUT_POLL_CHANGED_PRESENT */ -+//#endif /* NV_DRM_OUTPUT_POLL_CHANGED_PRESENT */ - - static struct drm_framebuffer *nv_drm_framebuffer_create( - struct drm_device *dev, -@@ -229,7 +234,7 @@ static const struct drm_mode_config_funcs nv_mode_config_funcs = { - .atomic_check = nv_drm_atomic_check, - .atomic_commit = nv_drm_atomic_commit, - -- #if defined(NV_DRM_OUTPUT_POLL_CHANGED_PRESENT) -+ #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) - .output_poll_changed = nv_drm_output_poll_changed, - #endif - }; -@@ -1711,6 +1716,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 - }; - - static const struct drm_ioctl_desc nv_drm_ioctls[] = { -@@ -1939,6 +1948,20 @@ void nv_drm_update_drm_driver_features(void) - } - - -+#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. -@@ -2029,8 +2052,27 @@ void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info) - nv_dev->next = dev_list; - dev_list = nv_dev; - -+#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."); -+ goto failed_drm_client_init; -+ } -+ -+ drm_client_register(client); -+ pr_info("Registered the nv-hotplug-helper DRM client."); -+#endif -+ - return; /* Success */ - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0) -+failed_drm_client_init: -+ -+ kfree(client); -+#endif -+ - failed_drm_register: - - nv_drm_dev_free(dev); --- -2.47.0 - diff --git a/6.12/misc/nvidia/0006-silence-event-assert-until-570.patch b/6.12/misc/nvidia/0004-silence-event-assert-until-570.patch similarity index 91% rename from 6.12/misc/nvidia/0006-silence-event-assert-until-570.patch rename to 6.12/misc/nvidia/0004-silence-event-assert-until-570.patch index d7fe7c07..35e70ab0 100644 --- a/6.12/misc/nvidia/0006-silence-event-assert-until-570.patch +++ b/6.12/misc/nvidia/0004-silence-event-assert-until-570.patch @@ -1,7 +1,7 @@ -From 348ca7e5e83bc36101172993f3aa60ae8ae5a2c7 Mon Sep 17 00:00:00 2001 +From bc3a3a9b9617c85b259fd1aa2c5ce46f17fb1694 Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Fri, 18 Oct 2024 22:44:33 +0200 -Subject: [PATCH 6/6] silence-event-assert-until-570 +Subject: [PATCH 4/6] silence-event-assert-until-570 Currently, when playing CS2 it reports a massive spam in the dmesg log. This will be fixed in the 570 driver. Silence it for now. diff --git a/6.12/misc/nvidia/0009-fix-hdmi-names.patch b/6.12/misc/nvidia/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch similarity index 93% rename from 6.12/misc/nvidia/0009-fix-hdmi-names.patch rename to 6.12/misc/nvidia/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch index 2e9bb569..661ccd41 100644 --- a/6.12/misc/nvidia/0009-fix-hdmi-names.patch +++ b/6.12/misc/nvidia/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch @@ -1,7 +1,7 @@ -From 5dc6c82dbf58d7c9a801d0332f1eede5495bd7cb Mon Sep 17 00:00:00 2001 +From e9df998a8915c45aff2f17f80a2711584fba9d5d Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Fri, 18 Oct 2024 22:44:59 +0200 -Subject: [PATCH 7/7] nvkms: Sanitize & trim ELD product name strings +Subject: [PATCH 5/6] nvkms: Sanitize & trim ELD product name strings Signed-off-by: Peter Jung --- diff --git a/6.12/misc/nvidia/0006-nvidia-drm-Set-FOP_UNSIGNED_OFFSET-for-nv_drm_fops.f.patch b/6.12/misc/nvidia/0006-nvidia-drm-Set-FOP_UNSIGNED_OFFSET-for-nv_drm_fops.f.patch new file mode 100644 index 00000000..09e2d99a --- /dev/null +++ b/6.12/misc/nvidia/0006-nvidia-drm-Set-FOP_UNSIGNED_OFFSET-for-nv_drm_fops.f.patch @@ -0,0 +1,95 @@ +From b03fe816d7b2675afdb4c1d10fe7658a5f2b2f82 Mon Sep 17 00:00:00 2001 +From: Rahul Rameshbabu +Date: Tue, 12 Nov 2024 15:01:16 -0800 +Subject: [PATCH 6/6] nvidia-drm: Set FOP_UNSIGNED_OFFSET for + nv_drm_fops.fop_flags if present + +Linux kernel commit 641bb4394f40 ("fs: move FMODE_UNSIGNED_OFFSET to +fop_flags") introduced a new .fop_flags define, FOP_UNSIGNED_OFFSET, for +struct file_operations. A check in drm_open_helper was added to ensure DRM +device drivers mark that all file offsets passed for working with DRM fs +nodes are unsigned values. If a DRM device driver fails to set this static +member, opening DRM device nodes (/dev/dri/card*) will fail. This commit +will land in Linux kernel v6.12. + +To ensure DRM clients will continue to function with kernel v6.12 and +above, set FOP_UNSIGNED_OFFSET for nv_drm_fops.fop_flags if +FOP_UNSIGNED_OFFSET is present in the linux kernel headers being built +against. Without doing so, userspace DRM clients will fail to function. An +example is being unable to launch Wayland compositors. + +KWin logs without this change: + kwin_core: Failed to open /dev/dri/card1 device (Invalid argument) + kwin_wayland_drm: failed to open drm device at "/dev/dri/card1" + kwin_core: Failed to open /dev/dri/card0 device (Invalid argument) + kwin_wayland_drm: failed to open drm device at "/dev/dri/card0" + kwin_wayland_drm: No suitable DRM devices have been found + +Linux kernel warning generated without this change: + [Oct 2 02:15] ------------[ cut here ]------------ + [ +0.000009] WARNING: CPU: 2 PID: 464 at drivers/gpu/drm/drm_file.c:312 drm_open_helper+0x134/0x150 + + [ +0.000108] Unloaded tainted modules: nvidia(OE):1 nvidia_modeset(OE):1 nvidia_drm(OE):1 [last unloaded: ttm] + [ +0.000024] CPU: 2 UID: 0 PID: 464 Comm: systemd-logind Tainted: G OE 6.12.0-rc1-next-20241001-sound+ #10 c8090f98b0209abebde89ba1e4c08c75331eef4d + [ +0.000016] Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE + [ +0.000004] Hardware name: System manufacturer PRIME Z390-A/PRIME Z390-A, BIOS 0224 08/14/2018 + [ +0.000005] RIP: 0010:drm_open_helper+0x134/0x150 + + [ +0.000005] Call Trace: + [ +0.000006] + [ +0.000004] ? drm_open_helper+0x134/0x150 + [ +0.000008] ? __warn.cold+0x93/0xf6 + [ +0.000011] ? drm_open_helper+0x134/0x150 + [ +0.000009] ? report_bug+0xff/0x140 + [ +0.000009] ? handle_bug+0x58/0x90 + [ +0.000010] ? exc_invalid_op+0x17/0x70 + [ +0.000010] ? asm_exc_invalid_op+0x1a/0x20 + [ +0.000018] ? drm_open_helper+0x134/0x150 + [ +0.000008] drm_open+0x73/0x110 + [ +0.000007] drm_stub_open+0x9b/0xd0 + [ +0.000009] chrdev_open+0xb0/0x230 + [ +0.000014] ? __pfx_chrdev_open+0x10/0x10 + [ +0.000011] do_dentry_open+0x14c/0x4a0 + [ +0.000013] vfs_open+0x2e/0xe0 + [ +0.000009] path_openat+0x82f/0x13f0 + [ +0.000016] do_filp_open+0xc4/0x170 + [ +0.000020] do_sys_openat2+0xae/0xe0 + [ +0.000010] __x64_sys_openat+0x55/0xa0 + [ +0.000009] do_syscall_64+0x82/0x190 + [ +0.000008] ? do_readlinkat+0xc5/0x180 + [ +0.000008] ? syscall_exit_to_user_mode+0x37/0x1c0 + [ +0.000010] ? do_syscall_64+0x8e/0x190 + [ +0.000007] ? do_sys_openat2+0x9c/0xe0 + [ +0.000009] ? syscall_exit_to_user_mode+0x37/0x1c0 + [ +0.000008] ? do_syscall_64+0x8e/0x190 + [ +0.000007] ? syscall_exit_to_user_mode+0x37/0x1c0 + [ +0.000007] ? do_syscall_64+0x8e/0x190 + [ +0.000006] ? do_syscall_64+0x8e/0x190 + [ +0.000007] entry_SYSCALL_64_after_hwframe+0x76/0x7e + [ +0.000012] RIP: 0033:0x7f90c1cec2e3 + + [ +0.000004] ---[ end trace 0000000000000000 ]--- + +Signed-off-by: Rahul Rameshbabu +--- + kernel-open/nvidia-drm/nvidia-drm-drv.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/kernel-open/nvidia-drm/nvidia-drm-drv.c b/kernel-open/nvidia-drm/nvidia-drm-drv.c +index 8cb94219..16f0d13e 100644 +--- a/kernel-open/nvidia-drm/nvidia-drm-drv.c ++++ b/kernel-open/nvidia-drm/nvidia-drm-drv.c +@@ -1711,6 +1711,10 @@ static const struct file_operations nv_drm_fops = { + .read = drm_read, + + .llseek = noop_llseek, ++ ++#if defined(FOP_UNSIGNED_OFFSET) ++ .fop_flags = FOP_UNSIGNED_OFFSET, ++#endif + }; + + static const struct drm_ioctl_desc nv_drm_ioctls[] = { +-- +2.47.0 + diff --git a/Files b/Files index 1594b39b..259f8043 100644 --- a/Files +++ b/Files @@ -531,9 +531,9 @@ │   │   ├── 0001-Make-modeset-and-fbdev-default-enabled.patch │   │   ├── 0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch │   │   ├── 0003-Add-IBT-Support.patch -│   │   ├── 0004-Fix-for-6.12.0-rc1-drm_mode_config_funcs.output_poll.patch -│   │   ├── 0006-silence-event-assert-until-570.patch -│   │   └── 0009-fix-hdmi-names.patch +│   │   ├── 0004-silence-event-assert-until-570.patch +│   │   ├── 0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch +│   │   └── 0006-nvidia-drm-Set-FOP_UNSIGNED_OFFSET-for-nv_drm_fops.f.patch │   └── sched │   ├── 0001-bore-cachy.patch │   ├── 0001-bore.patch