mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
gpu: nova-core: add NV_PFALCON_FALCON_DMATRFCMD::with_falcon_mem()
The with_falcon_mem() method initializes the 'imem' and 'sec' fields of the NV_PFALCON_FALCON_DMATRFCMD register based on the value of the FalconMem type. 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-6-ttabi@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
This commit is contained in:
parent
121ea04cd9
commit
f6507640b0
|
|
@ -458,7 +458,6 @@ fn dma_wr<F: FalconFirmware<Target = E>>(
|
|||
fw: &F,
|
||||
target_mem: FalconMem,
|
||||
load_offsets: FalconLoadTarget,
|
||||
sec: bool,
|
||||
) -> Result {
|
||||
const DMA_LEN: u32 = 256;
|
||||
|
||||
|
|
@ -526,8 +525,7 @@ fn dma_wr<F: FalconFirmware<Target = E>>(
|
|||
|
||||
let cmd = regs::NV_PFALCON_FALCON_DMATRFCMD::default()
|
||||
.set_size(DmaTrfCmdSize::Size256B)
|
||||
.set_imem(target_mem != FalconMem::Dmem)
|
||||
.set_sec(if sec { 1 } else { 0 });
|
||||
.with_falcon_mem(target_mem);
|
||||
|
||||
for pos in (0..num_transfers).map(|i| i * DMA_LEN) {
|
||||
// Perform a transfer of size `DMA_LEN`.
|
||||
|
|
@ -568,14 +566,8 @@ pub(crate) fn dma_load<F: FalconFirmware<Target = E>>(&self, bar: &Bar0, fw: &F)
|
|||
.set_mem_type(FalconFbifMemType::Physical)
|
||||
});
|
||||
|
||||
self.dma_wr(
|
||||
bar,
|
||||
fw,
|
||||
FalconMem::ImemSecure,
|
||||
fw.imem_sec_load_params(),
|
||||
true,
|
||||
)?;
|
||||
self.dma_wr(bar, fw, FalconMem::Dmem, fw.dmem_load_params(), true)?;
|
||||
self.dma_wr(bar, fw, FalconMem::ImemSecure, fw.imem_sec_load_params())?;
|
||||
self.dma_wr(bar, fw, FalconMem::Dmem, fw.dmem_load_params())?;
|
||||
|
||||
self.hal.program_brom(self, bar, &fw.brom_params())?;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
FalconCoreRevSubversion,
|
||||
FalconFbifMemType,
|
||||
FalconFbifTarget,
|
||||
FalconMem,
|
||||
FalconModSelAlgo,
|
||||
FalconSecurityModel,
|
||||
PFalcon2Base,
|
||||
|
|
@ -325,6 +326,14 @@ pub(crate) fn mem_scrubbing_done(self) -> bool {
|
|||
16:16 set_dmtag as u8;
|
||||
});
|
||||
|
||||
impl NV_PFALCON_FALCON_DMATRFCMD {
|
||||
/// Programs the `imem` and `sec` fields for the given FalconMem
|
||||
pub(crate) fn with_falcon_mem(self, mem: FalconMem) -> Self {
|
||||
self.set_imem(mem != FalconMem::Dmem)
|
||||
.set_sec(if mem == FalconMem::ImemSecure { 1 } else { 0 })
|
||||
}
|
||||
}
|
||||
|
||||
register!(NV_PFALCON_FALCON_DMATRFFBOFFS @ PFalconBase[0x0000011c] {
|
||||
31:0 offs as u32;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user