vm-virtio: Stop delivering interrupt while NO_VECTOR

According to virtio spec, for used buffer notifications, if
MSI-X capability is enabled, and queue msix vector is
VIRTIO_MSI_NO_VECTOR 0xffff, the device must not deliver an
interrupt for that virtqueue.

Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
Cathy Zhang 2019-12-11 16:09:16 +08:00 committed by Sebastien Boeuf
parent 1324aa451f
commit 3485e89080
2 changed files with 6 additions and 0 deletions

View File

@ -128,6 +128,7 @@ impl fmt::Display for VirtioDeviceType {
const INTERRUPT_STATUS_USED_RING: u32 = 0x1;
#[allow(dead_code)]
const INTERRUPT_STATUS_CONFIG_CHANGED: u32 = 0x2;
const VIRTIO_MSI_NO_VECTOR: u16 = 0xffff;
#[derive(Debug)]
pub enum ActivateError {

View File

@ -37,6 +37,7 @@ use crate::{
Queue, VirtioDevice, VirtioDeviceType, VirtioInterrupt, VirtioInterruptType,
VirtioIommuRemapping, DEVICE_ACKNOWLEDGE, DEVICE_DRIVER, DEVICE_DRIVER_OK, DEVICE_FAILED,
DEVICE_FEATURES_OK, DEVICE_INIT, INTERRUPT_STATUS_CONFIG_CHANGED, INTERRUPT_STATUS_USED_RING,
VIRTIO_MSI_NO_VECTOR,
};
#[allow(clippy::enum_variant_names)]
@ -510,6 +511,10 @@ impl PciDevice for VirtioPciDevice {
}
};
if vector == VIRTIO_MSI_NO_VECTOR {
return Ok(());
}
let config = &mut msix_config_clone.lock().unwrap();
let entry = &config.table_entries[vector as usize];