Re: [PATCH v2 01/12] rust: pci: add VFIO override device IDs
From: Gary Guo
Date: Fri Oct 23 2026 - 16:24:01 EST
On Fri Oct 23, 2026 at 4:39 PM BST, Simon Song wrote:
> From: Danilo Krummrich <dakr@xxxxxxxxxx>
>
> VFIO variant drivers need override-only IDs and VFIO-specific module
> aliases so userspace can select them for PCI assignment.
>
> Add a DeviceId constructor equivalent to PCI_DRIVER_OVERRIDE_DEVICE_VFIO,
> matching a vendor and device without restricting the PCI class.
>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx>
> Signed-off-by: Simon Song <xinmengs@xxxxxxxxxx>
> ---
> rust/kernel/pci.rs | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
> index d83492e06ce..10864ffda4e 100644
> --- a/rust/kernel/pci.rs
> +++ b/rust/kernel/pci.rs
> @@ -206,6 +206,13 @@ macro_rules! module_pci_driver {
> impl DeviceId {
> const PCI_ANY_ID: u32 = !0;
>
> + /// Equivalent to C's `PCI_DRIVER_OVERRIDE_DEVICE_VFIO` macro.
The documentation should primary describe what the function is.
The C equivalence is good to have but should be secondary info.
Best,
Gary
> + pub const fn from_id_vfio_override(vendor: Vendor, device: u32) -> Self {
> + let mut id = Self::from_id(vendor, device);
> + id.0.override_only = bindings::PCI_ID_F_VFIO_DRIVER_OVERRIDE;
> + id
> + }
> +
> /// Equivalent to C's `PCI_DEVICE` macro.
> ///
> /// Create a new `pci::DeviceId` from a vendor and device ID.