]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtio-mmio: update queue size on guest write
authorDenis Plotnikov <dplotnikov@virtuozzo.com>
Tue, 24 Dec 2019 08:14:46 +0000 (11:14 +0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 11 May 2020 23:09:43 +0000 (18:09 -0500)
Some guests read back queue size after writing it.
Always update the on size write otherwise they might be confused.

Cc: qemu-stable@nongnu.org
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
Message-Id: <20191224081446.17003-1-dplotnikov@virtuozzo.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1049f4c62c4070618cc5defc9963c6a17ae7a5ae)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio-mmio.c

index 94d934c44b6ca63a4d5c72258e90c9aa1eac98f7..1e40a74869dad64fd172e1279b2534357e0c09f4 100644 (file)
@@ -295,8 +295,9 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value,
         break;
     case VIRTIO_MMIO_QUEUE_NUM:
         trace_virtio_mmio_queue_write(value, VIRTQUEUE_MAX_SIZE);
+        virtio_queue_set_num(vdev, vdev->queue_sel, value);
+
         if (proxy->legacy) {
-            virtio_queue_set_num(vdev, vdev->queue_sel, value);
             virtio_queue_update_rings(vdev, vdev->queue_sel);
         } else {
             proxy->vqs[vdev->queue_sel].num = value;