Some GPUs do not support using DMA to transfer code/data from system memory to Falcon memory, and instead must use programmed I/O (PIO). Add a function to the Falcon HAL to indicate whether a given GPU's Falcons support DMA for this purpose.
Signed-off-by: Timur Tabi <[email protected]> --- drivers/gpu/nova-core/falcon/hal.rs | 14 ++++++++++++++ drivers/gpu/nova-core/falcon/hal/ga102.rs | 5 +++++ drivers/gpu/nova-core/falcon/hal/tu102.rs | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/drivers/gpu/nova-core/falcon/hal.rs b/drivers/gpu/nova-core/falcon/hal.rs index c886ba03d1f6..fe6de900e8b0 100644 --- a/drivers/gpu/nova-core/falcon/hal.rs +++ b/drivers/gpu/nova-core/falcon/hal.rs @@ -15,6 +15,16 @@ mod ga102; mod tu102; +/// Method used to load data into falcon memory. Some GPU architectures need +/// PIO and others can use DMA. +#[expect(unused)] +pub(crate) enum LoadMethod { + /// Programmed I/O + Pio, + /// Direct Memory Access + Dma, +} + /// Hardware Abstraction Layer for Falcon cores. /// /// Implements chipset-specific low-level operations. The trait is generic against [`FalconEngine`] @@ -48,6 +58,10 @@ fn signature_reg_fuse_version( /// Reset the falcon engine. fn reset_eng(&self, bar: &Bar0) -> Result; + + /// returns the method needed to load data into Falcon memory + #[expect(unused)] + fn load_method(&self) -> LoadMethod; } /// Returns a boxed falcon HAL adequate for `chipset`. diff --git a/drivers/gpu/nova-core/falcon/hal/ga102.rs b/drivers/gpu/nova-core/falcon/hal/ga102.rs index 39863813a2bf..8f62df10da0a 100644 --- a/drivers/gpu/nova-core/falcon/hal/ga102.rs +++ b/drivers/gpu/nova-core/falcon/hal/ga102.rs @@ -12,6 +12,7 @@ use crate::{ driver::Bar0, falcon::{ + hal::LoadMethod, Falcon, FalconBromParams, FalconEngine, @@ -151,4 +152,8 @@ fn reset_eng(&self, bar: &Bar0) -> Result { Ok(()) } + + fn load_method(&self) -> LoadMethod { + LoadMethod::Dma + } } diff --git a/drivers/gpu/nova-core/falcon/hal/tu102.rs b/drivers/gpu/nova-core/falcon/hal/tu102.rs index 23fbf6110572..7de6f24cc0a0 100644 --- a/drivers/gpu/nova-core/falcon/hal/tu102.rs +++ b/drivers/gpu/nova-core/falcon/hal/tu102.rs @@ -11,6 +11,7 @@ use crate::{ driver::Bar0, falcon::{ + hal::LoadMethod, Falcon, FalconBromParams, FalconEngine, // @@ -69,4 +70,8 @@ fn reset_eng(&self, bar: &Bar0) -> Result { Ok(()) } + + fn load_method(&self) -> LoadMethod { + LoadMethod::Pio + } } -- 2.52.0
