[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ed3795e-283a-45ba-83c5-6d35622b56ba@nvidia.com>
Date: Tue, 20 May 2025 02:35:29 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: Timur Tabi <ttabi@...dia.com>, "dakr@...nel.org" <dakr@...nel.org>,
"a.hindborg@...nel.org" <a.hindborg@...nel.org>,
"ojeda@...nel.org" <ojeda@...nel.org>,
"boqun.feng@...il.com" <boqun.feng@...il.com>,
"simona@...ll.ch" <simona@...ll.ch>, "tmgross@...ch.edu"
<tmgross@...ch.edu>, "alex.gaynor@...il.com" <alex.gaynor@...il.com>,
"tzimmermann@...e.de" <tzimmermann@...e.de>, "corbet@....net"
<corbet@....net>, "mripard@...nel.org" <mripard@...nel.org>,
"maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
"benno.lossin@...ton.me" <benno.lossin@...ton.me>,
"bjorn3_gh@...tonmail.com" <bjorn3_gh@...tonmail.com>,
"airlied@...il.com" <airlied@...il.com>,
"aliceryhl@...gle.com" <aliceryhl@...gle.com>,
Alexandre Courbot <acourbot@...dia.com>, "gary@...yguo.net"
<gary@...yguo.net>
Cc: Shirish Baskaran <sbaskaran@...dia.com>,
Alistair Popple <apopple@...dia.com>, John Hubbard <jhubbard@...dia.com>,
"rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Ben Skeggs <bskeggs@...dia.com>
Subject: Re: [PATCH v3 16/19] nova-core: Add support for VBIOS ucode
extraction for boot
On 5/16/2025 4:38 PM, Timur Tabi wrote:
> n Wed, 2025-05-07 at 22:52 +0900, Alexandre Courbot wrote:
>> +impl FwSecBiosImage {
>> + fn setup_falcon_data(
>> + &mut self,
>> + pdev: &pci::Device,
>> + pci_at_image: &PciAtBiosImage,
>> + first_fwsec_image: &FwSecBiosImage,
>> + ) -> Result<()> {
>> + let mut offset = pci_at_image.falcon_data_ptr(pdev)? as usize;
>> +
>> + // The falcon data pointer assumes that the PciAt and FWSEC images
>> + // are contiguous in memory. However, testing shows the EFI image sits in
>> + // between them. So calculate the offset from the end of the PciAt image
>> + // rather than the start of it. Compensate.
>> + offset -= pci_at_image.base.data.len();
>> +
>> + // The offset is now from the start of the first Fwsec image, however
>> + // the offset points to a location in the second Fwsec image. Since
>> + // the fwsec images are contiguous, subtract the length of the first Fwsec
>> + // image from the offset to get the offset to the start of the second
>> + // Fwsec image.
>> + offset -= first_fwsec_image.base.data.len();
>> +
>> + self.falcon_data_offset = Some(offset);
>> +
>> + // The PmuLookupTable starts at the offset of the falcon data pointer
>> + self.pmu_lookup_table = Some(PmuLookupTable::new(&self.base.data[offset..])?);
>> +
>> + match self
>> + .pmu_lookup_table
>> + .as_ref()
>> + .ok_or(EINVAL)?
>> + .find_entry_by_type(FALCON_UCODE_ENTRY_APPID_FWSEC_PROD)
>> + {
>> + Ok(entry) => {
>> + let mut ucode_offset = entry.data as usize;
>> + ucode_offset -= pci_at_image.base.data.len();
>> + ucode_offset -= first_fwsec_image.base.data.len();
>> + self.falcon_ucode_offset = Some(ucode_offset);
>> + if cfg!(debug_assertions) {
>> + // Print the v3_desc header for debugging
>> + let v3_desc = self.fwsec_header(pdev.as_ref())?;
>> + pr_info!("PmuLookupTableEntry v3_desc: {:#?}\n", v3_desc);
>> + }
>> + }
>> + Err(e) => {
>> + dev_err!(
>> + pdev.as_ref(),
>> + "PmuLookupTableEntry not found, error: {:?}\n",
>> + e
>> + );
> Shouldn't you return an error here?
>
> If not, then maybe this should probably be dev_warn.
Good catch, fixed! Thanks,
- Joel
Powered by blists - more mailing lists