Re: [PATCH v6 03/34] gpu: nova-core: vgpu: decouple boot state from the manager
From: Eliot Courtney
Date: Wed Dec 02 2026 - 22:43:07 EST
On Wed Dec 2, 2026 at 5:28 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. The mode must be available before resource allocation,
> even when vGPU is disabled, but neither boot nor unload needs the runtime
> manager.
>
> Move state detection into VgpuState and store the result in GspResources.
> Copy the state into GspBootContext, removing its dependency on VgpuManager
> and keeping the state available throughout the firmware lifecycle.
>
> No functional change is intended.
>
> Cc: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx>
> Signed-off-by: Alok Kumar <alkumar@xxxxxxxxxx>
> ---
> drivers/gpu/nova-core/fb.rs | 2 +-
> drivers/gpu/nova-core/gpu.rs | 11 +++++-----
> drivers/gpu/nova-core/gsp.rs | 4 ++--
> drivers/gpu/nova-core/gsp/fw/commands.rs | 4 ++--
> drivers/gpu/nova-core/vgpu.rs | 26 ++++++++----------------
> 5 files changed, 19 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
> index e4ff5c4d35ff..fa7f285c44b8 100644
> --- a/drivers/gpu/nova-core/fb.rs
> +++ b/drivers/gpu/nova-core/fb.rs
> @@ -295,7 +295,7 @@ pub(crate) fn wpr2_range(bar: Bar0<'_>) -> Option<Range<u64>> {
>
> /// Computes the number of VF partitions and the WPR2 heap size from the vGPU state.
> fn wpr2_heap_params(ctx: &gsp::GspBootContext<'_, '_>, fb_size: u64) -> Result<(u8, u64)> {
> - Ok(match ctx.vgpu.state() {
> + Ok(match ctx.vgpu_state {
> VgpuState::Disabled => (
> 0,
> gsp::LibosParams::from_chipset(ctx.chipset).wpr_heap_size(ctx.chipset, fb_size)?,
> diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
> index e4db5ce47316..debfc8089b2e 100644
> --- a/drivers/gpu/nova-core/gpu.rs
> +++ b/drivers/gpu/nova-core/gpu.rs
> @@ -53,7 +53,7 @@
> Timer,
> TimerState, //
> },
> - vgpu::VgpuManager, //
> + vgpu::VgpuState,
> };
>
> #[cfg_attr(not(CONFIG_KUNIT = "y"), expect(dead_code))]
> @@ -335,8 +335,7 @@ struct GspResources<'gpu> {
> fsp: Option<Fsp<'gpu>>,
> /// Timer state - contains system timer offset
> timer: TimerState,
> - /// vGPU state detected before GSP boot.
> - vgpu: VgpuManager,
> + vgpu_state: VgpuState,
Please keep/update doccomment. Thanks!
> /// GSP runtime data.
> #[pin]
> gsp: Gsp<'gpu>,
> @@ -436,7 +435,7 @@ fn drop(self: Pin<&mut Self>) {
> gsp_falcon: &*this.gsp_falcon,
> sec2_falcon: &*this.sec2_falcon,
> fsp: this.fsp.as_mut(),
> - vgpu: &*this.vgpu,
> + vgpu_state: *this.vgpu_state,
> },
> bundle,
> )
> @@ -495,7 +494,7 @@ pub(crate) fn new<'a>(
>
> timer: Timer::setup(dev, bar, spec.chipset, fsp.as_ref())?,
>
> - vgpu: VgpuManager::new(pdev, spec.chipset, fsp.as_mut()),
> + vgpu_state: VgpuState::detect(pdev, spec.chipset, fsp.as_mut()),
Is there a good reason to change these names to `VgpuState::detect` and
`VgpuState::query_state`? If not I would just leave them - we have a
bunch of other usages of ::new which do actual work, so I think it's
consistent to leave it as ::new.
With above changes:
Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>