mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhi Wang <zhiw@nvidia.com>
To: <dakr@kernel.org>, <acourbot@nvidia.com>
Cc: <alex@shazbot.org>, <jgg@nvidia.com>, <yishaih@nvidia.com>,
	<skolothumtho@nvidia.com>, <kevin.tian@intel.com>,
	<airlied@gmail.com>, <simona@ffwll.ch>, <ojeda@kernel.org>,
	<alex.gaynor@gmail.com>, <boqun.feng@gmail.com>,
	<gary@garyguo.net>, <bjorn3_gh@protonmail.com>,
	<lossin@kernel.org>, <a.hindborg@kernel.org>,
	<aliceryhl@google.com>, <tmgross@umich.edu>,
	<jhubbard@nvidia.com>, <ecourtney@nvidia.com>, <cjia@nvidia.com>,
	<smitra@nvidia.com>, <kjaju@nvidia.com>, <alkumar@nvidia.com>,
	<ankita@nvidia.com>, <aniketa@nvidia.com>, <kwankhede@nvidia.com>,
	<targupta@nvidia.com>, <nova-gpu@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <zhiwang@kernel.org>,
	Zhi Wang <zhiw@nvidia.com>
Subject: [PATCH 0/2] Nova vGPU lifecycle FFI and the NVIDIA VFIO driver
Date: Wed, 16 Sep 2026 00:18:08 +0300	[thread overview]
Message-ID: <20260915211811.84790-1-zhiw@nvidia.com> (raw)

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@shazbot.org/
[2] https://lore.kernel.org/nova-gpu/20260914121217.70fa0d93@shazbot.org/
[3] https://lore.kernel.org/all/20260915205659.76841-1-zhiw@nvidia.com/

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

             reply	other threads:[~2026-09-15 21:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 21:18 Zhi Wang [this message]
2026-09-15 21:18 ` [PATCH 1/2] gpu: nova-core: vgpu: export lifecycle operations to VFIO Zhi Wang
2026-09-15 21:18 ` [PATCH 2/2] vfio/nvidia-vgpu: add the NVIDIA vGPU VFIO variant driver Zhi Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260915211811.84790-1-zhiw@nvidia.com \
    --to=zhiw@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=alex@shazbot.org \
    --cc=aliceryhl@google.com \
    --cc=alkumar@nvidia.com \
    --cc=aniketa@nvidia.com \
    --cc=ankita@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=cjia@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jgg@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kjaju@nvidia.com \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=skolothumtho@nvidia.com \
    --cc=smitra@nvidia.com \
    --cc=targupta@nvidia.com \
    --cc=tmgross@umich.edu \
    --cc=yishaih@nvidia.com \
    --cc=zhiwang@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®