diff options
| author | Alexandre Courbot <acourbot@nvidia.com> | 2026-03-06 07:52:39 +0300 |
|---|---|---|
| committer | Alexandre Courbot <acourbot@nvidia.com> | 2026-03-09 04:35:37 +0300 |
| commit | 3b97ec9fdef49932505cf4f99cd7074a04806240 (patch) | |
| tree | 5ea73c6b372c11cd8b77480b077fd2be73df73fc | |
| parent | bc9de9e1af2f05461460e1b215a6d209ee62d65a (diff) | |
| download | linux-3b97ec9fdef49932505cf4f99cd7074a04806240.tar.xz | |
gpu: nova-core: falcon: add constant for memory block alignment
Falcon memory blocks are 256 bytes in size. This is a hard constant on
all models.
This value was hardcoded, so turn it into a documented constant. It will
also become useful with the PIO loading code.
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20260306-turing_prep-v11-2-8f0042c5d026@nvidia.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
| -rw-r--r-- | drivers/gpu/nova-core/falcon.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs index 8d444cf9d55c..31217cd3a795 100644 --- a/drivers/gpu/nova-core/falcon.rs +++ b/drivers/gpu/nova-core/falcon.rs @@ -25,6 +25,7 @@ use crate::{ falcon::hal::LoadMethod, gpu::Chipset, num::{ + self, FromSafeCast, IntoSafeCast, // }, @@ -36,6 +37,9 @@ pub(crate) mod gsp; mod hal; pub(crate) mod sec2; +/// Alignment (in bytes) of falcon memory blocks. +pub(crate) const MEM_BLOCK_ALIGNMENT: usize = 256; + // TODO[FPRI]: Replace with `ToPrimitive`. macro_rules! impl_from_enum_to_u8 { ($enum_type:ty) => { @@ -423,7 +427,7 @@ impl<E: FalconEngine + 'static> Falcon<E> { target_mem: FalconMem, load_offsets: FalconLoadTarget, ) -> Result { - const DMA_LEN: u32 = 256; + const DMA_LEN: u32 = num::usize_into_u32::<{ MEM_BLOCK_ALIGNMENT }>(); // For IMEM, we want to use the start offset as a virtual address tag for each page, since // code addresses in the firmware (and the boot vector) are virtual. |
