pub struct IrqLevelEvent {
trigger_evt: Event,
resample_evt: Event,
}Expand description
A structure suitable for implementing level triggered interrupts in device backends.
Level-triggered interrupts require the device to monitor a resample event from the IRQ chip,
which can be retrieved with IrqLevelEvent::get_resample(). When the guest OS acknowledges
the interrupt with an End of Interrupt (EOI) command, the IRQ chip will signal the resample
event. Each time the resample event is signalled, the device should re-check its state and call
IrqLevelEvent::trigger() again if the interrupt should still be asserted.
Fields§
§trigger_evt: EventAn event used by the device backend to signal hypervisor/VM about data or new unit of work being available.
resample_evt: EventAn event used by the hypervisor to signal device backend that it completed processing a
unit of work and that device should re-raise trigger_evt if additional work needs to
be done.
Implementations§
Source§impl IrqLevelEvent
impl IrqLevelEvent
pub fn new() -> Result<IrqLevelEvent>
pub fn try_clone(&self) -> Result<IrqLevelEvent>
Sourcepub fn from_event_pair(trigger_evt: Event, resample_evt: Event) -> IrqLevelEvent
pub fn from_event_pair(trigger_evt: Event, resample_evt: Event) -> IrqLevelEvent
Creates an instance of IrqLevelEvent from an existing pair of events.
pub fn get_trigger(&self) -> &Event
pub fn get_resample(&self) -> &Event
Sourcepub fn clear_trigger(&self)
pub fn clear_trigger(&self)
Allows code servicing interrupt to consume or clear the event.
Sourcepub fn trigger_resample(&self) -> Result<()>
pub fn trigger_resample(&self) -> Result<()>
Allows code servicing interrupt to signal that processing is done and that the backend should go ahead and re-trigger it if there is more work needs to be done. Note that typically resampling is signalled not by individual backends, but rather by the code implementing interrupt controller.
Sourcepub fn clear_resample(&self)
pub fn clear_resample(&self)
Allows backend to consume or clear the resample event.