From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaOIl-0002Zs-3N for qemu-devel@nongnu.org; Fri, 11 Sep 2015 09:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaOIh-0001np-4x for qemu-devel@nongnu.org; Fri, 11 Sep 2015 09:23:39 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:47699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaOIg-0001na-Qz for qemu-devel@nongnu.org; Fri, 11 Sep 2015 09:23:35 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 11 Sep 2015 14:23:31 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1ADF217D8024 for ; Fri, 11 Sep 2015 14:18:34 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t8BDGloR32178300 for ; Fri, 11 Sep 2015 13:16:47 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t8BCGle1004633 for ; Fri, 11 Sep 2015 06:16:48 -0600 From: Cornelia Huck Date: Fri, 11 Sep 2015 15:16:42 +0200 Message-Id: <1441977404-37841-3-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1441977404-37841-1-git-send-email-cornelia.huck@de.ibm.com> References: <1441977404-37841-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH v2 2/4] virtio-ccw: support ring size changes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , borntraeger@de.ibm.com, jasowang@redhat.com, mst@redhat.com Wire up changing the ring size for virtio-1 devices. Signed-off-by: Cornelia Huck --- hw/s390x/virtio-ccw.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index d36373e..85e2a5d 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 */ -- 2.3.8