@@ -53,7 +53,7 @@ struct virtio_pci {
/* MSI-X */
u16 config_vector;
u32 config_gsi;
- u32 vq_vector[VIRTIO_PCI_MAX_VQ];
+ u16 vq_vector[VIRTIO_PCI_MAX_VQ];
u32 gsis[VIRTIO_PCI_MAX_VQ];
u64 msix_pba;
struct msix_table msix_table[VIRTIO_PCI_MAX_VQ + VIRTIO_PCI_MAX_CONFIG];
@@ -403,7 +403,9 @@ int virtio_pci__init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
/* Both table and PBA are mapped to the same BAR (2) */
vpci->pci_hdr.msix.table_offset = cpu_to_le32(2);
vpci->pci_hdr.msix.pba_offset = cpu_to_le32(2 | VIRTIO_MSIX_TABLE_SIZE);
- vpci->config_vector = 0;
+ vpci->config_vector = VIRTIO_MSI_NO_VECTOR;
+ /* Initialize all vq vectors to NO_VECTOR */
+ memset(vpci->vq_vector, 0xff, sizeof(vpci->vq_vector));
if (irq__can_signal_msi(kvm))
vpci->features |= VIRTIO_PCI_F_SIGNAL_MSI;
According to the virtio spec, all vectors must be initialized to VIRTIO_MSI_NO_VECTOR (0xffff). In 4.1.5.1.2.1 "Device Requirements: MSI-X Vector Configuration": The device MUST return vector mapped to a given event, (NO_VECTOR if unmapped) on read of config_msix_vector/queue_msix_vector. Currently we return 0, which is a valid MSI vector. Return NO_VECTOR instead. Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> --- include/kvm/virtio-pci.h | 2 +- virtio/pci.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)