From patchwork Thu Sep 24 13:20:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 522313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42685140187 for ; Thu, 24 Sep 2015 23:21:36 +1000 (AEST) Received: from localhost ([::1]:35139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6Ss-0005r4-2C for incoming@patchwork.ozlabs.org; Thu, 24 Sep 2015 09:21:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6Rr-0004Qm-06 for qemu-devel@nongnu.org; Thu, 24 Sep 2015 09:20:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf6Rn-0006Ce-3V for qemu-devel@nongnu.org; Thu, 24 Sep 2015 09:20:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6Rm-0006CS-UV for qemu-devel@nongnu.org; Thu, 24 Sep 2015 09:20:27 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 769D0C0B918B; Thu, 24 Sep 2015 13:20:26 +0000 (UTC) Received: from redhat.com (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t8ODKOTn009112; Thu, 24 Sep 2015 09:20:24 -0400 Date: Thu, 24 Sep 2015 16:20:23 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1443100738-14970-8-git-send-email-mst@redhat.com> References: <1443100738-14970-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1443100738-14970-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Cornelia Huck , Peter Maydell , Richard Henderson , Alexander Graf , Christian Borntraeger Subject: [Qemu-devel] [PULL 07/22] virtio-ccw: support ring size changes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Cornelia Huck Wire up changing the ring size for virtio-1 devices. Signed-off-by: Cornelia Huck Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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 */