Skip to content

Commit

Permalink
nvidia-dkms: Fix compilation for 6.12 kernel
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Naim <[email protected]>
  • Loading branch information
1Naim committed Oct 3, 2024
1 parent 4808bf5 commit b6da5d8
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 94 deletions.
6 changes: 3 additions & 3 deletions nvidia/nvidia-utils/.SRCINFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pkgbase = nvidia-utils
pkgver = 560.35.03
pkgrel = 8
pkgrel = 9
url = http://www.nvidia.com/
arch = x86_64
license = custom
Expand All @@ -15,7 +15,7 @@ pkgbase = nvidia-utils
source = https://us.download.nvidia.com/XFree86/Linux-x86_64/560.35.03/NVIDIA-Linux-x86_64-560.35.03.run
source = 0001-Make-modeset-and-fbdev-default-enabled.patch
source = 0004-6.11-Add-fix-for-fbdev.patch
source = 0005-6.12-drm_outpull_pill-changed-check.patch
source = 0006-Fix-for-6.12.0-rc1-drm_mode_config_funcs.output_poll.patch
source = limit-vram-buffer
sha512sums = de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc5067748acf9afd66a3269a6e323461356592fdfc624c86523bf105ff8fe47d3770
sha512sums = 4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499
Expand All @@ -26,7 +26,7 @@ pkgbase = nvidia-utils
sha512sums = 97137160b64928ff84fd6145a0ebc209c045d6a07ccc53ec6df6ba1fda2ad72038eda7ecdc0a0178a2628aa4e18819a9b3ff3b693b22bdc9de543be0a968f8aa
sha512sums = 4090db2d9f2547b830619c5c9c378783367955d080c447e8b09e87adc8848083a7749c8a5ab2bdbada27c7bd54e472a88e612bdb517c5a55afbfd81fd1f29666
sha512sums = d37aa56ed937c596340106138a80c38ef5cc703cdc270dea6189fda20bcf369b11badd662bd0c0799ec1282428ca64d3dc137289fa1951905a10fd4cba6dd9b0
sha512sums = d4551ab9f653fbd919ef43b2bc8dbc5e0eb7ea9ce342dcb71beb666842d1d7543ff396dadb532c2a16aaa4f7d5e34c3201ae4d8f4c290267e4fc6b63be1c0cc2
sha512sums = cb4c55f7d9aeac38cf583521bc8781bcffe6026658f9981a7bb6e2749a7668c620b7fdd3cdd32b50e27da0924572ffe36870070d82bb5c620d04adfc6e3900a3
sha512sums = 7f578c4bc6ebf4694c0bd81f30aee3510910088f9eea2c49128c9b3039b4d2ce69453f1b2baf2e1639ad0c51452af744c4767fb4cc1706f072b7e09d7ac6c735

pkgname = nvidia-utils
Expand Down
87 changes: 0 additions & 87 deletions nvidia/nvidia-utils/0005-6.12-drm_outpull_pill-changed-check.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
From ae68c52742d420cc6b1dcd9cf93f436596a26687 Mon Sep 17 00:00:00 2001
From: Peter Jung <[email protected]>
Date: Wed, 2 Oct 2024 15:48:32 +0200
Subject: [PATCH] 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 <[email protected]>
---
kernel-open/nvidia-drm/nvidia-drm-drv.c | 48 +++++++++++++++++++++++++
1 file changed, 48 insertions(+)

diff --git a/kernel-open/nvidia-drm/nvidia-drm-drv.c b/kernel-open/nvidia-drm/nvidia-drm-drv.c
index 50028c26..d28b33a9 100644
--- a/kernel-open/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel-open/nvidia-drm/nvidia-drm-drv.c
@@ -100,6 +100,11 @@
#include <drm/drm_atomic_helper.h>
#endif

+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+#include <drm/drm_client.h>
+#endif
+
static int nv_drm_revoke_modeset_permission(struct drm_device *dev,
struct drm_file *filep,
NvU32 dpyId);
@@ -206,7 +211,13 @@ 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)
@@ -1569,6 +1580,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[] = {
@@ -1777,6 +1792,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.
@@ -1866,8 +1895,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.rc0

8 changes: 4 additions & 4 deletions nvidia/nvidia-utils/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
pkgbase=nvidia-utils
pkgname=('nvidia-utils' 'opencl-nvidia' 'nvidia-dkms')
pkgver=560.35.03
pkgrel=8
pkgrel=9
arch=('x86_64')
url="http://www.nvidia.com/"
license=('custom')
Expand All @@ -22,7 +22,7 @@ source=('nvidia-drm-outputclass.conf'
"https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/${_pkg}.run"
0001-Make-modeset-and-fbdev-default-enabled.patch
0004-6.11-Add-fix-for-fbdev.patch
0005-6.12-drm_outpull_pill-changed-check.patch
0006-Fix-for-6.12.0-rc1-drm_mode_config_funcs.output_poll.patch
limit-vram-buffer)
sha512sums=('de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc5067748acf9afd66a3269a6e323461356592fdfc624c86523bf105ff8fe47d3770'
'4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499'
Expand All @@ -33,7 +33,7 @@ sha512sums=('de7116c09f282a27920a1382df84aa86f559e537664bb30689605177ce37dc50677
'97137160b64928ff84fd6145a0ebc209c045d6a07ccc53ec6df6ba1fda2ad72038eda7ecdc0a0178a2628aa4e18819a9b3ff3b693b22bdc9de543be0a968f8aa'
'4090db2d9f2547b830619c5c9c378783367955d080c447e8b09e87adc8848083a7749c8a5ab2bdbada27c7bd54e472a88e612bdb517c5a55afbfd81fd1f29666'
'd37aa56ed937c596340106138a80c38ef5cc703cdc270dea6189fda20bcf369b11badd662bd0c0799ec1282428ca64d3dc137289fa1951905a10fd4cba6dd9b0'
'd4551ab9f653fbd919ef43b2bc8dbc5e0eb7ea9ce342dcb71beb666842d1d7543ff396dadb532c2a16aaa4f7d5e34c3201ae4d8f4c290267e4fc6b63be1c0cc2'
'cb4c55f7d9aeac38cf583521bc8781bcffe6026658f9981a7bb6e2749a7668c620b7fdd3cdd32b50e27da0924572ffe36870070d82bb5c620d04adfc6e3900a3'
'7f578c4bc6ebf4694c0bd81f30aee3510910088f9eea2c49128c9b3039b4d2ce69453f1b2baf2e1639ad0c51452af744c4767fb4cc1706f072b7e09d7ac6c735')


Expand All @@ -53,7 +53,7 @@ prepare() {
bsdtar -xf nvidia-persistenced-init.tar.bz2
patch -Np1 < ../0001-Make-modeset-and-fbdev-default-enabled.patch
patch -Np1 < ../0004-6.11-Add-fix-for-fbdev.patch
patch -Np1 < ../0005-6.12-drm_outpull_pill-changed-check.patch
patch -Np2 -i $srcdir/0006-Fix-for-6.12.0-rc1-drm_mode_config_funcs.output_poll.patch -d kernel/

echo "Applying nvidia-patch..."

Expand Down

0 comments on commit b6da5d8

Please sign in to comment.