[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/28] virtio-pci: don't try to mask or unmask vqs wi
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 03/28] virtio-pci: don't try to mask or unmask vqs without notifiers |
Date: |
Thu, 4 Jun 2015 13:10:20 +0200 |
From: Jason Wang <address@hidden>
We should validate the vq index against nvqs_with_notifiers. Otherwise we may
try to mask or unmask vector for vqs without notifiers (e.g control vq). This
will lead qemu abort on kvm_irqchip_commit_routes() when trying to boot win8.1
guest.
Fixes 851c2a75a6e80c8aa5e713864d98cfb512e7229b ("virtio-pci: speedup MSI-X
masking and unmasking")
Reported-by: Alex Williamson <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/virtio-pci.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index d1ddc39..6d4f64e 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -632,21 +632,26 @@ static int virtio_pci_vector_unmask(PCIDevice *dev,
unsigned vector,
if (!virtio_queue_get_num(vdev, index)) {
break;
}
- ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg);
- if (ret < 0) {
- goto undo;
+ if (index < proxy->nvqs_with_notifiers) {
+ ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg);
+ if (ret < 0) {
+ goto undo;
+ }
+ ++unmasked;
}
vq = virtio_vector_next_queue(vq);
- ++unmasked;
}
return 0;
undo:
vq = virtio_vector_first_queue(vdev, vector);
- while (vq && --unmasked >= 0) {
+ while (vq && unmasked >= 0) {
index = virtio_get_queue_index(vq);
- virtio_pci_vq_vector_mask(proxy, index, vector);
+ if (index < proxy->nvqs_with_notifiers) {
+ virtio_pci_vq_vector_mask(proxy, index, vector);
+ --unmasked;
+ }
vq = virtio_vector_next_queue(vq);
}
return ret;
@@ -664,7 +669,9 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned
vector)
if (!virtio_queue_get_num(vdev, index)) {
break;
}
- virtio_pci_vq_vector_mask(proxy, index, vector);
+ if (index < proxy->nvqs_with_notifiers) {
+ virtio_pci_vq_vector_mask(proxy, index, vector);
+ }
vq = virtio_vector_next_queue(vq);
}
}
--
MST
- [Qemu-devel] [PULL 00/28] pc, acpi, virtio, tpm, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 01/28] acpi: add missing ssdt, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 02/28] hw/q35: fix floppy controller definition in ich9, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 03/28] virtio-pci: don't try to mask or unmask vqs without notifiers,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 04/28] TPM: fix build with tpm disabled, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 05/28] virtio: 64bit features fixups., Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 06/28] acpi: add acpi_send_gpe_event() to rise sci for hotplug, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 07/28] acpi: add implementation of aml_while() term, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 08/28] hw/pci: made pci_bus_is_root a PCIBusClass method, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 09/28] hw/pci: made pci_bus_num a PCIBusClass method, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 10/28] hw/i386: query only for q35/pc when looking for pci host bridge, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 11/28] hw/pci: extend PCI config access to support devices behind PXB, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 12/28] hw/acpi: add support for i440fx 'snooping' root busses, Michael S. Tsirkin, 2015/06/04
- [Qemu-devel] [PULL 13/28] hw/apci: add _PRT method for extra PCI root busses, Michael S. Tsirkin, 2015/06/04