[PATCH v2 0/8] Add Rust PCI SR-IOV support

Zhi Wang posted 8 patches 11 hours ago
MAINTAINERS                           |   1 +
drivers/gpu/nova-core/driver.rs       |   1 +
include/linux/pci.h                   |   7 +
rust/kernel/pci.rs                    | 145 +++++++++++++++
rust/kernel/pci/sriov.rs              | 253 ++++++++++++++++++++++++++
samples/rust/Kconfig                  |  11 ++
samples/rust/Makefile                 |   1 +
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.rs     | 241 ++++++++++++++++++++++++
11 files changed, 663 insertions(+)
create mode 100644 rust/kernel/pci/sriov.rs
create mode 100644 samples/rust/rust_driver_sriov.rs
[PATCH v2 0/8] Add Rust PCI SR-IOV support
Posted by Zhi Wang 11 hours ago
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.

This series builds on Peter Colberg's Rust PCI SR-IOV v3 series [1],
extending it with typed PF registration data. The registration design
follows Danilo Krummrich's Rust vGPU/VFIO PoC [2].

Add the PCI SR-IOV operations and callback, VF removal before PF unbind,
and typed PF registration data. A pinned VfRegistration publishes the PF
data before VFs are enabled. Rust VF drivers borrow that data after a
type check. Include a Rust PF/VF sample that demonstrates a VF calling
an operation provided by its PF, using QEMU's 82576 emulation.

Changes since v1 [3]:
- Rebase the generic PCI support and Rust sample onto driver-core-testing.
- Drop the generic C FFI descriptors, C PF-data accessor and C VF sample.
- Remove the managed_sriov driver flag and PF/VF device links. With VFs
  enabled, the Rust PCI remove callback invokes sriov_configure(0), when
  implemented, and disables any remaining VFs before calling the PF
  driver's unbind.
- Use pci::Device directly for SR-IOV operations and callbacks, removing
  the separate pci::sriov::Device wrapper. Update the sample accordingly.

[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/all/20260915205659.76841-1-zhiw@nvidia.com/

John Hubbard (1):
  rust: pci: add is_virtfn(), to check for VFs

Peter Colberg (6):
  rust: pci: add {enable,disable}_sriov(), to control SR-IOV capability
  rust: pci: add vtable attribute to pci::Driver trait
  rust: pci: add is_physfn(), to check for PFs
  rust: pci: add num_vf(), to return number of VFs
  rust: pci: add bus callback sriov_configure(), to control SR-IOV from
    sysfs
  samples: rust: add Rust SR-IOV VF driver sample

Zhi Wang (1):
  rust: pci: add typed SR-IOV PF registration data

 MAINTAINERS                           |   1 +
 drivers/gpu/nova-core/driver.rs       |   1 +
 include/linux/pci.h                   |   7 +
 rust/kernel/pci.rs                    | 145 +++++++++++++++
 rust/kernel/pci/sriov.rs              | 253 ++++++++++++++++++++++++++
 samples/rust/Kconfig                  |  11 ++
 samples/rust/Makefile                 |   1 +
 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.rs     | 241 ++++++++++++++++++++++++
 11 files changed, 663 insertions(+)
 create mode 100644 rust/kernel/pci/sriov.rs
 create mode 100644 samples/rust/rust_driver_sriov.rs


base-commit: c15c5befd6d6150e92ab7c6c7fde1088e0f543e6
-- 
2.53.0