vm-virtio: Don't trigger an MSI-X interrupt if not enabled

Relying on the newly added MSI-X helper, the interrupt callback checks
the interrupts are enabled on the device before to try triggering the
interrupt.

Fixes #156

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-08-08 08:43:59 -07:00 committed by Rob Bradford
parent c0e2bbb23f
commit aa44726658

View File

@ -423,6 +423,12 @@ impl PciDevice for VirtioPciDevice {
let config = &mut msix_config_clone.lock().unwrap();
let entry = &config.table_entries[vector as usize];
// If MSI-X interrupts are not enabled for this device, then simply
// ignore the interrupt.
if !config.enabled() {
return Ok(());
}
// In case the vector control register associated with the entry
// has its first bit set, this means the vector is masked and the
// device should not inject the interrupt.