mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
gpu: nova-core: gsp: make use of FWSEC bootloader a property of the TU102 HAL
By being in the TU102 HAL, we already know that the GSP boot method is the SEC2 Booter, so the only variable is whether the FWSEC bootloader is used or not. Since `Chipset` also includes the variants that boot FSP, querying it for that information introduces a potential code path (a chipset that boots via FSP) that the current code doesn't handle. Turn the use of the FWSEC bootloader into a property of the `Tu102` HAL, and give GA102+ chipsets their own instance with that property set to `false`. This removes the invalid code path and the only use of `Chipset` is now to load the correct firmware files. This also removes some uses of the `Chipset::needs_fwsec_bootloader` method and prepares the ground for removing it. Reviewed-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260709-nova-bootcontext-v6-8-520cbf8b9b50@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This commit is contained in:
parent
7567e62b9c
commit
bb2d007399
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
|
||||
mod ga102;
|
||||
mod gh100;
|
||||
mod tu102;
|
||||
|
||||
|
|
@ -59,7 +60,9 @@ fn post_boot(&self, _gsp: &Gsp, _ctx: &GspBootContext<'_>, _gsp_fw: &GspFirmware
|
|||
/// Returns the GSP HAL to be used for `chipset`.
|
||||
pub(super) fn gsp_hal(chipset: Chipset) -> &'static dyn GspHal {
|
||||
match chipset.arch() {
|
||||
Architecture::Turing | Architecture::Ampere | Architecture::Ada => tu102::TU102_HAL,
|
||||
Architecture::Turing => tu102::TU102_HAL,
|
||||
Architecture::Ampere if matches!(chipset, Chipset::GA100) => tu102::TU102_HAL,
|
||||
Architecture::Ampere | Architecture::Ada => ga102::GA102_HAL,
|
||||
Architecture::Hopper | Architecture::BlackwellGB10x | Architecture::BlackwellGB20x => {
|
||||
gh100::GH100_HAL
|
||||
}
|
||||
|
|
|
|||
14
drivers/gpu/nova-core/gsp/hal/ga102.rs
Normal file
14
drivers/gpu/nova-core/gsp/hal/ga102.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
|
||||
use crate::gsp::hal::{
|
||||
tu102::Tu102,
|
||||
GspHal, //
|
||||
};
|
||||
|
||||
/// The GA102 HAL is like the TU102 one, except it doesn't use the bootloader.
|
||||
const GA102: Tu102 = Tu102 {
|
||||
needs_fwsec_bootloader: false,
|
||||
};
|
||||
|
||||
pub(super) const GA102_HAL: &dyn GspHal = &GA102;
|
||||
|
|
@ -127,7 +127,10 @@ fn run(&self, ctx: &GspBootContext<'_>) -> Result {
|
|||
}
|
||||
}
|
||||
|
||||
struct Tu102;
|
||||
pub(super) struct Tu102 {
|
||||
/// If `true`, then the FWSEC-FRTS bootloader will be used to load the actual firmware.
|
||||
pub(super) needs_fwsec_bootloader: bool,
|
||||
}
|
||||
|
||||
impl Tu102 {
|
||||
/// Helper method to load and run the FWSEC-FRTS firmware and confirm that it has properly
|
||||
|
|
@ -162,7 +165,7 @@ fn run_fwsec_frts(
|
|||
},
|
||||
)?;
|
||||
|
||||
if chipset.needs_fwsec_bootloader() {
|
||||
if self.needs_fwsec_bootloader {
|
||||
let fwsec_frts_bl = FwsecFirmwareWithBl::new(fwsec_frts, dev, chipset)?;
|
||||
// Load and run the bootloader, which will load FWSEC-FRTS and run it.
|
||||
fwsec_frts_bl.run(dev, falcon, bar)?;
|
||||
|
|
@ -227,7 +230,7 @@ fn build_unload_bundle(
|
|||
) -> Result<crate::gsp::UnloadBundle> {
|
||||
// Load the FWSEC SB firmware, as well as its bootloader if required.
|
||||
let fwsec_sb = FwsecFirmware::new(dev, gsp_falcon, bios, FwsecCommand::Sb)?;
|
||||
let fwsec_sb = if chipset.needs_fwsec_bootloader() {
|
||||
let fwsec_sb = if self.needs_fwsec_bootloader {
|
||||
FwsecUnloadFirmware::WithBl(FwsecFirmwareWithBl::new(fwsec_sb, dev, chipset)?)
|
||||
} else {
|
||||
FwsecUnloadFirmware::WithoutBl(fwsec_sb)
|
||||
|
|
@ -323,5 +326,9 @@ fn post_boot(&self, gsp: &Gsp, ctx: &GspBootContext<'_>, gsp_fw: &GspFirmware) -
|
|||
}
|
||||
}
|
||||
|
||||
const TU102: Tu102 = Tu102;
|
||||
/// The TU102 HAL requires the use of the FWSEC bootloader.
|
||||
const TU102: Tu102 = Tu102 {
|
||||
needs_fwsec_bootloader: true,
|
||||
};
|
||||
|
||||
pub(super) const TU102_HAL: &dyn GspHal = &TU102;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user