[PATCH v3 1/1] gpu: nova-core: populate VF information in GSP_INIT
From: Zhi Wang
Date: Mon Oct 19 2026 - 14:15:47 EST
GSP firmware requires the VF BAR layout to route interrupts and doorbell
events to individual virtual functions.
When vGPU mode is enabled, read the VF topology from the typed PCI SR-IOV
extended capability and populate the existing NVKV VF information schema
in GSP_INIT.
Link: https://lore.kernel.org/nova-gpu/20260730181404.776028-2-zhiw@xxxxxxxxxx/
Cc: Alexandre Courbot <acourbot@xxxxxxxxxx>
Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx>
---
drivers/gpu/nova-core/gsp/fw/commands.rs | 34 +++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
index 159f132d79d9..9ad730e22337 100644
--- a/drivers/gpu/nova-core/gsp/fw/commands.rs
+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
@@ -225,6 +225,38 @@ struct DomainBusDevice(u64) {
];
impl GspInitRequest {
+ fn build_vf_info(
+ dev: &pci::Device<device::Bound>,
+ vgpu_state: VgpuState,
+ ) -> Result<Option<VfInfo>> {
+ let total_vfs = match vgpu_state {
+ VgpuState::Disabled => return Ok(None),
+ VgpuState::Enabled { total_vfs } => total_vfs,
+ };
+
+ let sriov = dev
+ .config_space_extended()?
+ .find_ext_capability::<pci::ExtSriovRegs>()?
+ .ok_or(ENODEV)?;
+
+ let mut vf_bars = sriov.vf_bars()?;
+ let bar0 = vf_bars.next().ok_or(EINVAL)?;
+ let bar1 = vf_bars.next().ok_or(EINVAL)?;
+ let bar2 = vf_bars.next().ok_or(EINVAL)?;
+ let flags = u64::from(bar0.is_64bit)
+ | (u64::from(bar1.is_64bit) << 1)
+ | (u64::from(bar2.is_64bit) << 2);
+
+ Ok(Some(VfInfo {
+ total_vfs: u32::from(total_vfs.get()).into(),
+ first_vf_offset: u32::from(sriov.first_vf_offset()).into(),
+ flags: flags.into(),
+ first_bar0_address: bar0.address.into(),
+ first_bar1_address: bar1.address.into(),
+ first_bar2_address: bar2.address.into(),
+ }))
+ }
+
/// Creates the request for `dev`.
///
/// The registry keys are [`REGISTRY_ENTRIES`], plus `RMSetSriovMode` when `vgpu_state` reports
@@ -265,7 +297,7 @@ pub(crate) fn new(
host_arch: HostArch::host().into(),
domain_bus_device: u64::from(domain_bus_device).into(),
regkeys,
- vf_info: None,
+ vf_info: Self::build_vf_info(dev, vgpu_state)?,
})
}
}