From patchwork Fri Jul 26 15:41:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18609 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 53EFC25E5D for ; Fri, 26 Jul 2013 15:41:44 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id c1sf3007183qcz.5 for ; Fri, 26 Jul 2013 08:41:43 -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=Cq1EDl/hDntpa7gCweV56Yky8c+hCDqlnvHNfVC2yjM=; b=EDN7MovpqsWlov/zNg9FOfqgmIVqBr420TfJD8J9Nppmd9BCWA+NcHDc8HSSWRM+k2 XXTnn1ToRdKDoP7jMkczIbvQfjxLunqe53IxLlY5qhS1vE6n//dQRu3Uz8IxeAcyXjKv JVYU34s7zt0Pc7NAD7s8t/aB1ywCCCZN0+4cLOOfx5t2SJcdYWbfPA5Ij9PzGaE+hq7A pISXL+rEgaWadiXAt5NoDKwM1Zx9wgd7zAmxSYorc5FZFL+yLzbwPQTwcMQrJ4pqJ/c4 mo7yDGitMsOma1S5VpTnXp9vGyI2EuygsnTgsMCFjlwN0iqW1NKE75m91sOW1xnr2iFw DRyA== X-Received: by 10.236.92.7 with SMTP id i7mr25019744yhf.52.1374853303711; Fri, 26 Jul 2013 08:41:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.14.71 with SMTP id n7ls1228621qec.2.gmail; Fri, 26 Jul 2013 08:41:43 -0700 (PDT) X-Received: by 10.52.65.165 with SMTP id y5mr8211435vds.69.1374853303575; Fri, 26 Jul 2013 08:41:43 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id zw14si14238900veb.26.2013.07.26.08.41.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Jul 2013 08:41:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id jw11so1384584veb.4 for ; Fri, 26 Jul 2013 08:41:43 -0700 (PDT) X-Received: by 10.52.27.172 with SMTP id u12mr17293840vdg.64.1374853303486; Fri, 26 Jul 2013 08:41:43 -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 yu8csp29797veb; Fri, 26 Jul 2013 08:41:43 -0700 (PDT) X-Received: by 10.15.61.130 with SMTP id i2mr46383317eex.122.1374853301497; Fri, 26 Jul 2013 08:41:41 -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 a48si42141963eep.113.2013.07.26.08.41.40 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 26 Jul 2013 08:41:41 -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 1V2k93-0002aT-3L; Fri, 26 Jul 2013 16:41:29 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, kvmarm@lists.cs.columbia.edu, Anthony Liguori , "Michael S. Tsirkin" , KONRAD Frederic Subject: [PATCH v2 for-1.6 2/2] hw/virtio/virtio-mmio: Make QueueNumMax read 0 for unavailable queues Date: Fri, 26 Jul 2013 16:41:28 +0100 Message-Id: <1374853288-9912-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1374853288-9912-1-git-send-email-peter.maydell@linaro.org> References: <1374853288-9912-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQnteNMEDVZPRlb2IoPcAzH9vgyebs3WLfbFvsjqKg7fytc1S4sBeAD/NMPJQVvvBiGz8dQf X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 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 virtio-mmio spec says that QueueNumMax must read zero for queues which are unavailable; implement this, rather than always returning VIRTQUEUE_MAX_SIZE. Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin --- hw/virtio/virtio-mmio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 54d6679..9cf79ce 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -151,6 +151,9 @@ static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size) } return proxy->host_features; case VIRTIO_MMIO_QUEUENUMMAX: + if (!virtio_queue_get_num(vdev, vdev->queue_sel)) { + return 0; + } return VIRTQUEUE_MAX_SIZE; case VIRTIO_MMIO_QUEUEPFN: return virtio_queue_get_addr(vdev, vdev->queue_sel)