Re: [PATCH v4 03/32] gpu: nova-core: gsp: decouple boot context from VgpuManager

From: Alexandre Courbot

Date: Tue Nov 10 2026 - 23:31:26 EST


On Fri Nov 6, 2026 at 2:39 PM JST, Alok Kumar wrote:
> From: Zhi Wang <zhiw@xxxxxxxxxx>
>
> GSP boot uses the detected vGPU mode to size firmware resources and
> populate GSP_INIT. Carrying the whole manager in the boot and unload
> context couples these operations to its runtime interface.
>
> The boot code only needs read access to the mode, and unloading does
> not use the manager. A short state borrow is sufficient for both
> context construction sites.
>
> Make GspBootContext borrow VgpuState directly and read it in the
> VRAM and GSP_INIT helpers. Return a state reference from the
> manager without changing mode detection or the values passed to firmware.
>
> No functional change is intended.

This patch changes the signature of `state` right before it is removed
by the next patch, which looks a bit like churn. Both patches are
actually a single logical change and can be squashed together into a
single one - the diff actually reads better that way imho.

<...>
> diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
> index 9a6065bdac96..cac123cbeac4 100644
> --- a/drivers/gpu/nova-core/gsp.rs
> +++ b/drivers/gpu/nova-core/gsp.rs
> @@ -66,7 +66,7 @@
> fw::GspArgumentsPadded, //
> },
> num,
> - vgpu::VgpuManager, //
> + vgpu::VgpuState, //
> };
>
> pub(crate) const GSP_PAGE_SHIFT: usize = 12;
> @@ -85,7 +85,7 @@ pub(crate) struct GspBootContext<'ctx, 'gpu> {
> pub(crate) gsp_falcon: &'ctx Falcon<'gpu, GspFalcon>,
> pub(crate) sec2_falcon: &'ctx Falcon<'gpu, Sec2Falcon>,
> pub(crate) fsp: Option<&'ctx mut Fsp<'gpu>>,
> - pub(crate) vgpu: &'ctx VgpuManager,
> + pub(crate) vgpu_state: &'ctx VgpuState,

`VgpuState` is `Copy`, so let's store it by value. This will also remove
the dereferences done through this patch.