NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: Simon Song <xinmengs@nvidia.com>
To: <dakr@kernel.org>, <acourbot@nvidia.com>, <kvm@vger.kernel.org>,
	<rust-for-linux@vger.kernel.org>, <nova-gpu@lists.linux.dev>,
	<linux-pci@vger.kernel.org>
Cc: Simon Song <xinmengs@nvidia.com>, <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>, <linux-kernel@vger.kernel.org>,
	<zhiwang@kernel.org>, <zhiw@nvidia.com>, <boqun@kernel.org>,
	<daniel.almeida@collabora.com>, <tamird@kernel.org>,
	<work@onurozkan.dev>, <jgg@ziepe.ca>, <bhelgaas@google.com>,
	<kwilczynski@kernel.org>, <dri-devel@lists.freedesktop.org>,
	<peter@colberg.org>, "Liam R. Howlett" <liam@infradead.org>,
	<linux-mm@kvack.org>, Lorenzo Stoakes <ljs@kernel.org>
Subject: [PATCH v5 0/4] Rust VFIO PCI support
Date: Thu, 3 Dec 2026 20:17:20 -0800	[thread overview]
Message-ID: <20261204041727.4021092-1-xinmengs@nvidia.com> (raw)

This is v5 of the Rust VFIO PCI abstractions. v4 was posted as "Rust
VFIO PCI support and NVIDIA vGPU driver" [1].

Up to v4 this series also carried the nova-core SR-IOV PF interface and
the NVIDIA VFIO variant driver. Those two patches depend on Alok's vGPU
manager series [2], so the series did not apply to a public tree and
Sashiko could not review it. They will now be posted as a separate
series on top of this one. The four patches here have no external
dependencies and are based on drm-rust-next.

Patch 1 adds UserSlice helpers for bounded forward traversal. Patch 2
adds the VFIO device handling common to all buses. Patch 3 adds two
VmaRef accessors for patch 4, the VFIO PCI abstractions.

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 v4 [1]:
- Move the nova-core and nova-vgpu patches (v4 patches 4 and 5) to a
  separate series (Gary, Danilo).
- New patch 1: add UserSlice helpers for bounded forward traversal
  (Danilo).
- Patch 2 (v4 patch 1):
  - Remove UserBuf. The callbacks use UserSlice (Gary, Danilo).
  - Make InfoCap a transparent wrapper of struct vfio_info_cap (Gary).
  - Use 'res for the resource lifetime and 'reg for the registration
    lifetime (Gary, Danilo).
  - Do not name the hidden DeviceBase in the public documentation
    (Gary).
  - Use one module-level dead_code expectation (Gary).
  - Add #[inline] to the small DeviceBase accessors.
- Patch 3 (v4 patch 2): add Alice's Acked-by.
- Patch 4 (v4 patch 3):
  - Let Registration::new() allocate the VFIO device, and remove the
    public allocator (Gary, Danilo).
  - Give the Open context of open_device() its own lifetime, so that
    the open data cannot retain it (Gary).
  - Pass a UserSlice to read() and write() (Gary, Danilo).
  - Wrap struct vfio_region_info in RegionInfo (Gary).
  - Remove the unused DEVICE_PCI_HOT_RESET (Gary).
  - Assert that the device alignment fits the vmalloc fallback of
    kvzalloc() (Gary).
  - Check the bound driver at runtime in Registration::new() instead
    of the const assertions on the driver type, and add
    pci::Device::driver_has_managed_dma() and
    pci::Device::driver_has_sriov_configure() for that (Gary, Danilo).
  - Add #[inline] to the small Position, Mapping and Device helpers.

v4 patches 1, 2 and 3 are now patches 2, 3 and 4.

[1] https://lore.kernel.org/r/20261127224928.1511382-1-xinmengs@nvidia.com
[2] https://lore.kernel.org/all/cover.1796191007.git.alkumar@nvidia.com/
[3] https://lore.kernel.org/r/20261124113555.2480381-1-beata.michalska@arm.com

Danilo Krummrich (1):
  rust: vfio: add PCI variant driver abstractions

Simon Song (2):
  rust: uaccess: support bounded forward buffer traversal
  rust: mm: add VmaRef::size() and VmaRef::pgoff()

Zhi Wang (1):
  rust: vfio: add common VFIO device handling

 rust/bindings/bindings_helper.h |   3 +
 rust/kernel/lib.rs              |   2 +
 rust/kernel/mm/virt.rs          |  14 +
 rust/kernel/pci.rs              |  39 ++
 rust/kernel/uaccess.rs          |  44 +-
 rust/kernel/vfio.rs             | 366 +++++++++++++
 rust/kernel/vfio/pci.rs         | 880 ++++++++++++++++++++++++++++++++
 7 files changed, 1346 insertions(+), 2 deletions(-)
 create mode 100644 rust/kernel/vfio.rs
 create mode 100644 rust/kernel/vfio/pci.rs


base-commit: d9da44362d77bcbf1f5bfd2ba1c514e776fdb07c
-- 
2.43.7


             reply	other threads:[~2026-12-04  4:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  4:17 Simon Song [this message]
2026-12-04  4:17 ` [PATCH v5 1/4] rust: uaccess: support bounded forward buffer traversal Simon Song
2026-12-04  4:17 ` [PATCH v5 2/4] rust: vfio: add common VFIO device handling Simon Song
2026-12-05  4:19   ` sashiko-bot
2026-12-04  4:17 ` [PATCH v5 3/4] rust: mm: add VmaRef::size() and VmaRef::pgoff() Simon Song
2026-12-04  4:17 ` [PATCH v5 4/4] rust: vfio: add PCI variant driver abstractions Simon Song
2026-12-05  4:19   ` sashiko-bot

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=20261204041727.4021092-1-xinmengs@nvidia.com \
    --to=xinmengs@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=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=boqun@kernel.org \
    --cc=cjia@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jgg@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kjaju@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=kwilczynski@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=peter@colberg.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=skolothumtho@nvidia.com \
    --cc=smitra@nvidia.com \
    --cc=tamird@kernel.org \
    --cc=targupta@nvidia.com \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    --cc=yishaih@nvidia.com \
    --cc=zhiw@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