Trait dbs_interrupt::InterruptSourceGroup
source · pub trait InterruptSourceGroup: Send + Sync {
// Required methods
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<()>;
// Provided methods
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§
sourcefn interrupt_type(&self) -> InterruptSourceType
fn interrupt_type(&self) -> InterruptSourceType
Get type of interrupt sources managed by the group.
sourcefn len(&self) -> InterruptIndex
fn len(&self) -> InterruptIndex
Get number of interrupt sources managed by the group.
sourcefn base(&self) -> InterruptIndex
fn base(&self) -> InterruptIndex
Get base of the assigned Interrupt Source Identifiers.
sourcefn enable(&self, configs: &[InterruptSourceConfig]) -> Result<()>
fn enable(&self, configs: &[InterruptSourceConfig]) -> Result<()>
Enable the interrupt sources in the group to generate interrupts.
sourcefn disable(&self) -> Result<()>
fn disable(&self) -> Result<()>
Disable the interrupt sources in the group to generate interrupts.
sourcefn update(
&self,
index: InterruptIndex,
config: &InterruptSourceConfig
) -> Result<()>
fn update( &self, index: InterruptIndex, config: &InterruptSourceConfig ) -> Result<()>
Update the interrupt source group configuration.
Arguments
- index: sub-index into the group.
- config: configuration data for the interrupt source.
sourcefn trigger(&self, index: InterruptIndex) -> Result<()>
fn trigger(&self, index: InterruptIndex) -> Result<()>
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§
sourcefn notifier(&self, _index: InterruptIndex) -> Option<&EventFd>
fn notifier(&self, _index: InterruptIndex) -> Option<&EventFd>
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.
sourcefn mask(&self, _index: InterruptIndex) -> Result<()>
fn mask(&self, _index: InterruptIndex) -> Result<()>
Mask an interrupt from this interrupt source.
sourcefn unmask(&self, _index: InterruptIndex) -> Result<()>
fn unmask(&self, _index: InterruptIndex) -> Result<()>
Unmask an interrupt from this interrupt source.
sourcefn get_pending_state(&self, _index: InterruptIndex) -> bool
fn get_pending_state(&self, _index: InterruptIndex) -> bool
Check whether there’s pending interrupt.