diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2017-01-12 23:26:22 +0200 |
---|---|---|
committer | Cornelia Huck <cornelia.huck@de.ibm.com> | 2017-01-20 10:02:02 +0100 |
commit | 8c797e758ad41b8dd6ea6f72c6f0194dedb30a2f (patch) | |
tree | 5943d12536c27bda777a968bc2dde11a32bd043f /hw | |
parent | 857cc71985dcd553a601fb9a0df7919359c23115 (diff) | |
download | qemu-8c797e758ad41b8dd6ea6f72c6f0194dedb30a2f.zip qemu-8c797e758ad41b8dd6ea6f72c6f0194dedb30a2f.tar.gz qemu-8c797e758ad41b8dd6ea6f72c6f0194dedb30a2f.tar.bz2 |
virtio-ccw: fix ring sizing
Current code seems to assume ring size is
always decreased but this is not required by spec:
what spec says is just that size can not exceed
the maximum. Fix it up.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <1484256243-1982-1-git-send-email-mst@redhat.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/s390x/virtio-ccw.c | 2 | ||||
-rw-r--r-- | hw/virtio/virtio.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 0765068..63c4637 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -149,7 +149,7 @@ static int virtio_ccw_set_vqs(SubchDev *sch, VqInfoBlock *info, } else { if (info) { /* virtio-1 allows changing the ring size. */ - if (virtio_queue_get_num(vdev, index) < num) { + if (virtio_queue_get_max_num(vdev, index) < num) { /* Fail if we exceed the maximum number. */ return -EINVAL; } diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index aa4f38f..94d7dba 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1262,6 +1262,11 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n) return vdev->vq[n].vring.num; } +int virtio_queue_get_max_num(VirtIODevice *vdev, int n) +{ + return vdev->vq[n].vring.num_default; +} + int virtio_get_num_queues(VirtIODevice *vdev) { int i; |