From aa44726658244185bce3691214f33a7780803c1c Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 8 Aug 2019 08:43:59 -0700 Subject: [PATCH] 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 --- vm-virtio/src/transport/pci_device.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vm-virtio/src/transport/pci_device.rs b/vm-virtio/src/transport/pci_device.rs index a5c350979..6f6e43e78 100755 --- a/vm-virtio/src/transport/pci_device.rs +++ b/vm-virtio/src/transport/pci_device.rs @@ -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.