[PATCH 13/16] gpu: nova-core: Add support for VBIOS ucode extraction for boot

Joel Fernandes joelagnelf at nvidia.com
Thu Apr 24 18:54:42 UTC 2025



On 4/23/2025 10:06 AM, Danilo Krummrich wrote:
[...]
>> +
>> +    /// Probe for VBIOS extraction
>> +    /// Once the VBIOS object is built, bar0 is not read for vbios purposes anymore.
>> +    pub(crate) fn probe(bar0: &Devres<Bar0>) -> Result<Self> {
> 
> Let's not call it probe(), what about VBios::parse(), or simply VBios::new()?
> 

Yes, new() is better. I changed it.

>> +        // VBIOS data vector: As BIOS images are scanned, they are added to this vector
>> +        // for reference or copying into other data structures. It is the entire
>> +        // scanned contents of the VBIOS which progressively extends. It is used
>> +        // so that we do not re-read any contents that are already read as we use
>> +        // the cumulative length read so far, and re-read any gaps as we extend
>> +        // the length
>> +        let mut data = KVec::new();
>> +
>> +        // Loop through all the BiosImage and extract relevant ones and relevant data from them
>> +        let mut cur_offset = 0;
> 
> I suggest to create a new type that contains data and offset and implement
> read_bios_image_at_offset() and friends as methods of this type. I think this
> would turn out much cleaner.
I moved it into struct Vbios {} itself instead of introducing a new type. Is
that Ok?

I agree it is cleaner. Please see below link for this particular refactor
(moving data) and let me know if it looks Ok to you: http://bit.ly/4lHfDKZ

Thanks!

 - Joel



More information about the dri-devel mailing list