VirtIO: Fix QEMU crash during Windows PNP tests
PATCH 1/1 VirtIO: Fix QEMU crash during Windows PNP tests
Hello,
In some cases bus driver can deassert "bus master" bit in PCI command register. The driver will no longer be able to update related registers in the device. Eventually it will cause QEMU to exit in "virtqueue_num_heads" function.
Attached path that fixes the described issue.
Best regards,
Yan Vugenfirer.
Quoted 1 line
From
3fdafbdfad676ec8479dc073cff70bf356868bfeMon Sep 17 00:00:00 2001
From: Yan Vugenfirer <[email protected]>
Date: Tue, 8 Sep 2009 10:08:14 -0400
Subject: [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests
--- hw/virtio-pci.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
hw/virtio-pci.c +12 -2
@@ -364,8 +364,17 @@ static void virtio_map(PCIDevice *pci_dev, int region_num,static void virtio_write_config (PCIDevice *pci_dev,uint32_t address,uint32_t val,int len) { +VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev); + +if (PCI_COMMAND == address) { +if (!(val &PCI_COMMAND_MASTER )) { + proxy->vdev->status &= !VIRTIO_CONFIG_S_DRIVER_OK ; + } + } +pci_default_write_config (pci_dev, address, val, len); -msix_write_config (pci_dev, address, val, len); +if (proxy->vdev->nvectors) +msix_write_config (pci_dev, address, val, len); }static const VirtIOBindings virtio_pci_bindings = {
@@ -407,11 +416,12 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,msix_bar_size (&proxy->pci_dev),PCI_ADDRESS_SPACE_MEM , msix_mmio_map); - proxy->pci_dev.config_write = virtio_write_config; proxy->pci_dev.unregister = msix_uninit; }else vdev->nvectors =0 ; + proxy->pci_dev.config_write = virtio_write_config; + size =VIRTIO_PCI_REGION_SIZE (&proxy->pci_dev) + vdev->config_len;if (size & (size-1 )) size =1 <<qemu_fls (size);
Signature · 1 line
1.5.5.6
Quoted 7 lines · Yan Vugenfirer
Hello,
In some cases bus driver can deassert "bus master" bit in PCI command register. The driver will no longer be able to update related registers in the device. Eventually it will cause QEMU to exit in "
virtqueue_num_heads" function.
Quoted 5 lines
Attached path that fixes the described issue.
Best regards,
Yan Vugenfirer.
Needs a Signed-off-by.
Regards,
Anthony Liguori
Quoted 7 lines
From: Anthony Liguori
Needs a Signed-off-by.
Regards,
Anthony Liguori
[YV] Resending with signed-off-by.
Quoted 1 line
From
d7b9ccc5c1a6a28367a550a5e55a40d482623ec7Mon Sep 17 00:00:00 2001
From: Yan Vugenfirer <[email protected]>
Date: Tue, 8 Sep 2009 10:08:14 -0400
Subject: [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests
--- hw/virtio-pci.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
hw/virtio-pci.c +12 -2
@@ -364,8 +364,17 @@ static void virtio_map(PCIDevice *pci_dev, int region_num,static void virtio_write_config (PCIDevice *pci_dev,uint32_t address,uint32_t val,int len) { +VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev); + +if (PCI_COMMAND == address) { +if (!(val &PCI_COMMAND_MASTER )) { + proxy->vdev->status &= ~VIRTIO_CONFIG_S_DRIVER_OK ; + } + } +pci_default_write_config (pci_dev, address, val, len); -msix_write_config (pci_dev, address, val, len); +if (proxy->vdev->nvectors) +msix_write_config (pci_dev, address, val, len); }static const VirtIOBindings virtio_pci_bindings = {
@@ -407,11 +416,12 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,msix_bar_size (&proxy->pci_dev),PCI_ADDRESS_SPACE_MEM , msix_mmio_map); - proxy->pci_dev.config_write = virtio_write_config; proxy->pci_dev.unregister = msix_uninit; }else vdev->nvectors =0 ; + proxy->pci_dev.config_write = virtio_write_config; + size =VIRTIO_PCI_REGION_SIZE (&proxy->pci_dev) + vdev->config_len;if (size & (size-1 )) size =1 <<qemu_fls (size);
Signature · 1 line
1.5.5.6
Quoted 11 lines · Yan Vugenfirer
Quoted 8 lines
From: Anthony Liguori
Needs a Signed-off-by.
Regards,
Anthony Liguori
[YV] Resending with signed-off-by.
Please send as a top level patch (and not as an attachment).
Regards,
Anthony Liguori