]> git.proxmox.com Git - qemu.git/commitdiff
hw/virtio/virtio-mmio: Make QueueNumMax read 0 for unavailable queues
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 26 Jul 2013 15:41:28 +0000 (16:41 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 12 Aug 2013 10:57:56 +0000 (11:57 +0100)
The virtio-mmio spec says that QueueNumMax must read zero for queues
which are unavailable; implement this, rather than always returning
VIRTQUEUE_MAX_SIZE.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1374853288-9912-3-git-send-email-peter.maydell@linaro.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-mmio.c

index 88cf994b9774889f41da130573a91fe0856597e0..4bd29533f34f0cca98084c1031d472bfad5a094e 100644 (file)
@@ -151,6 +151,9 @@ static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size)
         }
         return proxy->host_features;
     case VIRTIO_MMIO_QUEUENUMMAX:
+        if (!virtio_queue_get_num(vdev, vdev->queue_sel)) {
+            return 0;
+        }
         return VIRTQUEUE_MAX_SIZE;
     case VIRTIO_MMIO_QUEUEPFN:
         return virtio_queue_get_addr(vdev, vdev->queue_sel)