qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] virtio-pci: Fix vq enabled flag on reset for virtio


From: Fam Zheng
Subject: [Qemu-devel] [PATCH] virtio-pci: Fix vq enabled flag on reset for virtio 1.0
Date: Fri, 22 Jan 2016 15:20:10 +0800

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]