From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2U6K-0006bz-5k for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:33:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2U6H-0002Lf-MO for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:33:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2U6H-0002Jx-FR for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:33:33 -0400 Date: Fri, 26 Jul 2013 01:34:42 +0300 From: "Michael S. Tsirkin" Message-ID: <20130725223442.GB28632@redhat.com> References: <1374759463-6351-1-git-send-email-peter.maydell@linaro.org> <1374759463-6351-3-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374759463-6351-3-git-send-email-peter.maydell@linaro.org> Subject: Re: [Qemu-devel] [PATCH 2/2] hw/virtio/virtio-mmio: Make QueueNumMax read 0 for unavailable queues List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Anthony Liguori , KONRAD Frederic , kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org, patches@linaro.org On Thu, Jul 25, 2013 at 02:37:43PM +0100, Peter Maydell wrote: > 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; > + } All other callers do: if (!virtio_queue_get_num(vdev, vdev->queue_sel)) { So please make this one consistent and use the shorter form. > return VIRTQUEUE_MAX_SIZE; > case VIRTIO_MMIO_QUEUEPFN: > return virtio_queue_get_addr(vdev, vdev->queue_sel) > -- > 1.7.9.5