Skip to content

Commit d0c167e

Browse files
GnurouDanilo Krummrich
authored andcommitted
gpu: nova-core: firmware: add ucode descriptor used by FWSEC-FRTS
FWSEC-FRTS is the first firmware we need to run on the GSP falcon in order to initiate the GSP boot process. Introduce the structure that describes it. Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Link: https://lore.kernel.org/r/20250619-nova-frts-v6-16-ecf41ef99252@nvidia.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent 69f5cd6 commit d0c167e

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

drivers/gpu/nova-core/firmware.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,51 @@ impl Firmware {
4141
}
4242
}
4343

44+
/// Structure used to describe some firmwares, notably FWSEC-FRTS.
45+
#[repr(C)]
46+
#[derive(Debug, Clone)]
47+
pub(crate) struct FalconUCodeDescV3 {
48+
/// Header defined by `NV_BIT_FALCON_UCODE_DESC_HEADER_VDESC*` in OpenRM.
49+
hdr: u32,
50+
/// Stored size of the ucode after the header.
51+
stored_size: u32,
52+
/// Offset in `DMEM` at which the signature is expected to be found.
53+
pub(crate) pkc_data_offset: u32,
54+
/// Offset after the code segment at which the app headers are located.
55+
pub(crate) interface_offset: u32,
56+
/// Base address at which to load the code segment into `IMEM`.
57+
pub(crate) imem_phys_base: u32,
58+
/// Size in bytes of the code to copy into `IMEM`.
59+
pub(crate) imem_load_size: u32,
60+
/// Virtual `IMEM` address (i.e. `tag`) at which the code should start.
61+
pub(crate) imem_virt_base: u32,
62+
/// Base address at which to load the data segment into `DMEM`.
63+
pub(crate) dmem_phys_base: u32,
64+
/// Size in bytes of the data to copy into `DMEM`.
65+
pub(crate) dmem_load_size: u32,
66+
/// Mask of the falcon engines on which this firmware can run.
67+
pub(crate) engine_id_mask: u16,
68+
/// ID of the ucode used to infer a fuse register to validate the signature.
69+
pub(crate) ucode_id: u8,
70+
/// Number of signatures in this firmware.
71+
pub(crate) signature_count: u8,
72+
/// Versions of the signatures, used to infer a valid signature to use.
73+
pub(crate) signature_versions: u16,
74+
_reserved: u16,
75+
}
76+
77+
// To be removed once that code is used.
78+
#[expect(dead_code)]
79+
impl FalconUCodeDescV3 {
80+
/// Returns the size in bytes of the header.
81+
pub(crate) fn size(&self) -> usize {
82+
const HDR_SIZE_SHIFT: u32 = 16;
83+
const HDR_SIZE_MASK: u32 = 0xffff0000;
84+
85+
((self.hdr & HDR_SIZE_MASK) >> HDR_SIZE_SHIFT) as usize
86+
}
87+
}
88+
4489
pub(crate) struct ModInfoBuilder<const N: usize>(firmware::ModInfoBuilder<N>);
4590

4691
impl<const N: usize> ModInfoBuilder<N> {

0 commit comments

Comments
 (0)