aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2013-07-26 16:41:28 +0100
committerPeter Maydell <peter.maydell@linaro.org>2013-08-12 11:57:56 +0100
commitf7b803b377f74f7e109559e8e64f04c4c1fcd86b (patch)
tree600434f1e4f9cfa8af4d0595a3d35454225a476e /hw/virtio
parentf6049f4483d61fa911a0693c2c48ce8308451d33 (diff)
downloadqemu-f7b803b377f74f7e109559e8e64f04c4c1fcd86b.zip
qemu-f7b803b377f74f7e109559e8e64f04c4c1fcd86b.tar.gz
qemu-f7b803b377f74f7e109559e8e64f04c4c1fcd86b.tar.bz2
hw/virtio/virtio-mmio: Make QueueNumMax read 0 for unavailable queues
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>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio-mmio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 88cf994..4bd2953 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -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)