Re: [PATCH v2 03/12] gpu: nova-core: place the generic bootloader at the top of IMEM
From: Alexandre Courbot
Date: Tue Nov 10 2026 - 07:13:01 EST
On Mon Nov 9, 2026 at 1:53 PM JST, Eliot Courtney wrote:
> On Sat Nov 7, 2026 at 6:47 PM JST, Alexandre Courbot wrote:
>> From: John Hubbard <jhubbard@xxxxxxxxxx>
>>
>> The generic bootloader was loaded right below the first 64 KiB of IMEM,
>> on the assumption that every falcon it runs on has a 64 KiB IMEM. The
>> r000 load-and-execute bootloader event can name any image for it to
>> load, and the bootloader must then sit above the blocks that the image
>> occupies, that is, in the last blocks of IMEM, regardless of its size.
>>
>> Place the bootloader at the top of the falcon's IMEM, using the IMEM
>> size that the HWCFG register reports, instead of assuming a 64 KiB IMEM.
>>
>> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
>> Reviewed-by: Timur Tabi <ttabi@xxxxxxxxxx>
>> Reviewed-by: Zhi Wang <zhiw@xxxxxxxxxx>
>> [acourbot: split out of the patch separating the bootloader from FWSEC;
>> convert the IMEM size with usize::from()]
>> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
>> ---
>
> [...]
>
>> impl GenericBootloader {
>> - /// Loads the generic bootloader image for `chipset`, placed right below the first 64 KiB of
>> + /// Loads the generic bootloader image for `chipset`, placed in the last blocks of `falcon`'s
>> /// IMEM.
>> ///
>> /// # Errors
>> ///
>> /// - `EINVAL` if a required TLV field is absent.
>> - /// - `EOVERFLOW` if the image does not fit below 64 KiB.
>> + /// - `EOVERFLOW` if the image does not fit in IMEM.
>> /// - `ENOMEM` if the padded copy of the code cannot be allocated.
>> - pub(crate) fn new(dev: &device::Device, chipset: Chipset) -> Result<Self> {
>> + pub(crate) fn new(
>> + dev: &device::Device,
>> + chipset: Chipset,
>> + falcon: &Falcon<'_, Gsp>,
>
> optional nit: `falcon` is passed twice in (`new` and `run`), so we
> could call `run` with a different `falcon` (which could have a
> different `imem_size` to the first one). we could just compute
> `imem_dst_start` in `run` and drop `falcon` from `new`.
Good idea. This looks better if we move this patch after patch 5 (which
introduces the `run` method), so I'll do that as well.