Re: [PATCH v7 07/31] gpu: nova-core: move firmware image parsing code to firmware.rs
From: Alexandre Courbot
Date: Wed Mar 25 2026 - 07:14:37 EST
On Wed Mar 25, 2026 at 12:30 PM JST, John Hubbard wrote:
> On 3/23/26 6:19 AM, Alexandre Courbot wrote:
>> On Wed Mar 18, 2026 at 7:53 AM JST, John Hubbard wrote:
>>> Up until now, only the GSP required parsing of its firmware headers.
>>> However, upcoming support for Hopper/Blackwell+ adds another firmware
>>> image (FMC), along with another format (ELF32).
>>>
>>> Therefore, the current ELF64 section parsing support needs to be moved
>>> up a level, so that both of the above can use it.
>>>
>>> There are no functional changes. This is pure code movement.
>>>
>>> Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
>>> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
>>> ---
>>> drivers/gpu/nova-core/firmware.rs | 88 +++++++++++++++++++++++++
>>> drivers/gpu/nova-core/firmware/gsp.rs | 93 ++-------------------------
>>> 2 files changed, 94 insertions(+), 87 deletions(-)
>>>
>>> diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova-core/firmware.rs
>>> index 2bb20081befd..177b8ede151c 100644
>>> --- a/drivers/gpu/nova-core/firmware.rs
>>> +++ b/drivers/gpu/nova-core/firmware.rs
>>> @@ -457,3 +457,91 @@ pub(crate) const fn create(
>>> this.0
>>> }
>>> }
>>> +
>>> +/// Ad-hoc and temporary module to extract sections from ELF images.
>>> +///
>>> +/// Some firmware images are currently packaged as ELF files, where sections names are used as keys
>>> +/// to specific and related bits of data. Future firmware versions are scheduled to move away from
>>> +/// that scheme before nova-core becomes stable, which means this module will eventually be
>>> +/// removed.
>>> +mod elf {
>>> + use core::mem::size_of;
>>
>> This import is not needed, `size_of` is already in the prelude.
>
>
> The `mod elf` block is a nested module that doesn't have `use
> kernel::prelude::*;` in scope, so `size_of` isn't available without the
> explicit import.
>
> Or some it seems. I'm not experienced with the module scoping game,
> and so I may have it wrong.
No, you are correct; removing them works fine with the latest Rust, so I
assumed they were unneeded - but 1.78 fails to build without them.