Re: [PATCH v3 5/7] gpu: nova-core: transition gen_bootloader to TLV images
"Alexandre Courbot" <[email protected]>
| Newsgroups | dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Fri Jul 3, 2026 at 4:27 AM JST, Timur Tabi wrote:
<...>
> /// Structure used by the boot-loader to load the rest of the code.
> ///
> /// This has to be filled by the GPU driver and copied into DMEM at offset
> @@ -146,38 +121,23 @@ pub(crate) fn new(
> dev: &Device<device::Bound>,
> chipset: Chipset,
> ) -> Result<Self> {
> - let fw = request_firmware(dev, chipset, "gen_bootloader", FIRMWARE_VERSION)?;
> - let hdr = fw
> - .data()
> - .get(0..size_of::<BinHdr>())
> - .and_then(BinHdr::from_bytes_copy)
> - .ok_or(EINVAL)?;
> -
> - let desc = {
> - let desc_offset = usize::from_safe_cast(hdr.header_offset);
> -
> - fw.data()
> - .get(desc_offset..)
> - .and_then(BootloaderDesc::from_bytes_copy_prefix)
> - .ok_or(EINVAL)?
> - .0
> - };
> + let fw = request_tlv(dev, chipset, "gen_bootloader")?;
> + let tlv = Tlv::new(fw.data())?;
> + dev_info!(
> + dev,
> + "loaded generic bootloader firmware v{}\n",
> + tlv.get_string(b"VERS")?
> + );
s/dev_info/dev_dbg.
Also, since `dev_dbg` can be compiled out, the check performed on the
`VERS` tag existing is not guaranteed to be performed. We should
probably extract it out of the `dev_dbg` statement. This is true across
the series; which makes me think it might also benefit from a helper to
factor out the request_t.v/Tlv::new/dev_dbg common sequence.