diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2015-09-11 15:16:42 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-09-24 13:42:17 +0300 |
commit | 79cd0c80f82215a32890e3d30ff621b32ece5156 (patch) | |
tree | df799ab3fb1608c58e3319eb982542461d0bd8ef /hw/s390x | |
parent | 46c5d0823d0186daf4064065bf739858dadfcf8c (diff) | |
download | qemu-79cd0c80f82215a32890e3d30ff621b32ece5156.tar.gz qemu-79cd0c80f82215a32890e3d30ff621b32ece5156.tar.bz2 qemu-79cd0c80f82215a32890e3d30ff621b32ece5156.zip |
virtio-ccw: support ring size changes
Wire up changing the ring size for virtio-1 devices.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/s390x')
-rw-r--r-- | hw/s390x/virtio-ccw.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index d36373e88a..85e2a5d29e 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -307,11 +307,18 @@ static int virtio_ccw_set_vqs(SubchDev *sch, VqInfoBlock *info, if (!desc) { virtio_queue_set_vector(vdev, index, VIRTIO_NO_VECTOR); } else { - /* Fail if we don't have a big enough queue. */ - /* TODO: Add interface to handle vring.num changing */ - if (virtio_queue_get_num(vdev, index) > num) { + if (info) { + /* virtio-1 allows changing the ring size. */ + if (virtio_queue_get_num(vdev, index) < num) { + /* Fail if we exceed the maximum number. */ + return -EINVAL; + } + virtio_queue_set_num(vdev, index, num); + } else if (virtio_queue_get_num(vdev, index) > num) { + /* Fail if we don't have a big enough queue. */ return -EINVAL; } + /* We ignore possible increased num for legacy for compatibility. */ virtio_queue_set_vector(vdev, index, index); } /* tell notify handler in case of config change */ |