diff mbox series

[kvmtool,1/2] vfio/pci: Initialize MSI vectors unmasked

Message ID 20230628112331.453904-3-jean-philippe@linaro.org (mailing list archive)
State New, archived
Headers show
Series vfio/pci: Fix unmaskable MSI | expand

Commit Message

Jean-Philippe Brucker June 28, 2023, 11:23 a.m. UTC
MSI vectors can be masked and unmasked individually when using the MSI-X
capability, or when the classic MSI capability supports Per-Vector
Masking. At the moment we incorrectly initialize the guest's view of the
vectors (virt_state) as masked, so when using a MSI capability without
Per-Vector Masking, the vectors are never unmasked and MSIs don't work.
Initialize them unmasked instead.

Since VFIO doesn't support per-vector masking we implement it by
disconnecting the irqfd, and keep track of it with the vector's
phys_state. Initially the irqfd is not connected so phys_state is
masked.

Reported-by: Vivek Gautam <vivek.gautam@arm.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
 vfio/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/vfio/pci.c b/vfio/pci.c
index 78f5ca5e..a10b5528 100644
--- a/vfio/pci.c
+++ b/vfio/pci.c
@@ -1182,7 +1182,7 @@  static int vfio_pci_init_msis(struct kvm *kvm, struct vfio_device *vdev,
 		entry = &msis->entries[i];
 		entry->gsi = -1;
 		entry->eventfd = -1;
-		msi_set_masked(entry->virt_state, true);
+		msi_set_masked(entry->virt_state, false);
 		msi_set_masked(entry->phys_state, true);
 		eventfds[i] = -1;
 	}