qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-pci: Fix vq enabled flag on reset for virtio 1.0
@ 2016-01-22  7:20 Fam Zheng
  0 siblings, 0 replies; only message in thread
From: Fam Zheng @ 2016-01-22  7:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin

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 --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);
         }
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-22  7:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-22  7:20 [Qemu-devel] [PATCH] virtio-pci: Fix vq enabled flag on reset for virtio 1.0 Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).