On Thu, 2026-01-22 at 12:52 +0000, Gary Guo wrote:
> >      /// Perform a DMA load into `IMEM` and `DMEM` of `fw`, and prepare the 
> > falcon to run it.
> >      pub(crate) fn dma_load<F: FalconFirmware<Target = E>>(&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() {
> > +            return Err(EINVAL);
> > +        }
> 
> This error path should never be exercised would it?
> 
> dma_load should never be called in the first place but pio_load should be 
> called
> instead when the platform does not support DMA?

Correct.  This was changed between v4 and v5.  Previously, I had support for 
nsec images:

+        if let Some(nmem) = fw.imem_ns_load_params() {
+            // This code should never actual get executed, because the 
Non-Secure
+            // section only exists on firmware used by Turing and GA100, and
+            // those platforms do not use DMA.  But we include this code for
+            // consistency.
+            self.dma_wr(bar, fw, FalconMem::ImemNonSecure, nmem, false)?;
+        }

But John said no, so I just changed it to a if-statement to catch coding 
mistakes.

Reply via email to