[PATCH 1/7] rust: pci: add VFIO override device IDs

From: Zhi Wang

Date: Wed Sep 30 2026 - 07:08:27 EST


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>
---
rust/kernel/pci.rs | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
index d83492e06cee..10864ffda4ea 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.
+ 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.
--
2.53.0