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>
This commit is contained in:
parent
46c5d0823d
commit
79cd0c80f8
@ -307,11 +307,18 @@ static int virtio_ccw_set_vqs(SubchDev *sch, VqInfoBlock *info,
|
|||||||
if (!desc) {
|
if (!desc) {
|
||||||
virtio_queue_set_vector(vdev, index, VIRTIO_NO_VECTOR);
|
virtio_queue_set_vector(vdev, index, VIRTIO_NO_VECTOR);
|
||||||
} else {
|
} else {
|
||||||
/* Fail if we don't have a big enough queue. */
|
if (info) {
|
||||||
/* TODO: Add interface to handle vring.num changing */
|
/* virtio-1 allows changing the ring size. */
|
||||||
if (virtio_queue_get_num(vdev, index) > num) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
/* We ignore possible increased num for legacy for compatibility. */
|
||||||
virtio_queue_set_vector(vdev, index, index);
|
virtio_queue_set_vector(vdev, index, index);
|
||||||
}
|
}
|
||||||
/* tell notify handler in case of config change */
|
/* tell notify handler in case of config change */
|
||||||
|
Loading…
Reference in New Issue
Block a user