On Fri May 15, 2026 at 3:12 PM JST, Alexandre Courbot wrote:
> Booting the GSP is done differently depending on the architecture. Move
> the parts that are chipset-specific under a HAL.
>
> This does not change much at the moment, since the differences between
> Turing and Ampere are rather benign, but will become critical to
> properly support the FSP boot process used by Hopper and Blackwell.
>
> The Hopper/Blackwell support is not merged yet, so their HAL is a stub
> for now.
>
> This patch is intended to be a mechanical code extraction with no
> behavioral changes.
>
> Signed-off-by: Alexandre Courbot <[email protected]>
> ---


> +/// Load and run the booter firmware.
> +fn run_booter(
> +    dev: &device::Device<device::Bound>,
> +    bar: &Bar0,
> +    chipset: Chipset,
> +    sec2_falcon: &Falcon<Sec2>,
> +    wpr_meta: &Coherent<GspFwWprMeta>,
> +) -> Result {
> +    BooterFirmware::new(
> +        dev,
> +        BooterKind::Loader,
> +        chipset,
> +        FIRMWARE_VERSION,
> +        sec2_falcon,
> +        bar,
> +    )?
> +    .run(dev, bar, sec2_falcon, wpr_meta)
> +}

nit: This method mostly just forwards arguments, it feels a bit odd to
split this, but not e.g. GspSequencer::run() below. IMO you can just do
this inline. I see you are just moving code though, so no worries.

> +
> +struct Tu102;
> +
> +impl GspHal for Tu102 {
> +    fn boot(
> +        &self,
> +        gsp: Pin<&mut Gsp>,
> +        dev: &device::Device<device::Bound>,
> +        bar: &Bar0,
> +        chipset: Chipset,
> +        fb_layout: &FbLayout,
> +        wpr_meta: &Coherent<GspFwWprMeta>,
> +        gsp_falcon: &Falcon<GspEngine>,
> +        sec2_falcon: &Falcon<Sec2>,
> +    ) -> Result {
> +        let bios = Vbios::new(dev, bar)?;
> +
> +        // FWSEC-FRTS is not executed on chips where the FRTS region size is 
> 0 (e.g. GA100).
> +        if !fb_layout.frts.is_empty() {
> +            run_fwsec_frts(dev, chipset, gsp_falcon, bar, &bios, fb_layout)?;
> +        }
> +
> +        gsp_falcon.reset(bar)?;
> +        let libos_handle = gsp.libos.dma_handle();
> +        let (mbox0, mbox1) = gsp_falcon.boot(
> +            bar,
> +            Some(libos_handle as u32),
> +            Some((libos_handle >> 32) as u32),
> +        )?;
> +        dev_dbg!(dev, "GSP MBOX0: {:#x}, MBOX1: {:#x}\n", mbox0, mbox1);
> +
> +        dev_dbg!(
> +            dev,
> +            "Using SEC2 to load and run the booter_load firmware...\n"
> +        );
> +
> +        run_booter(dev, bar, chipset, sec2_falcon, wpr_meta)?;
> +
> +        Ok(())
> +    }
> +
> +    fn post_boot(
> +        &self,
> +        gsp: Pin<&mut Gsp>,
> +        dev: &device::Device<device::Bound>,
> +        bar: &Bar0,
> +        gsp_fw: &GspFirmware,
> +        gsp_falcon: &Falcon<GspEngine>,
> +        sec2_falcon: &Falcon<Sec2>,
> +    ) -> Result {
> +        // Create and run the GSP sequencer.
> +        let seq_params = GspSequencerParams {
> +            bootloader_app_version: gsp_fw.bootloader.app_version,
> +            libos_dma_handle: gsp.libos.dma_handle(),
> +            gsp_falcon,
> +            sec2_falcon,
> +            dev: dev.into(),
> +            bar,
> +        };
> +        GspSequencer::run(&gsp.cmdq, seq_params)?;
> +
> +        Ok(())
> +    }
> +}
> +
> +const TU102: Tu102 = Tu102;
> +pub(super) const TU102_HAL: &dyn GspHal = &TU102;

Reviewed-by: Eliot Courtney <[email protected]>

Reply via email to