pub struct MsiRoute { /* private fields */ }Expand description
A kernel-mediated MSI interrupt route for a single vector.
Each route has an associated event. Signaling the event causes the hypervisor to inject the configured MSI into the guest without a userspace transition. This is used for device passthrough (VFIO) where the physical device signals the event on interrupt.
Implementations§
Source§impl MsiRoute
impl MsiRoute
Sourcepub fn event(&self) -> &Event
pub fn event(&self) -> &Event
Returns the event that triggers interrupt injection when signaled.
Pass this to VFIO map_msix or any other interrupt source.
Sourcepub fn enable(&self, address: u64, data: u32)
pub fn enable(&self, address: u64, data: u32)
Configures the MSI address and data for this route, using the route’s
default requester ID (secondary_bus << 8) + rid_offset.
If the resolved bus falls outside the assigned bus range, the route is left disabled and a ratelimited warning is emitted.
Sourcepub fn enable_with_rid(&self, rid: u16, address: u64, data: u32)
pub fn enable_with_rid(&self, rid: u16, address: u64, data: u32)
Configures the MSI address and data for this route, using
an explicit segment-local BDF (rid) as the requester ID.
Use this for multi-function devices whose functions span
multiple buses: the caller composes the full (bus << 8) | devfn
itself from whatever bus range it owns. The route’s own
default devfn is bypassed.
The bus portion of rid is validated against the route’s
assigned bus range; if it falls outside the range the route
is left disabled and a ratelimited warning is emitted.
Sourcepub fn disable(&self)
pub fn disable(&self)
Disables the MSI route. Interrupts that arrive while disabled
remain pending on the event and will be delivered when
enable is called, or can be drained via
consume_pending.
Sourcepub fn consume_pending(&self) -> bool
pub fn consume_pending(&self) -> bool
Drains pending interrupt state and returns whether an interrupt was pending while the route was masked.