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>, <rust-for-linux@vger.kernel.org>,
<zhiwang@kernel.org>, Zhi Wang <zhiw@nvidia.com>
Subject: [PATCH 00/14] Add Rust PCI SR-IOV support
Date: Tue, 15 Sep 2026 23:56:44 +0300 [thread overview]
Message-ID: <20260915205659.76841-1-zhiw@nvidia.com> (raw)
Rust PCI drivers need to enable and disable SR-IOV and share selected
PF-owned functionality with their VF drivers. The shared data must remain
valid while a VF driver is bound, including when the VF driver is in C.
This series builds on Peter Colberg's Rust PCI SR-IOV v3 series [1],
extending it with typed PF registration data and C FFI support. The
registration design follows Danilo Krummrich's Rust vGPU/VFIO PoC [2].
As the discussion on Rust/VFIO support is still ongoing [3], this series
supports both C and Rust sample VF drivers.
Add the PCI SR-IOV operations and callback, managed VF removal during PF
unbind, and typed PF registration data. A pinned registration publishes
the PF payload. Rust VFs borrow the typed data directly; C VFs use an
ABI-checked descriptor and generated C-to-Rust trampolines.
Include Rust and C VF samples and integrate the registration into
nova-core. Nova implements sriov_configure() and publishes PF-readiness
data before VFs are enabled. Document the sharing interface, its borrow
lifetimes and teardown ordering.
[1] https://lore.kernel.org/rust-for-linux/20260303-rust-pci-sriov-v3-0-4443c35f0c88@redhat.com/
[2] https://lore.kernel.org/nova-gpu/DLCRZLO06SIO.LS7TWQXIPZSQ@kernel.org/
[3] https://lore.kernel.org/nova-gpu/20260914121217.70fa0d93@shazbot.org/
John Hubbard (1):
rust: pci: add is_virtfn(), to check for VFs
Peter Colberg (7):
PCI: add driver flag to opt into disabling SR-IOV on remove()
rust: pci: add {enable,disable}_sriov(), to control SR-IOV capability
rust: pci: add vtable attribute to pci::Driver trait
rust: pci: add bus callback sriov_configure(), to control SR-IOV from
sysfs
rust: pci: add is_physfn(), to check for PFs
rust: pci: add num_vf(), to return number of VFs
samples: rust: add Rust SR-IOV VF driver sample
Zhi Wang (6):
rust: pci: add typed SR-IOV PF registration data
rust: add C-to-Rust FFI descriptors and trampolines
rust: pci: add C FFI support to typed SR-IOV PF registration data
samples: rust: add C SR-IOV VF driver that calls into a Rust PF driver
gpu: nova-core: publish typed SR-IOV PF data for VF drivers
Documentation: rust: explain SR-IOV PF data sharing with VFs
Documentation/rust/index.rst | 1 +
Documentation/rust/pci-sriov-pf-data.rst | 330 +++++++++++++++++++++
MAINTAINERS | 4 +
drivers/gpu/nova-core/driver.rs | 34 ++-
drivers/pci/iov.c | 103 ++++++-
drivers/pci/pci-driver.c | 3 +-
drivers/pci/pci.h | 2 +
include/linux/pci.h | 44 +++
include/linux/rust_ffi.h | 88 ++++++
rust/bindings/bindings_helper.h | 5 +
rust/kernel/interop.rs | 5 +-
rust/kernel/interop/ffi.rs | 252 ++++++++++++++++
rust/kernel/pci.rs | 126 ++++++++
rust/kernel/pci/sriov.rs | 355 +++++++++++++++++++++++
rust/macros/ffi_vtable.rs | 148 ++++++++++
rust/macros/lib.rs | 90 ++++++
samples/rust/Kconfig | 26 ++
samples/rust/Makefile | 2 +
samples/rust/rust_dma.rs | 1 +
samples/rust/rust_driver_auxiliary.rs | 1 +
samples/rust/rust_driver_pci.rs | 1 +
samples/rust/rust_driver_sriov.h | 27 ++
samples/rust/rust_driver_sriov.rs | 270 +++++++++++++++++
samples/rust/rust_driver_sriov_c_vf.c | 61 ++++
24 files changed, 1972 insertions(+), 7 deletions(-)
create mode 100644 Documentation/rust/pci-sriov-pf-data.rst
create mode 100644 include/linux/rust_ffi.h
create mode 100644 rust/kernel/interop/ffi.rs
create mode 100644 rust/kernel/pci/sriov.rs
create mode 100644 rust/macros/ffi_vtable.rs
create mode 100644 samples/rust/rust_driver_sriov.h
create mode 100644 samples/rust/rust_driver_sriov.rs
create mode 100644 samples/rust/rust_driver_sriov_c_vf.c
base-commit: 34a8ecc902e907d7b0596a8d38b437e90eac0701
next reply other threads:[~2026-09-15 20:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 20:56 Zhi Wang [this message]
2026-09-15 20:56 ` [PATCH 01/14] PCI: add driver flag to opt into disabling SR-IOV on remove() Zhi Wang
2026-09-15 20:56 ` [PATCH 02/14] rust: pci: add {enable,disable}_sriov(), to control SR-IOV capability Zhi Wang
2026-09-15 20:56 ` [PATCH 03/14] rust: pci: add vtable attribute to pci::Driver trait Zhi Wang
2026-09-15 20:56 ` [PATCH 04/14] rust: pci: add bus callback sriov_configure(), to control SR-IOV from sysfs Zhi Wang
2026-09-15 20:56 ` [PATCH 05/14] rust: pci: add is_virtfn(), to check for VFs Zhi Wang
2026-09-15 20:56 ` [PATCH 06/14] rust: pci: add is_physfn(), to check for PFs Zhi Wang
2026-09-15 20:56 ` [PATCH 07/14] rust: pci: add num_vf(), to return number of VFs Zhi Wang
2026-09-15 20:56 ` [PATCH 08/14] rust: pci: add typed SR-IOV PF registration data Zhi Wang
2026-09-15 20:56 ` [PATCH 09/14] samples: rust: add Rust SR-IOV VF driver sample Zhi Wang
2026-09-15 20:56 ` [PATCH 10/14] rust: add C-to-Rust FFI descriptors and trampolines Zhi Wang
2026-09-15 20:56 ` [PATCH 11/14] rust: pci: add C FFI support to typed SR-IOV PF registration data Zhi Wang
2026-09-15 20:56 ` [PATCH 12/14] samples: rust: add C SR-IOV VF driver that calls into a Rust PF driver Zhi Wang
2026-09-15 20:56 ` [PATCH 13/14] gpu: nova-core: publish typed SR-IOV PF data for VF drivers Zhi Wang
2026-09-15 20:56 ` [PATCH 14/14] Documentation: rust: explain SR-IOV PF data sharing with VFs Zhi Wang
2026-09-16 11:10 ` [PATCH 00/14] Add Rust PCI SR-IOV support Danilo Krummrich
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=20260915205659.76841-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=rust-for-linux@vger.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®