From patchwork Thu Jun 27 13:04:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18154 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 52EDF23910 for ; Thu, 27 Jun 2013 13:04:28 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id hu16sf1232907qab.0 for ; Thu, 27 Jun 2013 06:04:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=aDnZzKGXhZcGIesJaGCGEGwo1oMlMlCWZaJcU6mHtrY=; b=VTmhG7LFLcRqHYCBPbFZhPFcoKrkEWNoRMbrJ+T6mV/+3cLMPRD9ZWN6Boq3I0Xjav QGDRRB9filAS81JPF/Su/0YTAeUyXGHQ8stJpF56Ndku4Xb3QL4QoUsOGFBFRoZ/88CZ wk+HPannLfkx5ZizimwjB2mYSGAIdsrUlOBtOuEPEYQaPAHrBiOuV7ztTxVJGwHnawMC MO1aYSlVggWJ8TagLT9VANOMprEC9aMlN3jpq2MgXEvFZFPHlHvzqBlG0JLgk8xTU9iG BOphuZ5wLnXAxrL8Uh14fqFNQK0ad2yOwFF3XYbEBCOkh7KG0WbOt+OWRF+mAH4BoM5H Vx8g== X-Received: by 10.59.11.2 with SMTP id ee2mr888014ved.11.1372338268078; Thu, 27 Jun 2013 06:04:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.84 with SMTP id da20ls771664qeb.46.gmail; Thu, 27 Jun 2013 06:04:28 -0700 (PDT) X-Received: by 10.58.50.7 with SMTP id y7mr3475884ven.24.1372338267905; Thu, 27 Jun 2013 06:04:27 -0700 (PDT) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id sz6si745871vdc.127.2013.06.27.06.04.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Jun 2013 06:04:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.41; Received: by mail-vb0-f41.google.com with SMTP id p13so600126vbe.28 for ; Thu, 27 Jun 2013 06:04:27 -0700 (PDT) X-Received: by 10.52.118.38 with SMTP id kj6mr2955646vdb.21.1372338267820; Thu, 27 Jun 2013 06:04:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp147633veb; Thu, 27 Jun 2013 06:04:27 -0700 (PDT) X-Received: by 10.152.116.76 with SMTP id ju12mr4199364lab.54.1372338262654; Thu, 27 Jun 2013 06:04:22 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id vt5si958581lbb.66.2013.06.27.06.04.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 27 Jun 2013 06:04:22 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1UsBs0-000127-39; Thu, 27 Jun 2013 14:04:16 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, kvmarm@lists.cs.columbia.edu, Anthony Liguori , Alexander Graf , KONRAD Frederic , David Gibson Subject: [PATCH 3/8] virtio: Add support for guest setting of queue size Date: Thu, 27 Jun 2013 14:04:10 +0100 Message-Id: <1372338255-3934-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1372338255-3934-1-git-send-email-peter.maydell@linaro.org> References: <1372338255-3934-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmpCvwePcAmBMtmRFVQXWWm+Rax5N0qu5gFVM04xPtfeeh5P+WgPDjg2xTbHfzGzuDnuBQH X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The MMIO virtio transport spec allows the guest to tell the host how large the queue size is. Add virtio_queue_set_num() function which implements this in the QEMU common virtio support code. Signed-off-by: Peter Maydell --- hw/virtio/virtio.c | 6 ++++++ include/hw/virtio/virtio.h | 1 + 2 files changed, 7 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 8176c14..8805b8a 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -667,6 +667,12 @@ hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n) return vdev->vq[n].pa; } +void virtio_queue_set_num(VirtIODevice *vdev, int n, int num) +{ + vdev->vq[n].vring.num = num; + virtqueue_init(&vdev->vq[n]); +} + int virtio_queue_get_num(VirtIODevice *vdev, int n) { return vdev->vq[n].vring.num; diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index a6c5c53..95c4772 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -198,6 +198,7 @@ void virtio_config_writew(VirtIODevice *vdev, uint32_t addr, uint32_t data); void virtio_config_writel(VirtIODevice *vdev, uint32_t addr, uint32_t data); void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr); hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n); +void virtio_queue_set_num(VirtIODevice *vdev, int n, int num); int virtio_queue_get_num(VirtIODevice *vdev, int n); void virtio_queue_notify(VirtIODevice *vdev, int n); uint16_t virtio_queue_vector(VirtIODevice *vdev, int n);