Skip to main content

IrqFdRoute

Trait IrqFdRoute 

pub trait IrqFdRoute: Send + Sync {
    // Required methods
    fn event(&self) -> &Event;
    fn enable(&self, address: u64, data: u32, devid: Option<u32>);
    fn disable(&self);
}
Expand description

A handle to a registered irqfd route.

Each route represents a single GSI with an associated event. When the event is signaled (e.g., by VFIO on a device interrupt), the kernel injects the MSI configured via enable into the guest.

Dropping this handle unregisters the irqfd and frees the GSI.

Required Methods§

fn event(&self) -> &Event

Returns the event that triggers interrupt injection when signaled.

Pass this to VFIO map_msix or any other interrupt source. On Linux, this is an eventfd created by the implementation. On WHP (future), this is the event handle returned by WHvCreateTrigger.

fn enable(&self, address: u64, data: u32, devid: Option<u32>)

Sets the MSI routing for this irqfd’s GSI.

address and data are the MSI address and data values that the hypervisor will use when injecting the interrupt into the guest. devid is an optional device identity used by backends that need a device ID for MSI routing (e.g., GICv3 ITS).

fn disable(&self)

Disables the MSI routing for this irqfd’s GSI.

Disarms the irqfd so that signaling the event no longer injects an interrupt. Interrupts that arrive while disabled remain pending on the event and will be delivered when enable is called, or can be drained by waiting on the event directly.

Implementors§