gpu: nova-core: program_brom cannot fail
Subsystems (4)
PATCH 1/1 gpu: nova-core: program_brom cannot fail
Change the signature of the program_brom HAL method to not return anything. None of the implementations can actually fail, so they always return Ok(()).
--- drivers/gpu/nova-core/falcon.rs | 2 +- drivers/gpu/nova-core/falcon/hal.rs | 2 +- drivers/gpu/nova-core/falcon/hal/ga102.rs | 8 +++----- drivers/gpu/nova-core/falcon/hal/tu102.rs | 4 +--- 4 files changed, 6 insertions(+), 10 deletions(-)
drivers/gpu/nova-core/falcon.rs +1 -1
@@ -532,7 +532,7 @@ fn dma_load<F: FalconFirmware<Target = E>>(&self, bar: &Bar0, fw: &F) -> Result 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 ())?; + self.hal.program_brom (self, bar, &fw.brom_params ());// Set `BootVec` to start of non-secure code. regs::NV_PFALCON_FALCON_BOOTVEC ::default ()
drivers/gpu/nova-core/falcon/hal.rs +1 -1
@@ -46,7 +46,7 @@ fn signature_reg_fuse_version( ) -> Result<u32>;/// Program the boot ROM registers prior to starting a secure firmware. -fn program_brom (&self, falcon: &Falcon <E >, bar: &Bar0 , params: &FalconBromParams ) ->Result ; +fn program_brom (&self, falcon: &Falcon <E >, bar: &Bar0 , params: &FalconBromParams );/// Check if the RISC-V core is active. /// Returns `true` if the RISC-V core is active, `false` otherwise.
drivers/gpu/nova-core/falcon/hal/ga102.rs +3 -5
@@ -75,7 +75,7 @@ fn signature_reg_fuse_version_ga102(Ok (u16::BITS - reg_fuse_version.leading_zeros ()) } -fn program_brom_ga102 <E :FalconEngine >(bar: &Bar0 , params: &FalconBromParams ) ->Result { +fn program_brom_ga102 <E :FalconEngine >(bar: &Bar0 , params: &FalconBromParams ) { regs::NV_PFALCON2_FALCON_BROM_PARAADDR ::default () .set_value (params.pkc_data_offset) .write (bar, &E ::ID ,0 );
@@ -88,8 +88,6 @@ fn program_brom_ga102<E: FalconEngine>(bar: &Bar0, params: &FalconBromParams) -> regs::NV_PFALCON2_FALCON_MOD_SEL ::default () .set_algo (FalconModSelAlgo ::Rsa3k ) .write (bar, &E ::ID ); - -Ok (()) }pub (super )struct Ga102 <E :FalconEngine >(PhantomData <E >);
@@ -115,8 +113,8 @@ fn signature_reg_fuse_version(signature_reg_fuse_version_ga102 (&falcon.dev, bar, engine_id_mask, ucode_id) } -fn program_brom (&self, _falcon: &Falcon <E >, bar: &Bar0 , params: &FalconBromParams ) ->Result { -program_brom_ga102 ::<E >(bar, params) +fn program_brom (&self, _falcon: &Falcon <E >, bar: &Bar0 , params: &FalconBromParams ) { +program_brom_ga102 ::<E >(bar, params); }fn is_riscv_active (&self, bar: &Bar0 ) ->bool {
drivers/gpu/nova-core/falcon/hal/tu102.rs +1 -3
@@ -44,9 +44,7 @@ fn signature_reg_fuse_version(Ok (0 ) } -fn program_brom (&self, _falcon: &Falcon <E >, _bar: &Bar0 , _params: &FalconBromParams ) ->Result { -Ok (()) - } +fn program_brom (&self, _falcon: &Falcon <E >, _bar: &Bar0 , _params: &FalconBromParams ) {}fn is_riscv_active (&self, bar: &Bar0 ) ->bool {let cpuctl = regs::NV_PRISCV_RISCV_CORE_SWITCH_RISCV_STATUS ::read (bar, &E ::ID );
base-commit: cea7b66a80412e2a5b74627b89ae25f1d0110a4b
Signature · 1 line
2.52.0
Alexandre Courbot
maintainerQuoted 5 lines · Timur Tabi
Change the signature of the
program_bromHAL method to not return anything. None of the implementations can actually fail, so they always return Ok(()).Signed-off-by Timur Tabi <[email protected]>
Somehow this patch went under the radar, but it is still applicable (and obviously correct). I've scheduled it for merging after drm-rust-next reopens.
Quoted 10 lines · Alexandre Courbot
Quoted 5 lines · Timur Tabi
Change the signature of the
program_bromHAL method to not return anything. None of the implementations can actually fail, so they always return Ok(()).Signed-off-by Timur Tabi <[email protected]>Somehow this patch went under the radar, but it is still applicable (and obviously correct). I've scheduled it for merging after
drm-rust-nextreopens.
Pushed to drm-rust-next, thanks!