[PATCH v2 0/5] gpu: nova-core: run unload sequence upon unbinding
From: Alexandre Courbot
Date: Tue Apr 21 2026 - 02:19:40 EST
Currently the GSP is left running and the WPR2 memory region untouched
when the driver is unbound. This is obviously not ideal for at least two
reasons:
- Probing requires setting up the WPR2 region, which cannot be done if
there is already one in place. Hence the current requirement to reset
the GPU (using e.g. `echo 1 >/sys/bus/pci/devices/.../reset`) before
the driver can be probed again after removal.
- The running GSP may still attempt to access shared memory regions
which the kernel might recycle.
On top of that, there is a nasty bug in the Blackwell VBIOS that
sometimes borks the GPU upon PCI reset, requiring a reboot. So relying
on the PCI reset to unload/reload Nova is really not practical here.
This series does the necessary to leave the GPU in a clean state after
unbind, for all currently supported GPUs. Blackwell support is trivial
and will be added alongside the Blackwell series [1] if this can be
merged first.
The first patch adds a `warn_on_err` utility macro to the kernel crate
as it is useful to warn on failures in the driver unbind path, but I can
remove it if it is not deemed useful.
This series applies cleanly on `master` as of today.
[1] https://lore.kernel.org/all/20260411024953.473149-1-jhubbard@xxxxxxxxxx/
Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
---
Changes in v2:
- Rebase on top of `master` and remove unneeded/obsolete preparatory patches.
- Tidy up the imports of commands from the `fw` module in the `gsp` module.
- Link to v1: https://patch.msgid.link/20251216-nova-unload-v1-0-6a5d823be19d@xxxxxxxxxx
---
Alexandre Courbot (5):
rust: add warn_on_err macro
gpu: nova-core: use warn_on_err macro
gpu: nova-core: do not import firmware commands into GSP command module
gpu: nova-core: send UNLOADING_GUEST_DRIVER GSP command upon unloading
gpu: nova-core: run Booter Unloader and FWSEC-SB upon unbinding
drivers/gpu/nova-core/firmware/booter.rs | 1 -
drivers/gpu/nova-core/firmware/fwsec.rs | 1 -
drivers/gpu/nova-core/gpu.rs | 21 ++++--
drivers/gpu/nova-core/gsp/boot.rs | 83 +++++++++++++++++++++++
drivers/gpu/nova-core/gsp/commands.rs | 60 ++++++++++++----
drivers/gpu/nova-core/gsp/fw.rs | 4 ++
drivers/gpu/nova-core/gsp/fw/commands.rs | 23 +++++++
drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs | 8 +++
drivers/gpu/nova-core/regs.rs | 5 ++
rust/kernel/bug.rs | 10 +++
10 files changed, 197 insertions(+), 19 deletions(-)
---
base-commit: b4e07588e743c989499ca24d49e752c074924a9a
change-id: 20251216-nova-unload-4029b3b76950
Best regards,
--
Alexandre Courbot <acourbot@xxxxxxxxxx>