Skip to content

gpu: nova-core: merge `load` and `boot` for falcons, add load+exec handlers

Eliot Courtney dri-devel lkml nova-gpu 1 version In review

Get series with b4
b4 am [email protected] change-id 20261130-falcon-adc42c387291

Versions newest first

  1. v1 Latest14 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14gpu: nova-core: falcon: program BROM and BOOTVEC in `boot`drivers/gpu/nova-core/falcon.rs drivers/gpu/nova-core/firmware/booter.rs drivers/gpu/nova-core/firmware/fwsec.rs +2 more+25 -280 replies
2/14gpu: nova-core: use correct offset for imem in `BooterFirmware`drivers/gpu/nova-core/firmware/booter.rs+1 -10 replies
3/14gpu: nova-core: remove some dependencies on FalconDmaLoadTargetdrivers/gpu/nova-core/firmware/fwsec/bootloader.rs drivers/gpu/nova-core/firmware/gen_bootloader.rs+39 -530 replies
4/14gpu: nova-core: falcon: separate staging data for DMA from its locationdrivers/gpu/nova-core/falcon.rs+77 -510 replies
5/14gpu: nova-core: falcon: add `FalconImage` for `FalconFirmware` traitdrivers/gpu/nova-core/falcon.rs drivers/gpu/nova-core/firmware.rs drivers/gpu/nova-core/firmware/booter.rs +2 more+233 -3850 replies
6/14gpu: nova-core: falcon: load the firmware image in Falcon::bootdrivers/gpu/nova-core/falcon.rs drivers/gpu/nova-core/firmware/booter.rs drivers/gpu/nova-core/firmware/fwsec.rs +2 more+5 -100 replies
7/14gpu: nova-core: firmware: use `zerocopy` for `BootloaderDmemDescV2`drivers/gpu/nova-core/firmware/gen_bootloader.rs+3 -61 reply
8/14gpu: nova-core: falcon: factor out the wait for the GSP suspenddrivers/gpu/nova-core/falcon/gsp.rs drivers/gpu/nova-core/gsp/boot.rs+16 -71 reply
9/14gpu: nova-core: gsp: factor out the core resumedrivers/gpu/nova-core/gsp.rs drivers/gpu/nova-core/gsp/load_exec.rs drivers/gpu/nova-core/gsp/sequencer.rs+80 -341 reply
10/14gpu: nova-core: gsp: fix resume_gsp_rm()'s error messagesdrivers/gpu/nova-core/gsp/load_exec.rs+6 -20 replies
11/14gpu: nova-core: falcon: select the BAR2 engine ID for framebuffer DMAdrivers/gpu/nova-core/falcon.rs drivers/gpu/nova-core/regs.rs+28 -112 replies
12/14gpu: nova-core: gsp: add the r000 load-and-execute HS binary handlerdrivers/gpu/nova-core/falcon.rs drivers/gpu/nova-core/gsp/load_exec.rs drivers/gpu/nova-core/sbuffer.rs+223 -72 replies
13/14gpu: nova-core: gsp: add the r000 load-and-execute bootloader handlerdrivers/gpu/nova-core/firmware/gen_bootloader.rs drivers/gpu/nova-core/gsp/load_exec.rs+141 -12 replies
14/14gpu: nova-core: gsp: add the load-and-execute event dispatcherdrivers/gpu/nova-core/gsp/load_exec.rs+81 -31 reply

Reviews trailers per patch

11 of 14 patches have a Reviewed-by or Acked-by.

PatchAlexandre CourbotEliot Courtney
1/14R-b
2/14R-b
3/14R-b
4/14R-b
5/14R-b
6/14R-b
7/14R-b
8/14R-b R-b
9/14R-b
10/14R-b
11/14
12/14R-b
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] gpu: nova-core: merge `load` and `boot` for falcons, add load+exec handlers

This combines my falcon load/boot rework (patches 1-6) with John's r000 load+exec handlers [1] (patches 8-14). Patch 7 is a small prep patch for John's patches.

Currently, loading the firmware and booting it is split into two separate steps. Load is always called in combination with boot. Rewrite the process to basically look like:

falcon.boot(<the firmware you want>, ...)

Additionally, add a segment source for firmware already in the framebuffer (this is for HS binaries).

This simplifies running HS binaries in the r000 load+exec boot process [1], because they can be treated as falcon firmware binaries directly, without having to call into the guts of the boot process code + make fns like dma_wr public.

This is not a pure refactor, with this dma_load uses two Coherents (one for imem, one for dmem) instead of one. The extra Coherent is a consequence of splitting the storage vs transfer method more orthogonally. I don't think it's consequential but jfyi.

Tested boot on TU104, GA104, AD106 and GB205.

This is based on drm-rust-next.

[1]: https://lore.kernel.org/[email protected]

John's cover letter for patches 8-14, trimmed to what still applies:

Quoted 45 lines

This series adds the code that runs a falcon binary on behalf of the r000 GSP-RM during boot. It is the next part of the r000 GSP firmware series [2], which moves nova-core onto the GSP firmware of the r615 and later releases. The patches do not depend on the switch to r000, so they are posted on their own, in order to make the rest of that series smaller. With these applied, the driver still boots the r570 firmware.

Some background (perhaps a refresher for some readers): the GSP falcon has two cores, a falcon core and a RISC-V core, and only one of the two is active at a time. GSP-RM runs on the RISC-V core.

During boot, the r000 GSP-RM requires a binary to run on the falcon core. GSP-RM raises a load-and-execute event and suspends the RISC-V core. The driver then resets the GSP falcon, loads and runs the binary, and resumes GSP-RM. There are two such events:

* On GA102 and later, the binary is a Heavy-Secured (HS) binary that GSP-RM has placed in the framebuffer.

* On Turing and GA100, the binary is an image that the generic falcon bootloader loads. The event carries a descriptor of the image.

The series adds a handler for each of the two events, and a dispatcher that selects the handler from the command ID of an event. The handlers share steps with code that the driver already has, so the series first factors those steps out:

* the wait for the GSP suspend, out of the shutdown path
* the core resume, out of the CPU sequencer

The only change in what the driver does with the r570 firmware is a slight change in the appearance of two error messages (mentioned below).

Changes since v3 of the r000 series. The two handlers and the dispatcher come from v3 patches 15, 17 and 18:

* GSP-RM is now resumed with the core resume of the CPU sequencer.

* Typesafe handler code: a handler receives its decoded parameters, and the dispatcher decodes the payload of the event, instead of using two raw byte slices to describe the payload.

* The selection of the BAR2 engine ID is now introduced in a separate, small patch.

Quoted 7 lines

* Fixed two error messages in GSP-RM resume.

An LLM coding assistant (Claude Code) helped write every patch, and drafted the commit messages and this letter, all of which I've edited by hand afterwards.

[2] https://lore.kernel.org/all/[email protected]/

---
Changes since boot-rework2 v2 and John's v1 [1]:
- Merge the two series into one (Alex)
- Add a comment on V2-only bootloader-loaded FWSEC in patch #3 (Alex)
- Add patch #7, which derives the zerocopy traits for
BootloaderDmemDescV2
- Drop John's 1/9 (in drm-rust-next as 002b9422b314) and 3/9 (patch #1
programs BROM and BOOTVEC in boot)
- Rework John's patches on top of patches #1-#6
- Link to boot-rework2 v2: https://patch.msgid.link/[email protected]

---
Eliot Courtney (7):
gpu: nova-core: falcon: program BROM and BOOTVEC in boot
gpu: nova-core: use correct offset for imem in BooterFirmware
gpu: nova-core: remove some dependencies on FalconDmaLoadTarget
gpu: nova-core: falcon: separate staging data for DMA from its location
gpu: nova-core: falcon: add FalconImage for FalconFirmware trait
gpu: nova-core: falcon: load the firmware image in Falcon::boot
gpu: nova-core: firmware: use zerocopy for BootloaderDmemDescV2

John Hubbard (7):
gpu: nova-core: falcon: factor out the wait for the GSP suspend
gpu: nova-core: gsp: factor out the core resume
gpu: nova-core: gsp: fix resume_gsp_rm()'s error messages
gpu: nova-core: falcon: select the BAR2 engine ID for framebuffer DMA
gpu: nova-core: gsp: add the r000 load-and-execute HS binary handler
gpu: nova-core: gsp: add the r000 load-and-execute bootloader handler
gpu: nova-core: gsp: add the load-and-execute event dispatcher

 drivers/gpu/nova-core/falcon.rs                    | 451 ++++++++----------
 drivers/gpu/nova-core/falcon/gsp.rs                |  15 +
 drivers/gpu/nova-core/firmware.rs                  |  74 +--
 drivers/gpu/nova-core/firmware/booter.rs           | 120 ++---
 drivers/gpu/nova-core/firmware/fwsec.rs            |  57 ++-
 drivers/gpu/nova-core/firmware/fwsec/bootloader.rs |  50 +-
 drivers/gpu/nova-core/firmware/gen_bootloader.rs   | 112 ++---
 drivers/gpu/nova-core/gsp.rs                       |   1 +
 drivers/gpu/nova-core/gsp/boot.rs                  |   8 +-
 drivers/gpu/nova-core/gsp/hal/tu102.rs             |   9 +-
 drivers/gpu/nova-core/gsp/load_exec.rs             | 511 +++++++++++++++++++++
 drivers/gpu/nova-core/gsp/sequencer.rs             |  42 +-
 drivers/gpu/nova-core/regs.rs                      |   2 +
 drivers/gpu/nova-core/sbuffer.rs                   |   1 -
 14 files changed, 906 insertions(+), 547 deletions(-)

---
base-commit: abfb640b2374e26de8ff81d488c39d8254db538e
change-id: 20261130-falcon-adc42c387291

Best regards,

Signature · 1 line
Eliot Courtney <[email protected]>