Re: [PATCH v4 04/32] gpu: nova-core: vgpu: detect boot state independently

From: Alexandre Courbot

Date: Tue Nov 10 2026 - 23:34:10 EST


On Fri Nov 6, 2026 at 2:39 PM JST, Alok Kumar wrote:
<...>
> diff --git a/drivers/gpu/nova-core/vgpu.rs b/drivers/gpu/nova-core/vgpu.rs
> index 905b3a7331fd..b405ba49c490 100644
> --- a/drivers/gpu/nova-core/vgpu.rs
> +++ b/drivers/gpu/nova-core/vgpu.rs
> @@ -30,19 +30,16 @@ pub(crate) enum VgpuState {
> },
> }
>
> -/// vGPU state manager.
> -pub(crate) struct VgpuManager {
> - state: VgpuState,
> -}
> -
> -impl VgpuManager {
> - /// Creates a vGPU manager by querying SR-IOV and the FSP PRC vGPU knob.
> - pub(crate) fn new(
> +impl VgpuState {
> + /// Detects the boot mode, falling back to disabled if querying the device fails.
> + ///
> + /// Call after creating the FSP and before allocating GSP firmware resources.
> + pub(crate) fn detect(

I think `new` was a fine method name here as it is a constructor...

> pdev: &pci::Device<device::Core<'_>>,
> chipset: Chipset,
> fsp: Option<&mut Fsp<'_>>,
> ) -> Self {
> - let state = Self::detect_state(pdev, chipset, fsp).unwrap_or_else(|e| {
> + let state = Self::query_state(pdev, chipset, fsp).unwrap_or_else(|e| {
> dev_warn!(
> pdev,
> "vGPU state detection failed: {:?}; disabling vGPU\n",
> @@ -51,12 +48,11 @@ pub(crate) fn new(
> VgpuState::Disabled
> });
> dev_dbg!(pdev, "vGPU state: {:?}\n", state);
> -
> - Self { state }
> + state
> }
>
> /// Detects the vGPU state from the chipset, SR-IOV capability and FSP PRC knob.
> - fn detect_state(
> + fn query_state(

Here as well, I don't see a benefit in renaming this method.