Skip to content

Commit 0975002

Browse files
ttabiGnurou
authored andcommitted
gpu: nova-core: rename Imem to ImemSecure
Rename FalconMem::Imem to ImemSecure to indicate that it references Secure Instruction Memory. This change has no functional impact. On Falcon cores, pages in instruction memory can be tagged as Secure or Non-Secure. For GA102 and later, only Secure is used, which is why FalconMem::Imem seems appropriate. However, Turing firmware images can also contain non-secure sections, and so FalconMem needs to support that. By renaming Imem to ImemSec now, future patches for Turing support will be simpler. Nouveau uses the term "IMEM" to refer both to the Instruction Memory block on Falcon cores as well as to the images of secure firmware uploaded to part of IMEM. OpenRM uses the terms "ImemSec" and "ImemNs" instead, and uses "IMEM" just to refer to the physical memory device. Renaming these terms allows us to align with OpenRM, avoid confusion between IMEM and ImemSec, and makes future patches simpler. Signed-off-by: Timur Tabi <ttabi@nvidia.com> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: https://patch.msgid.link/20260122222848.2555890-2-ttabi@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
1 parent 5ec66bb commit 0975002

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

drivers/gpu/nova-core/falcon.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ impl From<PeregrineCoreSelect> for bool {
240240
/// Different types of memory present in a falcon core.
241241
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
242242
pub(crate) enum FalconMem {
243-
/// Instruction Memory.
244-
Imem,
243+
/// Secure Instruction Memory.
244+
ImemSecure,
245245
/// Data Memory.
246246
Dmem,
247247
}
@@ -348,8 +348,8 @@ pub(crate) struct FalconBromParams {
348348

349349
/// Trait for providing load parameters of falcon firmwares.
350350
pub(crate) trait FalconLoadParams {
351-
/// Returns the load parameters for `IMEM`.
352-
fn imem_load_params(&self) -> FalconLoadTarget;
351+
/// Returns the load parameters for Secure `IMEM`.
352+
fn imem_sec_load_params(&self) -> FalconLoadTarget;
353353

354354
/// Returns the load parameters for `DMEM`.
355355
fn dmem_load_params(&self) -> FalconLoadTarget;
@@ -460,7 +460,7 @@ impl<E: FalconEngine + 'static> Falcon<E> {
460460
//
461461
// For DMEM we can fold the start offset into the DMA handle.
462462
let (src_start, dma_start) = match target_mem {
463-
FalconMem::Imem => (load_offsets.src_start, fw.dma_handle()),
463+
FalconMem::ImemSecure => (load_offsets.src_start, fw.dma_handle()),
464464
FalconMem::Dmem => (
465465
0,
466466
fw.dma_handle_with_offset(load_offsets.src_start.into_safe_cast())?,
@@ -517,7 +517,7 @@ impl<E: FalconEngine + 'static> Falcon<E> {
517517

518518
let cmd = regs::NV_PFALCON_FALCON_DMATRFCMD::default()
519519
.set_size(DmaTrfCmdSize::Size256B)
520-
.set_imem(target_mem == FalconMem::Imem)
520+
.set_imem(target_mem == FalconMem::ImemSecure)
521521
.set_sec(if sec { 1 } else { 0 });
522522

523523
for pos in (0..num_transfers).map(|i| i * DMA_LEN) {
@@ -552,7 +552,13 @@ impl<E: FalconEngine + 'static> Falcon<E> {
552552
.set_mem_type(FalconFbifMemType::Physical)
553553
});
554554

555-
self.dma_wr(bar, fw, FalconMem::Imem, fw.imem_load_params(), true)?;
555+
self.dma_wr(
556+
bar,
557+
fw,
558+
FalconMem::ImemSecure,
559+
fw.imem_sec_load_params(),
560+
true,
561+
)?;
556562
self.dma_wr(bar, fw, FalconMem::Dmem, fw.dmem_load_params(), true)?;
557563

558564
self.hal.program_brom(self, bar, &fw.brom_params())?;

drivers/gpu/nova-core/firmware/booter.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ impl<'a> FirmwareSignature<BooterFirmware> for BooterSignature<'a> {}
251251

252252
/// The `Booter` loader firmware, responsible for loading the GSP.
253253
pub(crate) struct BooterFirmware {
254-
// Load parameters for `IMEM` falcon memory.
255-
imem_load_target: FalconLoadTarget,
254+
// Load parameters for Secure `IMEM` falcon memory.
255+
imem_sec_load_target: FalconLoadTarget,
256256
// Load parameters for `DMEM` falcon memory.
257257
dmem_load_target: FalconLoadTarget,
258258
// BROM falcon parameters.
@@ -354,7 +354,7 @@ impl BooterFirmware {
354354
};
355355

356356
Ok(Self {
357-
imem_load_target: FalconLoadTarget {
357+
imem_sec_load_target: FalconLoadTarget {
358358
src_start: app0.offset,
359359
dst_start: 0,
360360
len: app0.len,
@@ -371,8 +371,8 @@ impl BooterFirmware {
371371
}
372372

373373
impl FalconLoadParams for BooterFirmware {
374-
fn imem_load_params(&self) -> FalconLoadTarget {
375-
self.imem_load_target.clone()
374+
fn imem_sec_load_params(&self) -> FalconLoadTarget {
375+
self.imem_sec_load_target.clone()
376376
}
377377

378378
fn dmem_load_params(&self) -> FalconLoadTarget {
@@ -384,7 +384,7 @@ impl FalconLoadParams for BooterFirmware {
384384
}
385385

386386
fn boot_addr(&self) -> u32 {
387-
self.imem_load_target.src_start
387+
self.imem_sec_load_target.src_start
388388
}
389389
}
390390

drivers/gpu/nova-core/firmware/fwsec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub(crate) struct FwsecFirmware {
224224
}
225225

226226
impl FalconLoadParams for FwsecFirmware {
227-
fn imem_load_params(&self) -> FalconLoadTarget {
227+
fn imem_sec_load_params(&self) -> FalconLoadTarget {
228228
FalconLoadTarget {
229229
src_start: 0,
230230
dst_start: self.desc.imem_phys_base,

0 commit comments

Comments
 (0)