diff mbox

virtio-pci: Fix vq enabled flag on reset for virtio 1.0

Message ID 1453447210-13259-1-git-send-email-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng Jan. 22, 2016, 7:20 a.m. UTC
Virtio 1.0 requires queue_enable status in virtio_pci_common_cfg to be
cleared upon device reset (virtio-v1.0.pdf, section 4.1.4.3.1), but we
don't do it.

This causes trouble on Linux's virtio-blk-pci probe since seabios 1.9.0
update (commit ad30c0b0d), if modern enabled. Kernel spits:

    ...
    [    5.624492] virtio_blk: probe of virtio0 failed with error -2
    ...

To fix it, call the virtio-pci's reset handler instead of the device
attached on the bus.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 hw/virtio/virtio-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 94667e6..f0ab812 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1310,6 +1310,8 @@  static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr,
     return val;
 }
 
+static void virtio_pci_reset(DeviceState *qdev);
+
 static void virtio_pci_common_write(void *opaque, hwaddr addr,
                                     uint64_t val, unsigned size)
 {
@@ -1351,7 +1353,7 @@  static void virtio_pci_common_write(void *opaque, hwaddr addr,
         }
 
         if (vdev->status == 0) {
-            virtio_reset(vdev);
+            virtio_pci_reset(DEVICE(proxy));
             msix_unuse_all_vectors(&proxy->pci_dev);
         }