virtio-pci: Fix vq enabled flag on reset for virtio 1.0
PATCH 1/1 virtio-pci: Fix vq enabled flag on reset for virtio 1.0
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 <[email protected]>
--- hw/virtio/virtio-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/virtio/virtio-pci.c +3 -1
@@ -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); }
Signature · 1 line
2.4.3