From 8cf15cf2641be8a786e4c7b5bd1f7f5cf640889f Mon Sep 17 00:00:00 2001 From: Eliot Courtney Date: Mon, 25 May 2026 22:57:27 +0900 Subject: [PATCH] gpu: nova-core: vbios: keep PmuLookupTable local in setup_falcon_data This does not need to be stored in `FwSecBiosBuilder` so we can remove it from there, and just create and use it locally in `setup_falcon_data`. Reviewed-by: Joel Fernandes Reviewed-by: John Hubbard Signed-off-by: Eliot Courtney Link: https://patch.msgid.link/20260525-fix-vbios-v5-9-e5e455251537@nvidia.com Signed-off-by: Danilo Krummrich --- drivers/gpu/nova-core/vbios.rs | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs index 8a0e16e6c9e8..cadc6dcffefb 100644 --- a/drivers/gpu/nova-core/vbios.rs +++ b/drivers/gpu/nova-core/vbios.rs @@ -338,7 +338,6 @@ pub(crate) fn new(dev: &device::Device, bar0: &Bar0) -> Result { Ok(BiosImageType::FwSec) => { let fwsec = FwSecBiosBuilder { base: image, - pmu_lookup_table: None, falcon_ucode_offset: None, }; if first_fwsec_image.is_none() { @@ -711,8 +710,6 @@ struct FwSecBiosBuilder { /// Once FwSecBiosBuilder is constructed, the `falcon_ucode_offset` will be copied into a new /// [`FwSecBiosImage`]. /// - /// The [`PmuLookupTable`] starts at the offset of the falcon data pointer. - pmu_lookup_table: Option, /// The offset of the Falcon ucode. falcon_ucode_offset: Option, } @@ -1012,24 +1009,14 @@ fn setup_falcon_data( offset -= first_fwsec.base.data.len(); } - if pmu_in_first_fwsec { - self.pmu_lookup_table = Some(PmuLookupTable::new( - &self.base.dev, - &first_fwsec.base.data[offset..], - )?); + let pmu_lookup_data = if pmu_in_first_fwsec { + &first_fwsec.base.data[offset..] } else { - self.pmu_lookup_table = Some(PmuLookupTable::new( - &self.base.dev, - &self.base.data[offset..], - )?); - } + self.base.data.get(offset..).ok_or(EINVAL)? + }; + let pmu_lookup_table = PmuLookupTable::new(&self.base.dev, pmu_lookup_data)?; - match self - .pmu_lookup_table - .as_ref() - .ok_or(EINVAL)? - .find_entry_by_type(FALCON_UCODE_ENTRY_APPID_FWSEC_PROD) - { + match pmu_lookup_table.find_entry_by_type(FALCON_UCODE_ENTRY_APPID_FWSEC_PROD) { Ok(entry) => { self.falcon_ucode_offset = Some( usize::from_safe_cast(entry.data)