From patchwork Thu Jul 25 13:37:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18574 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BE10225E59 for ; Thu, 25 Jul 2013 13:38:03 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 2sf664458qea.5 for ; Thu, 25 Jul 2013 06:38:03 -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=Gofe6KAwFybVjpatBWKEnIge7UHcf/2aKnuyHlA9GFk=; b=QDPMDEszUs80/rOj7Q+Ko9+fJpnmWA9c1/plsD3qEyOuNvDKLf/YRUPtW+MONePvLq 4oLYDhD81Au1igRnn96zx5sNWqYUuN94Jq0uoVvWBa9tZtMjhx911WI0Z92wXNHmouTP Zu4r/xmipyzfOBWhPgMh4m330lMAPllAkGE2P2vloKESJzkR6sB72INhyv4Y3JYcANJ/ 1UBKznl51dMNLFmbJfk+ah6KnEBe+vKxLqrB3RPK4Q7LZYgVsWT2thamH8062I720P34 x3pZZhD+Qa4AHTEirmya0UoPEqI9yR6iWK7eFAaY7nbrLDlUjMKbcN07p1QPeLdSkstU HDCw== X-Received: by 10.236.207.169 with SMTP id n29mr23013240yho.50.1374759483435; Thu, 25 Jul 2013 06:38:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.88.6 with SMTP id bc6ls615754qeb.73.gmail; Thu, 25 Jul 2013 06:38:03 -0700 (PDT) X-Received: by 10.220.184.4 with SMTP id ci4mr571993vcb.65.1374759483350; Thu, 25 Jul 2013 06:38:03 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id u1si323693vcx.133.2013.07.25.06.38.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 06:38:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id gd11so138828vcb.33 for ; Thu, 25 Jul 2013 06:38:03 -0700 (PDT) X-Received: by 10.58.251.144 with SMTP id zk16mr17274589vec.37.1374759483266; Thu, 25 Jul 2013 06:38:03 -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 yu8csp78027veb; Thu, 25 Jul 2013 06:38:02 -0700 (PDT) X-Received: by 10.14.2.137 with SMTP id 9mr42361642eef.64.1374759469852; Thu, 25 Jul 2013 06:37:49 -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 a41si37266109eew.116.2013.07.25.06.37.48 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 25 Jul 2013 06:37:49 -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 1V2Ljk-0001f2-63; Thu, 25 Jul 2013 14:37:44 +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 2/2] hw/virtio/virtio-mmio: Make QueueNumMax read 0 for unavailable queues Date: Thu, 25 Jul 2013 14:37:43 +0100 Message-Id: <1374759463-6351-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1374759463-6351-1-git-send-email-peter.maydell@linaro.org> References: <1374759463-6351-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQkxgjy+Rw2YnQ1GMQL6P/9OGd4NyxGmgyl3Z0JkXsZw/I4keK69RIHEq+Sdj8vPJiERZlch X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 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 --- 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..aefb7e4 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) == 0) { + return 0; + } return VIRTQUEUE_MAX_SIZE; case VIRTIO_MMIO_QUEUEPFN: return virtio_queue_get_addr(vdev, vdev->queue_sel)