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/[email protected]
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/r/[email protected]

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 via email to