pub trait InterruptSourceGroup: Send + Sync {
    fn interrupt_type(&self) -> InterruptSourceType;
    fn len(&self) -> InterruptIndex;
    fn base(&self) -> InterruptIndex;
    fn enable(&self, configs: &[InterruptSourceConfig]) -> Result<()>;
    fn disable(&self) -> Result<()>;
    fn update(
        &self,
        index: InterruptIndex,
        config: &InterruptSourceConfig
    ) -> Result<()>; fn trigger(&self, index: InterruptIndex) -> Result<()>; fn notifier(&self, _index: InterruptIndex) -> Option<&EventFd> { ... } fn mask(&self, _index: InterruptIndex) -> Result<()> { ... } fn unmask(&self, _index: InterruptIndex) -> Result<()> { ... } fn get_pending_state(&self, _index: InterruptIndex) -> bool { ... } }
Expand description

Trait to manage a group of interrupt sources for a device.

A device may support several types of interrupts, and each type of interrupt may contain one or multiple continuous interrupt sources. For example, a PCI device may concurrently support:

  • Legacy Irq: exactly one interrupt source.
  • PCI MSI Irq: 1,2,4,8,16,32 interrupt sources.
  • PCI MSIx Irq: 2^n(n=0-11) interrupt sources.

PCI MSI interrupts of a device may not be configured individually, and must configured as a whole block. So all interrupts of the same type of a device are abstracted as an InterruptSourceGroup object, instead of abstracting each interrupt source as a distinct InterruptSource.

Required Methods

Get type of interrupt sources managed by the group.

Get number of interrupt sources managed by the group.

Get base of the assigned Interrupt Source Identifiers.

Enable the interrupt sources in the group to generate interrupts.

Disable the interrupt sources in the group to generate interrupts.

Update the interrupt source group configuration.

Arguments
  • index: sub-index into the group.
  • config: configuration data for the interrupt source.

Inject an interrupt from this interrupt source into the guest.

If the interrupt has an associated interrupt_status register, all bits set in flag will be atomically ORed into the interrupt_status register.

Provided Methods

Returns an interrupt notifier from this interrupt.

An interrupt notifier allows for external components and processes to inject interrupts into guest, by writing to the file returned by this method.

Mask an interrupt from this interrupt source.

Unmask an interrupt from this interrupt source.

Check whether there’s pending interrupt.

Implementors