From: John Hubbard <jhubbard@nvidia.com>
To: airlied@redhat.com, Lyude Paul <lyude@redhat.com>,
Danilo Krummrich <dakr@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
nova-gpu@lists.linux.dev
Subject: Re: [PATCH v2 2/3] drm/nouveau: add option to leave GSP-capable GPUs to other drivers
Date: Mon, 23 Nov 2026 14:58:04 -0800 [thread overview]
Message-ID: <75df628a-fdc2-4cd2-b052-26b122d45251@nvidia.com> (raw)
In-Reply-To: <20261123-nova-nouveau-gsp-v2-2-5e8c27aa8555@redhat.com>
On 11/22/26 6:50 PM, Dave Airlie via B4 Relay wrote:
> From: Dave Airlie <airlied@redhat.com>
...
> +config DRM_NOUVEAU_BIND_GSP
> + bool "Make nouveau the default driver for GSP-capable GPUs"
> + depends on DRM_NOUVEAU
> + default y
> + help
> + Make nouveau bind to all NVIDIA GPUs by default, as it always
> + has.
> +
> + If another NVIDIA driver, such as nova-core, should claim the
> + GSP-capable (Turing and later) GPUs instead, say N here; nouveau
That seems fine. Being able to set a Kconfig and leave it alone is a
nice convenience for developers, and it also works for distros, so let's
just do it and call it a win.
Some comments below:
...
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 5e1336615cf6..582eb0c91b10 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -112,6 +112,11 @@ MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1
> static int nouveau_runtime_pm = -1;
> module_param_named(runpm, nouveau_runtime_pm, int, 0400);
>
> +MODULE_PARM_DESC(bind_gsp, "bind to GSP-capable (Turing and later) GPUs "
> + "(0 = leave them to other drivers, e.g. nova)");
> +static bool nouveau_bind_gsp = IS_ENABLED(CONFIG_DRM_NOUVEAU_BIND_GSP);
> +module_param_named(bind_gsp, nouveau_bind_gsp, bool, 0400);
> +
> static const struct drm_driver driver_legacy_kms;
> static const struct drm_driver driver_atomic_kms;
>
> @@ -881,7 +886,8 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
> /* We need to check that the chipset is supported before booting
> * fbdev off the hardware, as there's no way to put it back.
> */
> - ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug, &device);
> + ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug,
> + nouveau_bind_gsp, &device);
> if (ret)
> return ret;
>
> @@ -1460,6 +1466,7 @@ static void nouveau_display_options(void)
> DRM_DEBUG_DRIVER("... runpm : %d\n", nouveau_runtime_pm);
> DRM_DEBUG_DRIVER("... vram_pushbuf : %d\n", nouveau_vram_pushbuf);
> DRM_DEBUG_DRIVER("... hdmimhz : %d\n", nouveau_hdmimhz);
> + DRM_DEBUG_DRIVER("... bind_gsp : %d\n", nouveau_bind_gsp);
There are one too many spaces here: ^^^
...
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> index 625bb019736a..2439f0022443 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> @@ -3143,7 +3143,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
> const struct nvkm_device_quirk *quirk,
> struct device *dev, enum nvkm_device_type type, u64 handle,
> const char *name, const char *cfg, const char *dbg,
> - struct nvkm_device *device)
> + bool bind_gsp, struct nvkm_device *device)
> {
> struct nvkm_subdev *subdev;
> u64 mmio_base, mmio_size;
> @@ -3389,6 +3389,20 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
> goto done;
> }
>
> + /* Unless nouveau is the default NVIDIA driver, leave GSP-capable
> + * (Turing and later) PCI GPUs to other drivers, such as nova-core.
> + * Older GPUs are always bound.
Let's be extra clear and instead say "Pre-Turing GPUs are always bound."
...
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
> index eb4f43287796..6d82de5b4c8c 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
> @@ -329,9 +329,12 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
>
> tdev->gpu_speedo = tegra_sku_info.gpu_speedo_value;
> tdev->gpu_speedo_id = tegra_sku_info.gpu_speedo_id;
> + /* Platform devices are always bound, regardless of the bind_gsp
> + * policy for PCI devices.
> + */
> ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev,
> NVKM_DEVICE_TEGRA, pdev->id, NULL,
> - cfg, dbg, &tdev->device);
> + cfg, dbg, true, &tdev->device);
Minor point, but this is a good demonstration of why bools are such
a poor fit for function arguments: the calling side is completely opaque.
Also, it's awkward to pass global variables into function parameters.
So what to do? Instead, the policy can stay in the PCI area of the code,
since it applies only to PCI devices. So we can just track it in that
struct, like this (notice how the explanatory comment is no longer needed):
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h b/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h
index 075fe192b26f..6c2742f293c1 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/pci.h
@@ -7,6 +7,7 @@ struct nvkm_device_pci {
struct nvkm_device device;
struct pci_dev *pdev;
bool suspend;
+ bool bind_gsp;
};
int nvkm_device_pci_new(struct pci_dev *, const char *cfg, const char *dbg,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
index 2439f0022443..f1e85e8ac5be 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
@@ -25,6 +25,7 @@
#include "acpi.h"
#include <core/option.h>
+#include <core/pci.h>
#include <subdev/bios.h>
#include <subdev/therm.h>
@@ -3143,7 +3144,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
const struct nvkm_device_quirk *quirk,
struct device *dev, enum nvkm_device_type type, u64 handle,
const char *name, const char *cfg, const char *dbg,
- bool bind_gsp, struct nvkm_device *device)
+ struct nvkm_device *device)
{
struct nvkm_subdev *subdev;
u64 mmio_base, mmio_size;
@@ -3396,7 +3397,8 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
* Reject before subdevs are constructed, as that would already load
* GSP firmware for GPUs that are not going to be used.
*/
- if (device->func->pci && device->card_type >= TU100 && !bind_gsp) {
+ if (device->func->pci && device->card_type >= TU100 &&
+ !device->func->pci(device)->bind_gsp) {
nvdev_info(device, "leaving GSP-capable GPU to other drivers "
"(bind_gsp=0)\n");
ret = -ENODEV;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
index 735f6537273b..1e159a22a94c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c
@@ -1694,6 +1694,7 @@ nvkm_device_pci_new(struct pci_dev *pci_dev, const char *cfg, const char *dbg,
}
*pdevice = &pdev->device;
pdev->pdev = pci_dev;
+ pdev->bind_gsp = bind_gsp;
ret = nvkm_device_ctor(&nvkm_device_pci_func, quirk, &pci_dev->dev,
pci_is_pcie(pci_dev) ? NVKM_DEVICE_PCIE :
@@ -1703,7 +1704,7 @@ nvkm_device_pci_new(struct pci_dev *pci_dev, const char *cfg, const char *dbg,
pci_dev->bus->number << 16 |
PCI_SLOT(pci_dev->devfn) << 8 |
PCI_FUNC(pci_dev->devfn), name,
- cfg, dbg, bind_gsp, &pdev->device);
+ cfg, dbg, &pdev->device);
if (ret) {
nvkm_device_del(pdevice);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
index a462051d2977..d0c40f034244 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
@@ -54,7 +54,7 @@ int nvkm_device_ctor(const struct nvkm_device_func *,
const struct nvkm_device_quirk *,
struct device *, enum nvkm_device_type, u64 handle,
const char *name, const char *cfg, const char *dbg,
- bool bind_gsp, struct nvkm_device *);
+ struct nvkm_device *);
int nvkm_device_init(struct nvkm_device *);
int nvkm_device_fini(struct nvkm_device *, enum nvkm_suspend_state suspend);
#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
index 6d82de5b4c8c..eb4f43287796 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
@@ -329,12 +329,9 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
tdev->gpu_speedo = tegra_sku_info.gpu_speedo_value;
tdev->gpu_speedo_id = tegra_sku_info.gpu_speedo_id;
- /* Platform devices are always bound, regardless of the bind_gsp
- * policy for PCI devices.
- */
ret = nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev,
NVKM_DEVICE_TEGRA, pdev->id, NULL,
- cfg, dbg, true, &tdev->device);
+ cfg, dbg, &tdev->device);
if (ret) {
struct nvkm_device *device = &tdev->device;
thanks,
--
John Hubbard
next prev parent reply other threads:[~2026-11-23 22:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 2:50 [PATCH v2 0/3] nova/nouveau: add configs/module options to control binding behaviour (v2) Dave Airlie via B4 Relay
2026-11-23 2:50 ` [PATCH v2 1/3] drm/nouveau/nvkm: fix device leak on ctor failure Dave Airlie via B4 Relay
2026-11-23 3:14 ` sashiko-bot
2026-11-23 13:47 ` Danilo Krummrich
2026-11-23 2:50 ` [PATCH v2 2/3] drm/nouveau: add option to leave GSP-capable GPUs to other drivers Dave Airlie via B4 Relay
2026-11-23 2:58 ` sashiko-bot
2026-11-23 17:31 ` Timur Tabi
2026-11-23 21:11 ` David Airlie
2026-11-23 21:14 ` Danilo Krummrich
2026-11-23 22:47 ` John Hubbard
2026-11-23 21:16 ` Timur Tabi
2026-11-23 22:58 ` John Hubbard [this message]
2026-11-23 2:50 ` [PATCH v2 3/3] nova-core: only bind to GPUs when explicitly requested Dave Airlie via B4 Relay
2026-11-23 2:55 ` sashiko-bot
2026-11-23 15:18 ` Danilo Krummrich
2026-11-23 16:53 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75df628a-fdc2-4cd2-b052-26b122d45251@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=acourbot@nvidia.com \
--cc=airlied@redhat.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=nova-gpu@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox