mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
devices: virtio: factor out interrupt signal function
This will be used for configuration interrupts as well. No functional change. BUG=chromium:854765 TEST=./build_test.py Change-Id: Iacccfd0a93a5c90783033a8e37598c2683704351 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898267 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zide Chen <zide.chen@intel.corp-partner.google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
081ad6b6cd
commit
ecfed3ab95
1 changed files with 8 additions and 3 deletions
|
@ -35,7 +35,7 @@ impl Interrupt {
|
|||
///
|
||||
/// If MSI-X is enabled in this device, MSI-X interrupt is preferred.
|
||||
/// Write to the irqfd to VMM to deliver virtual interrupt to the guest
|
||||
pub fn signal_used_queue(&self, vector: u16) {
|
||||
fn signal(&self, vector: u16, interrupt_status_mask: u32) {
|
||||
// Don't need to set ISR for MSI-X interrupts
|
||||
if let Some(msix_config) = &self.msix_config {
|
||||
let mut msix_config = msix_config.lock();
|
||||
|
@ -47,11 +47,11 @@ impl Interrupt {
|
|||
}
|
||||
}
|
||||
|
||||
// Set BIT0 in ISR and inject the interrupt if it was not already pending.
|
||||
// Set bit in ISR and inject the interrupt if it was not already pending.
|
||||
// Don't need to inject the interrupt if the guest hasn't processed it.
|
||||
if self
|
||||
.interrupt_status
|
||||
.fetch_or(INTERRUPT_STATUS_USED_RING as usize, Ordering::SeqCst)
|
||||
.fetch_or(interrupt_status_mask as usize, Ordering::SeqCst)
|
||||
== 0
|
||||
{
|
||||
// Write to irqfd to inject INTx interrupt
|
||||
|
@ -59,6 +59,11 @@ impl Interrupt {
|
|||
}
|
||||
}
|
||||
|
||||
/// Notify the driver that buffers have been placed in the used queue.
|
||||
pub fn signal_used_queue(&self, vector: u16) {
|
||||
self.signal(vector, INTERRUPT_STATUS_USED_RING)
|
||||
}
|
||||
|
||||
/// Notification of Device Configuration Changes
|
||||
/// Set BIT1 in ISR and write to irqfd
|
||||
pub fn signal_config_changed(&self) {
|
||||
|
|
Loading…
Reference in a new issue