[Qemu-devel] [RFT 2/4] virtio-pci: set enabled for legacy device

Jason Wang posted 4 patches 6 years, 10 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>
[Qemu-devel] [RFT 2/4] virtio-pci: set enabled for legacy device
Posted by Jason Wang 6 years, 10 months ago
We don't set enabled for legacy device, this turns out to be an issue
if we want to check it through vhost. So just simply set it when
setting pa of a virtqueue.

Signed-off-by: Jason Wang <jasowang@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 cb44e19b67..887ee2783c 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -306,8 +306,10 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         if (pa == 0) {
             virtio_pci_reset(DEVICE(proxy));
         }
-        else
+        else {
             virtio_queue_set_addr(vdev, vdev->queue_sel, pa);
+            proxy->vqs[vdev->queue_sel].enabled = 1;
+        }
         break;
     case VIRTIO_PCI_QUEUE_SEL:
         if (val < VIRTIO_QUEUE_MAX)
-- 
2.19.1