mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
gpu: nova-core: Hopper/Blackwell: add FMC firmware image
FSP is the Falcon that runs FMC firmware on Hopper and Blackwell. Load the FMC ELF in two forms: the image section that FSP boots from, and the full Firmware object for later signature extraction during Chain of Trust verification. Declare the FMC image in the module's firmware table so it is bundled for FSP-based chipsets. Signed-off-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260602032111.224790-12-jhubbard@nvidia.com Co-developed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This commit is contained in:
parent
34599e0738
commit
4257d31793
|
|
@ -28,6 +28,7 @@
|
|||
};
|
||||
|
||||
pub(crate) mod booter;
|
||||
pub(crate) mod fsp;
|
||||
pub(crate) mod fwsec;
|
||||
pub(crate) mod gsp;
|
||||
pub(crate) mod riscv;
|
||||
|
|
@ -431,10 +432,16 @@ const fn make_entry_chipset(self, chipset: gpu::Chipset) -> Self {
|
|||
.make_entry_file(name, "bootloader")
|
||||
.make_entry_file(name, "gsp");
|
||||
|
||||
if chipset.needs_fwsec_bootloader() {
|
||||
let this = if chipset.needs_fwsec_bootloader() {
|
||||
this.make_entry_file(name, "gen_bootloader")
|
||||
} else {
|
||||
this
|
||||
};
|
||||
|
||||
if chipset.uses_fsp() {
|
||||
this.make_entry_file(name, "fmc")
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
47
drivers/gpu/nova-core/firmware/fsp.rs
Normal file
47
drivers/gpu/nova-core/firmware/fsp.rs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
|
||||
//! FSP is a hardware unit that runs FMC firmware.
|
||||
|
||||
use kernel::{
|
||||
device,
|
||||
dma::Coherent,
|
||||
firmware::Firmware,
|
||||
prelude::*, //
|
||||
};
|
||||
|
||||
use crate::{
|
||||
firmware::elf,
|
||||
gpu::Chipset, //
|
||||
};
|
||||
|
||||
pub(crate) struct FspFirmware {
|
||||
/// FMC firmware image data (only the "image" ELF section).
|
||||
#[expect(dead_code)]
|
||||
pub(crate) fmc_image: Coherent<[u8]>,
|
||||
/// Full FMC ELF for signature extraction.
|
||||
#[expect(dead_code)]
|
||||
pub(crate) fmc_elf: Firmware,
|
||||
}
|
||||
|
||||
impl FspFirmware {
|
||||
pub(crate) fn new(
|
||||
dev: &device::Device<device::Bound>,
|
||||
chipset: Chipset,
|
||||
ver: &str,
|
||||
) -> Result<Self> {
|
||||
let fw = super::request_firmware(dev, chipset, "fmc", ver)?;
|
||||
|
||||
// FSP expects only the "image" section, not the entire ELF file.
|
||||
let fmc_image_data = elf::elf_section(fw.data(), "image").ok_or_else(|| {
|
||||
dev_err!(dev, "FMC ELF file missing 'image' section\n");
|
||||
EINVAL
|
||||
})?;
|
||||
let fmc_image = Coherent::from_slice(dev, fmc_image_data, GFP_KERNEL)?;
|
||||
|
||||
Ok(Self {
|
||||
fmc_image,
|
||||
fmc_elf: fw,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -137,6 +137,15 @@ 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()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
Falcon, //
|
||||
},
|
||||
fb::FbLayout,
|
||||
firmware::{
|
||||
fsp::FspFirmware,
|
||||
FIRMWARE_VERSION, //
|
||||
},
|
||||
gpu::Chipset,
|
||||
gsp::{
|
||||
boot::BootUnloadGuard,
|
||||
|
|
@ -35,14 +39,16 @@ impl GspHal for Gh100 {
|
|||
fn boot<'a>(
|
||||
&self,
|
||||
_gsp: &'a Gsp,
|
||||
_dev: &'a device::Device<device::Bound>,
|
||||
dev: &'a device::Device<device::Bound>,
|
||||
_bar: &'a Bar0,
|
||||
_chipset: Chipset,
|
||||
chipset: Chipset,
|
||||
_fb_layout: &FbLayout,
|
||||
_wpr_meta: &Coherent<GspFwWprMeta>,
|
||||
_gsp_falcon: &'a Falcon<GspEngine>,
|
||||
_sec2_falcon: &'a Falcon<Sec2>,
|
||||
) -> Result<BootUnloadGuard<'a>> {
|
||||
let _fsp_fw = FspFirmware::new(dev, chipset, FIRMWARE_VERSION)?;
|
||||
|
||||
Err(ENOTSUPP)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user