gpu: nova-core: move GSP firmware files decision to GSP HAL

The files to give the `ModInfoBuilder` depend on the chipset; this is
HAL information, so move it there. Doing so lets us remove the
`uses_fsp` and `needs_fwsec_bootloader` ad-hoc methods of `Chipset`.

Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
Link: https://patch.msgid.link/20260709-nova-bootcontext-v6-9-520cbf8b9b50@nvidia.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This commit is contained in:
Eliot Courtney
2026-07-09 15:53:02 +09:00
committed by Alexandre Courbot
parent bb2d007399
commit 691f6bc891
5 changed files with 33 additions and 33 deletions

View File

@@ -21,6 +21,7 @@
FalconFirmware, //
},
gpu,
gsp::boot_firmware_files,
num::{
FromSafeCast,
IntoSafeCast, //
@@ -419,24 +420,20 @@ const fn make_entry_file(self, chipset: &str, fw: &str) -> Self {
const fn make_entry_chipset(self, chipset: gpu::Chipset) -> Self {
let name = chipset.name();
let this = self
// GSP firmware files are always present.
let mut this = self
.make_entry_file(name, "bootloader")
.make_entry_file(name, "gsp");
// FSP-based chipsets (Hopper, Blackwell and later) boot the GSP via the FMC image loaded by
// FSP. Older chipsets use the SEC2 booter instead.
let this = if chipset.uses_fsp() {
this.make_entry_file(name, "fmc")
} else {
this.make_entry_file(name, "booter_load")
.make_entry_file(name, "booter_unload")
};
if chipset.needs_fwsec_bootloader() {
this.make_entry_file(name, "gen_bootloader")
} else {
this
// Add the firmware files specific to the GSP boot method of `chipset`.
let boot_files = boot_firmware_files(chipset);
let mut i = 0;
while i < boot_files.len() {
this = this.make_entry_file(name, boot_files[i]);
i += 1;
}
this
}
pub(crate) const fn create(

View File

@@ -385,9 +385,8 @@ pub(crate) fn new(
/// Loads the FWSEC firmware into `falcon` and execute it.
///
/// This must only be called on chipsets that do not need the FWSEC bootloader (i.e., where
/// [`Chipset::needs_fwsec_bootloader()`](crate::gpu::Chipset::needs_fwsec_bootloader) returns
/// `false`). On chipsets that do, use [`bootloader::FwsecFirmwareWithBl`] instead.
/// This must only be called on chipsets that do not need the FWSEC bootloader. On chipsets
/// where the bootloader is required, use [`bootloader::FwsecFirmwareWithBl`] instead.
pub(crate) fn run(&self, dev: &Device<device::Bound>, falcon: &Falcon<'_, Gsp>) -> Result<()> {
// Reset falcon, load the firmware, and run it.
falcon

View File

@@ -133,22 +133,6 @@ pub(crate) const fn arch(self) -> Architecture {
}
}
/// Returns `true` if this chipset requires the PIO-loaded bootloader in order to boot FWSEC.
///
/// This includes all chipsets < GA102.
pub(crate) const fn needs_fwsec_bootloader(self) -> bool {
matches!(self.arch(), Architecture::Turing) || matches!(self, Self::GA100)
}
/// Returns `true` if this chipset boots via FSP (Hopper and later), which requires the FMC
/// firmware image.
pub(crate) const fn uses_fsp(self) -> bool {
matches!(
self.arch(),
Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x
)
}
/// Returns the address range of the PCI config mirror space.
pub(crate) fn pci_config_mirror_range(self) -> Range<u32> {
hal::gpu_hal(self).pci_config_mirror_range()

View File

@@ -32,6 +32,7 @@
GspFwWprMeta,
LibosParams, //
};
pub(crate) use hal::boot_firmware_files;
use crate::{
driver::Bar0,

View File

@@ -57,6 +57,25 @@ fn post_boot(&self, _gsp: &Gsp, _ctx: &GspBootContext<'_>, _gsp_fw: &GspFirmware
}
}
/// Returns the names of the firmware files required to boot the GSP of `chipset`, in addition to
/// the "bootloader" and "gsp" images required by all chipsets.
pub(crate) const fn boot_firmware_files(chipset: Chipset) -> &'static [&'static str] {
match chipset.arch() {
// Turing chipsets boot the GSP via the SEC2 Booter, and require the FWSEC bootloader.
Architecture::Turing => &["booter_load", "booter_unload", "gen_bootloader"],
// GA100 also requires the FWSEC bootloader.
Architecture::Ampere if matches!(chipset, Chipset::GA100) => {
&["booter_load", "booter_unload", "gen_bootloader"]
}
// Other Ampere chipsets, as well as Ada chipsets, run FWSEC directly.
Architecture::Ampere | Architecture::Ada => &["booter_load", "booter_unload"],
// Hopper and later chipsets boot the GSP via the FMC image loaded by FSP.
Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => {
&["fmc"]
}
}
}
/// Returns the GSP HAL to be used for `chipset`.
pub(super) fn gsp_hal(chipset: Chipset) -> &'static dyn GspHal {
match chipset.arch() {