[PATCH 0/2] Nova vGPU lifecycle FFI and the NVIDIA VFIO driver
From: Zhi Wang
Date: Tue Sep 15 2026 - 17:23:53 EST
The NVIDIA vGPU VFIO driver is written in C and needs to invoke lifecycle
operations owned by the Rust nova-core PF driver. VFIO open creates and
boots a vGPU instance; reset resets it and scrubs guest VRAM, and close
shuts it down and releases its resources.
The discussion about implementing the VFIO driver in Rust or C is still
ongoing [2]. In the meantime, this series updates the patches to build on
"Add Rust PCI SR-IOV support" [3] and addresses Alex Williamson's review
comments [1, 2].
The first patch publishes these operations through NovaCoreVfApi in
Nova's typed SR-IOV registration. Managed SR-IOV keeps the operations and
their pinned context alive until the VF drivers have been removed.
The second patch adds the NVIDIA vGPU VFIO PCI variant. It uses the Nova
interface when the VF's PF provides a compatible one and supports
ordinary PCI passthrough otherwise. Configuration-space and BAR handling
stay within the variant; this series does not modify VFIO core.
Changes in response to Alex Williamson's review [1, 2]:
- Restrict matching to NVIDIA 10de:2bb5 in the 3D display class (0302).
PFs share this ID with VFs, so matched PFs and VFs without a compatible
Nova interface use vfio-pci-core passthrough instead of being
rejected by probe.
- Store the assigned PCI device ID in vconfig after enabling the
device, so configuration reads use the core's virtualized value.
- Enforce the assigned BAR1 aperture for read, write and mmap, using
the same limit reported by GET_REGION_INFO.
- Use reset_prepare/reset_done callbacks to cover configuration-space
FLR as well as reset ioctls. Serialize instance open and close with
the reset interval. Preserve firmware reset errors for reset ioctls
and signal the VFIO error IRQ when configured. These callbacks cannot
abort the PCI reset.
- Use SBDF naming and document the packed VF address. Remove the
redundant VF check from open; probe selects the appropriate ops.
Subsystem ID reads remain in the variant's configuration handler because
the core reads that field from hardware. The C driver preserves the
existing VFIO drvdata contract and adds no VFIO-specific pointer to
struct pci_dev.
The passthrough path uses vfio-pci-core defaults. This driver has its own
enable_sriov parameter and does not inherit vfio-pci's other module
options; full module-option parity remains open.
[1] https://lore.kernel.org/nova-gpu/20260908210044.6514a092@xxxxxxxxxxx/
[2] https://lore.kernel.org/nova-gpu/20260914121217.70fa0d93@xxxxxxxxxxx/
[3] https://lore.kernel.org/all/20260915205659.76841-1-zhiw@xxxxxxxxxx/
Zhi Wang (2):
gpu: nova-core: vgpu: export lifecycle operations to VFIO
vfio/nvidia-vgpu: add the NVIDIA vGPU VFIO variant driver
MAINTAINERS | 1 +
drivers/gpu/nova-core/driver.rs | 59 ++-
drivers/gpu/nova-core/gpu.rs | 58 ++-
drivers/gpu/nova-core/vgpu.rs | 7 +
drivers/gpu/nova-core/vgpu/commands.rs | 11 +-
drivers/gpu/nova-core/vgpu/fw/commands.rs | 1 +
drivers/gpu/nova-core/vgpu/instance.rs | 153 ++++++-
drivers/gpu/nova-core/vgpu/vgpu_api.rs | 235 ++++++++++
drivers/vfio/pci/Kconfig | 2 +
drivers/vfio/pci/Makefile | 2 +
drivers/vfio/pci/nvidia-vgpu/Kconfig | 21 +
drivers/vfio/pci/nvidia-vgpu/Makefile | 2 +
drivers/vfio/pci/nvidia-vgpu/main.c | 509 ++++++++++++++++++++++
include/drm/nvidia_vgpu.h | 51 +++
rust/bindings/bindings_helper.h | 1 +
15 files changed, 1084 insertions(+), 29 deletions(-)
create mode 100644 drivers/gpu/nova-core/vgpu/vgpu_api.rs
create mode 100644 drivers/vfio/pci/nvidia-vgpu/Kconfig
create mode 100644 drivers/vfio/pci/nvidia-vgpu/Makefile
create mode 100644 drivers/vfio/pci/nvidia-vgpu/main.c
create mode 100644 include/drm/nvidia_vgpu.h
base-commit: 4c627824f040e6bd4a10bff4b1c353cdfaf1fc15