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 <joelagnelf@nvidia.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
Link: https://patch.msgid.link/20260525-fix-vbios-v5-9-e5e455251537@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
Eliot Courtney 2026-05-25 22:57:27 +09:00 committed by Danilo Krummrich
parent 56f7c0b380
commit 8cf15cf264

View File

@ -338,7 +338,6 @@ pub(crate) fn new(dev: &device::Device, bar0: &Bar0) -> Result<Vbios> {
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<PmuLookupTable>,
/// The offset of the Falcon ucode.
falcon_ucode_offset: Option<usize>,
}
@ -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)