mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Rust VFIO PCI support and NVIDIA vGPU driver
@ 2026-11-27 22:49 Simon Song
  2026-11-27 22:49 ` [PATCH v4 1/5] rust: vfio: add common VFIO device handling Simon Song
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Simon Song @ 2026-11-27 22:49 UTC (permalink / raw)
  To: dakr, acourbot, kvm, rust-for-linux, nova-gpu, linux-pci
  Cc: Simon Song, alex, jgg, yishaih, skolothumtho, kevin.tian,
	airlied, simona, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh,
	lossin, a.hindborg, aliceryhl, tmgross, jhubbard, ecourtney,
	cjia, smitra, kjaju, alkumar, ankita, aniketa, kwankhede,
	targupta, linux-kernel, zhiwang, zhiw, boqun, daniel.almeida,
	tamird, work, jgg, bhelgaas, kwilczynski, dri-devel, peter,
	Liam R. Howlett, linux-mm, Lorenzo Stoakes

This is v4 of the Rust VFIO PCI abstractions and the NVIDIA VFIO variant
driver [1]. The driver uses nova-core's typed SR-IOV PF interface to
create, reset and release vGPU instances while VFIO provides userspace
access to the PCI device.

Patches 1-5 of v3 were applied to driver-core-next, so this version
carries the remaining patches. Patch 1 adds the VFIO device handling
common to all buses. Patch 2 adds two VmaRef accessors for patch 3, the
VFIO PCI abstractions. Patch 4 publishes the typed Nova PF interface,
and patch 5 adds the NVIDIA VFIO variant driver.

This series is based on driver-core-next. Patches 1-3 need nothing else.
Patches 4 and 5 also depend on v5 of Alok's vGPU manager series [2] and
can follow once it has landed.

Runtime PM is still not part of this series. It will follow once the
generic Rust runtime PM support [3] and the PCI bus handling for it are
available. Until then, vfio::pci::Registration keeps the device runtime
active while it is registered.

Changes since v3:
- Drop v3 patches 1-5, which were applied (Danilo).
- New patch 2: add VmaRef::size() and VmaRef::pgoff(), split out of the
  VFIO PCI abstractions (Danilo).
- Patches 1 and 3: build the abstractions only if VFIO and the VFIO PCI
  core are built in, until the new build system is available (Danilo).
- Patch 1 (v3 patch 6):
  - Remove RawDevice and make the layout a type invariant of DeviceBase
    (Danilo).
  - Add vfio::Operations with the RegistrationData and OpenData types,
    and drop the R and O parameters of DeviceBase (Danilo).
  - Use Option<NonNull<_>> for the open data, expect() instead of
    unwrap_unchecked(), KBox::pin_init(), and one unsafe block per
    operation (Danilo).
  - Reword the type invariants, justify them with INVARIANT comments,
    and hide DeviceBase from the documentation (Danilo).
- Patch 3 (v3 patch 7):
  - Let vfio::pci::Operations extend vfio::Operations, and name the
    lifetimes 'reg and 'open (Danilo).
  - Make the I/O callbacks optional with #[vtable]. An unimplemented
    callback leaves the VFIO hook unset (Danilo).
  - Use the VmaRef accessors of patch 2 (Danilo), and let Mapping wrap a
    VmaNew (Alice).
  - Use from_result() in the callbacks and const_assert!() in
    Registration::new() (Danilo).
  - Remove RuntimeActive and call the runtime PM functions from
    Registration (Danilo).
  - Add the optional dmabuf_len() callback, which lets a driver limit
    how much of a region can be exported as a DMA buffer, and remove
    Device::new_passthrough() (Alex).
- Patch 4 (v3 patch 8): rebase onto v5 of the vGPU manager series [2].
- Patch 5 (v3 patch 9):
  - Match the two supported device IDs instead of every NVIDIA device
    (Alex).
  - Reject a BAR1 size that is not a power of two, and report the
    virtual BAR1 size when the BAR is sized through config space
    (Alex).
  - Clear a reset error at the next reset, and do not treat hot reset
    specially (Alex).
  - Reset the vGPU instance in reset_done(), after the PCI reset,
    instead of in reset_prepare() (Alex).
  - Support DMA buffer export, limited to the BAR1 aperture of the vGPU.
    The VFIO PCI core revokes the exports at the last close, after the
    driver has destroyed the instance (Alex).
  - Do no vGPU setup for a passthrough device, do not signal the VFIO
    error eventfd from reset_done(), and name the module authors
    (Alex).
  - Depend on VFIO_PCI_CORE=y, following patch 3.

v3 patches 6, 7, 8 and 9 are now patches 1, 3, 4 and 5.

Link: https://lore.kernel.org/nova-gpu/20261119215046.2892839-1-xinmengs@nvidia.com/ [1]
Link: https://lore.kernel.org/nova-gpu/20261124135937.18583-1-alkumar@nvidia.com/ [2]
Link: https://lore.kernel.org/all/20261124113555.2480381-1-beata.michalska@arm.com/ [3]

Danilo Krummrich (2):
  rust: vfio: add PCI variant driver abstractions
  vfio/nova-vgpu: add the Rust VFIO variant driver

Simon Song (1):
  rust: mm: add VmaRef::size() and VmaRef::pgoff()

Zhi Wang (2):
  rust: vfio: add common VFIO device handling
  gpu: nova-core: publish typed SR-IOV PF APIs

 drivers/gpu/Makefile                    |  15 +-
 drivers/gpu/nova-core/driver.rs         |  34 +-
 drivers/gpu/nova-core/nova_core.rs      |   3 +-
 drivers/gpu/nova-core/vgpu.rs           |   1 -
 drivers/gpu/nova-core/vgpu/vgpu_api.rs  | 171 +++--
 drivers/vfio/pci/Kconfig                |   2 +
 drivers/vfio/pci/Makefile               |   2 +
 drivers/vfio/pci/nova-vgpu/Kconfig      |  20 +
 drivers/vfio/pci/nova-vgpu/Makefile     |   3 +
 drivers/vfio/pci/nova-vgpu/nova_vgpu.rs | 418 ++++++++++++
 rust/bindings/bindings_helper.h         |   4 +
 rust/kernel/lib.rs                      |   2 +
 rust/kernel/mm/virt.rs                  |  14 +
 rust/kernel/pci.rs                      |  12 +
 rust/kernel/vfio.rs                     | 462 ++++++++++++++
 rust/kernel/vfio/pci.rs                 | 812 ++++++++++++++++++++++++
 16 files changed, 1930 insertions(+), 45 deletions(-)
 create mode 100644 drivers/vfio/pci/nova-vgpu/Kconfig
 create mode 100644 drivers/vfio/pci/nova-vgpu/Makefile
 create mode 100644 drivers/vfio/pci/nova-vgpu/nova_vgpu.rs
 create mode 100644 rust/kernel/vfio.rs
 create mode 100644 rust/kernel/vfio/pci.rs

-- 
2.43.7


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-27 22:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 22:49 [PATCH v4 0/5] Rust VFIO PCI support and NVIDIA vGPU driver Simon Song
2026-11-27 22:49 ` [PATCH v4 1/5] rust: vfio: add common VFIO device handling Simon Song
2026-11-27 22:49 ` [PATCH v4 2/5] rust: mm: add VmaRef::size() and VmaRef::pgoff() Simon Song
2026-11-27 22:49 ` [PATCH v4 3/5] rust: vfio: add PCI variant driver abstractions Simon Song
2026-11-27 22:49 ` [PATCH v4 4/5] gpu: nova-core: publish typed SR-IOV PF APIs Simon Song
2026-11-27 22:49 ` [PATCH v4 5/5] vfio/nova-vgpu: add the Rust VFIO variant driver Simon Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®