This patchset adds the remaining support required for booting the GSP on
Turing.

Since the conditions for using PIO vs DMA for loading the firmware
weren't totally clear, we dug deeper into the issue with Timur and ran
tests to find out why things are as they are.

The capabilities and constraints are as follow:

- All chips supported by Nova, including Turing, can load firmware using
  DMA (although PIO is preferred for chips < GA102).
- PIO registers are masked to the CPU from GA102 onwards. Thus PIO as a
  loading method is only usable on Turing and GA100.
- The FWSEC firmware on Turing needs to be loaded by a bootloader with
  an explicit start tag. Start tags can only be explicitly mentioned
  when using PIO, which is thus the only method by which the bootloader
  can be loaded.
- Any firmware loadable by DMA is also loadable by PIO.

These observations orient the direction of the code in this revision.
Notably, the usable loading methods of each firmware are expressed by
implementing the traits `FalconDmaLoadable` and `FalconPioLoadable`.

The bootloader-enabled FWSEC firmware is now a wrapper type that
includes the regular, DMA-loaded FWSEC firmware (which is still loaded
using DMA, only by the bootloader), and the bootloader that needs to be
loaded using PIO. This new structure only implements
`FalconPioLoadable`.

All other firmwares implement `FalconDmaLoadable`, which provides a
method to try and provide a `FalconPioLoadable` proxy. This method is
fallible because some of the PIO types are smaller than the DMA ones,
and such conversions must be fallible.

Since this adds code that is limited to Turing and will likely never be
useful for any other chip, we tried to isolate it into its own modules.

This series is based on -next and should apply cleanly on
`drm-rust-next` after -rc1 is tagged. A tree with all the patches is
available at [1].

[1] https://github.com/Gnurou/linux/tree/b4/turing_prep

Signed-off-by: Alexandre Courbot <[email protected]>

Changes in v9:
- Add a few preparatory patches to simplify the actual feature patches.
- Use a wrapping type for the bootloader.
- Simplify the falcon loading code and move the complexity to the
  firmware types.
- Add the generic bootloader files to `ModInfoBuilder`.
- Link to v8: 
https://lore.kernel.org/all/[email protected]/

---
Alexandre Courbot (7):
      gpu: nova-core: falcon: rename load parameters to reflect DMA dependency
      gpu: nova-core: require DmaObject on FalconDmaLoadable, not FalconFirmware
      gpu: nova-core: falcon: remove generic argument from dma_wr
      gpu: nova-core: falcon: remove FalconFirmware's dependency on 
FalconDmaLoadable
      gpu: nova-core: move brom_params and boot_addr to FalconFirmware
      gpu: nova-core: make Chipset::arch() const
      gpu: nova-core: add gen_bootloader firmware to ModInfoBuilder

Timur Tabi (2):
      gpu: nova-core: add PIO support for loading firmware images
      gpu: nova-core: use the Generic Bootloader to boot FWSEC on Turing

 drivers/gpu/nova-core/falcon.rs                    | 291 +++++++++++++++++++--
 drivers/gpu/nova-core/falcon/hal.rs                |   6 +-
 drivers/gpu/nova-core/firmware.rs                  |  51 ++--
 drivers/gpu/nova-core/firmware/booter.rs           |  48 ++--
 drivers/gpu/nova-core/firmware/fwsec.rs            |  42 +--
 drivers/gpu/nova-core/firmware/fwsec/bootloader.rs | 276 +++++++++++++++++++
 drivers/gpu/nova-core/gpu.rs                       |   9 +-
 drivers/gpu/nova-core/gsp/boot.rs                  |  15 +-
 drivers/gpu/nova-core/regs.rs                      |  30 +++
 9 files changed, 672 insertions(+), 96 deletions(-)
---
base-commit: 5c009020744fe129e4728e71c44a6c7816c9105e
change-id: 20260204-turing_prep-6f6f54fe1850

Best regards,
-- 
Alexandre Courbot <[email protected]>

Reply via email to