[PATCH v4 00/17] nova-core: GPU interrupt support and GSP event delivery

John Hubbard posted 17 patches 1 week, 6 days ago
Documentation/gpu/nova/core/interrupts.rst  | 674 ++++++++++++++++++++
Documentation/gpu/nova/index.rst            |   1 +
drivers/gpu/nova-core/Kconfig               |   5 +
drivers/gpu/nova-core/driver.rs             |  18 +-
drivers/gpu/nova-core/falcon/gsp.rs         |  73 ++-
drivers/gpu/nova-core/falcon/hal.rs         | 124 +++-
drivers/gpu/nova-core/falcon/hal/ga102.rs   |  21 +-
drivers/gpu/nova-core/falcon/hal/tu102.rs   |  36 +-
drivers/gpu/nova-core/gpu.rs                |  85 ++-
drivers/gpu/nova-core/gsp.rs                |   2 +-
drivers/gpu/nova-core/gsp/cmdq.rs           | 260 ++++++--
drivers/gpu/nova-core/gsp/commands.rs       |   8 +-
drivers/gpu/nova-core/gsp/sequencer.rs      |   8 +-
drivers/gpu/nova-core/irq.rs                | 149 +++++
drivers/gpu/nova-core/irq/doorbell_test.rs  | 266 ++++++++
drivers/gpu/nova-core/irq/gsp.rs            | 236 +++++++
drivers/gpu/nova-core/irq/hal.rs            | 154 +++++
drivers/gpu/nova-core/irq/hal/gh100.rs      |  28 +
drivers/gpu/nova-core/irq/hal/tu102.rs      |  28 +
drivers/gpu/nova-core/irq/interrupt_tree.rs | 625 ++++++++++++++++++
drivers/gpu/nova-core/irq/regs.rs           |  87 +++
drivers/gpu/nova-core/nova_core.rs          |   1 +
drivers/gpu/nova-core/regs.rs               |  69 ++
rust/kernel/pci/irq.rs                      |  68 +-
rust/kernel/sync/completion.rs              |  23 +-
25 files changed, 2905 insertions(+), 144 deletions(-)
create mode 100644 Documentation/gpu/nova/core/interrupts.rst
create mode 100644 drivers/gpu/nova-core/irq.rs
create mode 100644 drivers/gpu/nova-core/irq/doorbell_test.rs
create mode 100644 drivers/gpu/nova-core/irq/gsp.rs
create mode 100644 drivers/gpu/nova-core/irq/hal.rs
create mode 100644 drivers/gpu/nova-core/irq/hal/gh100.rs
create mode 100644 drivers/gpu/nova-core/irq/hal/tu102.rs
create mode 100644 drivers/gpu/nova-core/irq/interrupt_tree.rs
create mode 100644 drivers/gpu/nova-core/irq/regs.rs
[PATCH v4 00/17] nova-core: GPU interrupt support and GSP event delivery
Posted by John Hubbard 1 week, 6 days ago
This series adds support for GIN, the GPU Interrupt and Notification
unit, which is the GPU's interrupt controller, so that GSP events reach
the driver as interrupts rather than only when the driver polls for
them.

The handler is threaded. The top half touches only GPU registers, and
the IRQ thread drains the GSP-to-CPU message queue.

This is based on drm-rust-next at d669686f8170 ("gpu: nova-core: mm: Add
BAR1 memory management self-tests"), which now includes the PRAMIN and
BAR1 memory management series from Joel and Eliot. The PRAMIN series
brought the NOVA_CORE_SELFTESTS option and the assertion macros for
probe-time hardware tests, and the interrupt self-test uses both.

Patches 7, 11 and 13 are new, so v4 has 17 patches where v3 had 14.

Changes in v4, at a high level:

* Rebased onto the current drm-rust-next.

* The comments, doc comments and commit messages are rewritten across
  the series, and the design document is reworked.

* A GSP fault no longer hangs the CPU. The top half reads the falcon
  causes back after clearing them, and disables the GSP vector instead
  of retriggering the falcon when one is still set.

* The self-test allocates its own vectors and runs from probe, after
  the GFW boot wait, which a new patch moves out of the Gpu
  constructor. It shares the NOVA_CORE_SELFTESTS option and the
  assertion macros with the memory management tests.

* A GSP message of the wrong type returns ENOMSG instead of ERANGE, in
  a new patch.

* Three pieces moved out of the SWGEN0 patch: the GSP queue drain to a
  new patch, a SubtreeSet method to patch 3, and the falcon interrupt
  HAL to patch 14. The SWGEN0 patch now carries only the handler and
  its registration.

There is a git branch with the patches as applied to drm-rust-next:

    https://github.com/johnhubbard/linux/tree/nova-core-gin-interrupt-tree-v4/

The branch also carries two small bindgen warning fixes of mine below
the series. They are not part of it.

Changes in v4, in more detail:

* I rewrote the comments, doc comments and commit messages across
  patches 3 through 17, and reworked patch 17's design document.

* Rebased onto the current drm-rust-next. Coherent DMA allocations are
  tied to the device's bound lifetime there, so Cmdq and Gsp carry a
  lifetime parameter and the GSP event handler borrows a Cmdq<'_>.

* Patch 6 has Tree::new() take a &SubtreeVectors, rather than the MSI
  type and the serviced subtrees that its callers were unpacking from
  one. (Alex)

* Patch 7 is new. It moves the wait for the GPU's own firmware from the
  Gpu constructor out to the PCI probe, so that patch 8's self-test can
  run from probe as the memory management self-tests do. The interrupt
  self-test runs after that wait and before the GSP boot that the
  constructor does, while the memory tests run after it. (Alex)

* Patch 8 uses NOVA_CORE_SELFTESTS and the selftest_assert macros
  instead of its own Kconfig option. The memory management tests and
  the interrupt test share the option but not the failure behavior: a
  failed interrupt delivery test fails the PCI probe, while a PRAMIN or
  BAR1 failure only logs. The option's help text says so. (Alex)

* Patch 8 also allocates the vectors for the doorbell's own subtree and
  releases them, instead of borrowing the driver's allocation for the
  GSP subtree, which worked only because both vectors are in subtree 2.
  It registers as "nova-core-selftest". Every supported chip has the
  doorbell at the same vector, so the test names it without asking
  GSP-RM. (Alex)

* Patch 9 renames classify_event() to log_event(). The function only
  logs, and never returns the classification that the old name
  promised.

* Patch 10 warns when a GSP message is too short to decode as the
  expected type. (Alex, Gary)

* Patch 11 is new: a message of the wrong type now returns ENOMSG
  instead of ERANGE, which says nothing about a message. Two retry
  loops still matched ERANGE, so the patch converts them to keep GSP
  boot working. Patch 12 removes both loops. (Gary, Alex)

* Patch 12 refactors the deadline loop into one place, and drops a
  reference to a private method from the public documentation. (Alex)

* Patch 13 is new, and carries the GSP message queue drain that v3
  added inside the SWGEN0 patch. (Alex)

* Patch 14 carries the falcon interrupt HAL that v3 put in the SWGEN0
  patch, as a HAL now rather than two functions matching on chipset.
  It is separate from the falcon boot HAL, which the top half cannot
  reach without allocating. (Alex)

* Patch 15 fixes the interrupt storm. IRQSCLR does not end a cause
  driven from outside the falcon, so v3's retrigger re-emitted it at
  once. The top half now reads the causes back after the clear, and
  disables the GSP vector instead of retriggering when one is still
  set. (Sashiko reported it. I have not reproduced it.)

* Patch 15 also returns the host-routed causes as a typed IRQSTAT value,
  and replaces the module-wide expect(dead_code) with a per-item
  cfg_attr on the items that the off-by-default self-test leaves dead.

* Patch 16 tests both falcon interrupt properties through the new HAL.

Will, I kept your Reviewed-by on patches 4, 5 and 6. I dropped it from
the rest, because the comments changed everywhere and patches 8, 14,
15, 16 and 17 changed in substance. Patch 15 is the one I would ask you
to look at first: its top half can now disable the GSP vector instead
of retriggering the falcon.

TESTING: to fill in after the test run. v3 was tested on Turing
(TU117), Ampere (GA104) and Blackwell (GB202), covering probe and
chipset identification, the interrupt self-test, a GSP name query over
the command queue, driver unload/reload, and the KUnit suites. I have
not produced a GSP fault on any of them, so the new fault path is
untested.

Joel Fernandes (2):
  rust: sync: completion: add wait_for_completion_timeout()
  gpu: nova-core: add the GIN interrupt tree and allocate its vectors

John Hubbard (15):
  rust: pci: declare IrqType and IrqTypes with impl_flags
  gpu: nova-core: add the GIN vector, leaf and subtree types
  gpu: nova-core: add the GIN CPU interrupt tree and MSI EOI registers
  gpu: nova-core: add the per-architecture GIN CPU interrupt HAL
  gpu: nova-core: wait for GFW boot in probe, not in the Gpu constructor
  gpu: nova-core: add an interrupt delivery self-test
  gpu: nova-core: log GSP events instead of discarding them
  gpu: nova-core: stop re-parsing a bad GSP message
  gpu: nova-core: return ENOMSG for an unmatched GSP message
  gpu: nova-core: bound a GSP wait by a single deadline
  gpu: nova-core: add a GSP message queue drain
  gpu: nova-core: add the falcon interrupt registers and their HAL
  gpu: nova-core: service GSP events from the SWGEN0 interrupt
  gpu: nova-core: add KUnit tests for the interrupt tree and HALs
  gpu: nova-core: document the GIN interrupt controller and GSP events

 Documentation/gpu/nova/core/interrupts.rst  | 674 ++++++++++++++++++++
 Documentation/gpu/nova/index.rst            |   1 +
 drivers/gpu/nova-core/Kconfig               |   5 +
 drivers/gpu/nova-core/driver.rs             |  18 +-
 drivers/gpu/nova-core/falcon/gsp.rs         |  73 ++-
 drivers/gpu/nova-core/falcon/hal.rs         | 124 +++-
 drivers/gpu/nova-core/falcon/hal/ga102.rs   |  21 +-
 drivers/gpu/nova-core/falcon/hal/tu102.rs   |  36 +-
 drivers/gpu/nova-core/gpu.rs                |  85 ++-
 drivers/gpu/nova-core/gsp.rs                |   2 +-
 drivers/gpu/nova-core/gsp/cmdq.rs           | 260 ++++++--
 drivers/gpu/nova-core/gsp/commands.rs       |   8 +-
 drivers/gpu/nova-core/gsp/sequencer.rs      |   8 +-
 drivers/gpu/nova-core/irq.rs                | 149 +++++
 drivers/gpu/nova-core/irq/doorbell_test.rs  | 266 ++++++++
 drivers/gpu/nova-core/irq/gsp.rs            | 236 +++++++
 drivers/gpu/nova-core/irq/hal.rs            | 154 +++++
 drivers/gpu/nova-core/irq/hal/gh100.rs      |  28 +
 drivers/gpu/nova-core/irq/hal/tu102.rs      |  28 +
 drivers/gpu/nova-core/irq/interrupt_tree.rs | 625 ++++++++++++++++++
 drivers/gpu/nova-core/irq/regs.rs           |  87 +++
 drivers/gpu/nova-core/nova_core.rs          |   1 +
 drivers/gpu/nova-core/regs.rs               |  69 ++
 rust/kernel/pci/irq.rs                      |  68 +-
 rust/kernel/sync/completion.rs              |  23 +-
 25 files changed, 2905 insertions(+), 144 deletions(-)
 create mode 100644 Documentation/gpu/nova/core/interrupts.rst
 create mode 100644 drivers/gpu/nova-core/irq.rs
 create mode 100644 drivers/gpu/nova-core/irq/doorbell_test.rs
 create mode 100644 drivers/gpu/nova-core/irq/gsp.rs
 create mode 100644 drivers/gpu/nova-core/irq/hal.rs
 create mode 100644 drivers/gpu/nova-core/irq/hal/gh100.rs
 create mode 100644 drivers/gpu/nova-core/irq/hal/tu102.rs
 create mode 100644 drivers/gpu/nova-core/irq/interrupt_tree.rs
 create mode 100644 drivers/gpu/nova-core/irq/regs.rs


base-commit: d669686f8170c234edf12212fac9180ea18b1448
prerequisite-patch-id: 2e07fc4124e1e822f2a4eedf3e814f7e438a6afd
prerequisite-patch-id: 826e07a6bce50fa20188b01e9817fac0c7b6797c
-- 
2.55.0
Re: [PATCH v4 00/17] nova-core: GPU interrupt support and GSP event delivery
Posted by Alexandre Courbot 4 days, 5 hours ago
On Sat Sep 12, 2026 at 1:43 PM JST, John Hubbard wrote:
> This series adds support for GIN, the GPU Interrupt and Notification
> unit, which is the GPU's interrupt controller, so that GSP events reach
> the driver as interrupts rather than only when the driver polls for
> them.
>
> The handler is threaded. The top half touches only GPU registers, and
> the IRQ thread drains the GSP-to-CPU message queue.
>
> This is based on drm-rust-next at d669686f8170 ("gpu: nova-core: mm: Add
> BAR1 memory management self-tests"), which now includes the PRAMIN and
> BAR1 memory management series from Joel and Eliot. The PRAMIN series
> brought the NOVA_CORE_SELFTESTS option and the assertion macros for
> probe-time hardware tests, and the interrupt self-test uses both.

The design is... halfway there. The bottom parts look mostly ok now, but
the top types are inflexible (a hardcoded set of interrupt vectors known
at probe-time, without a realistic possibility of adding/removing
handlers dynamically), confusingly separated, still not integrated into
the command queue which keeps polling by the end of the series (with the
IRQ handler only draining messages into oblivion), and in the end with
all this machinery we realistically cannot handle more than one IRQ
anyway due to the fact that dropping a top enable guard disables all the
leaves from that subtree.

It is also becoming a bit tedious to describe the architecture through
comments and I'd rather hack the bits that need fixing directly, which
would be a much more efficient use of my time. The HAL patch still doing
ad-hoc matches on the chipset despite my v3 comments consolidates that
impression.

So my hope is that we can we move forward and merge a v5 or v6 as a MVP
for the self-tests and GSP interrupt, and I'll follow-up with the fixes
I want on top.