Not all firmware is necessarily loaded by DMA. Remove the requirement for `FalconFirmware` to implement `FalconDmaLoadable`, and adapt `Falcon`'s methods constraints accordingly.
Signed-off-by: Alexandre Courbot <[email protected]> --- drivers/gpu/nova-core/falcon.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs index 35744f7c9cb2..5eed48226bd5 100644 --- a/drivers/gpu/nova-core/falcon.rs +++ b/drivers/gpu/nova-core/falcon.rs @@ -373,7 +373,7 @@ pub(crate) trait FalconDmaLoadable: Deref<Target = DmaObject> { /// /// A falcon firmware can be loaded on a given engine, and is presented in the form of a DMA /// object. -pub(crate) trait FalconFirmware: FalconDmaLoadable { +pub(crate) trait FalconFirmware { /// Engine on which this firmware is to be loaded. type Target: FalconEngine; } @@ -516,7 +516,11 @@ fn dma_wr( } /// Perform a DMA load into `IMEM` and `DMEM` of `fw`, and prepare the falcon to run it. - fn dma_load<F: FalconFirmware<Target = E>>(&self, bar: &Bar0, fw: &F) -> Result { + fn dma_load<F: FalconFirmware<Target = E> + FalconDmaLoadable>( + &self, + bar: &Bar0, + fw: &F, + ) -> Result { // The Non-Secure section only exists on firmware used by Turing and GA100, and // those platforms do not use DMA. if fw.imem_ns_load_params().is_some() { @@ -642,7 +646,11 @@ pub(crate) fn is_riscv_active(&self, bar: &Bar0) -> bool { } // Load a firmware image into Falcon memory - pub(crate) fn load<F: FalconFirmware<Target = E>>(&self, bar: &Bar0, fw: &F) -> Result { + pub(crate) fn load<F: FalconFirmware<Target = E> + FalconDmaLoadable>( + &self, + bar: &Bar0, + fw: &F, + ) -> Result { match self.hal.load_method() { LoadMethod::Dma => self.dma_load(bar, fw), LoadMethod::Pio => Err(ENOTSUPP), -- 2.53.0
