All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	KONRAD Frederic <fred.konrad@greensocs.com>,
	kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org,
	patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 2/2] hw/virtio/virtio-mmio: Make QueueNumMax read 0 for unavailable queues
Date: Fri, 26 Jul 2013 01:34:42 +0300	[thread overview]
Message-ID: <20130725223442.GB28632@redhat.com> (raw)
In-Reply-To: <1374759463-6351-3-git-send-email-peter.maydell@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 <peter.maydell@linaro.org>
> ---
>  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

  reply	other threads:[~2013-07-25 22:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 13:37 [Qemu-devel] [PATCH 0/2] virtio-mmio: fixes to QueueNum, QueueNumMax Peter Maydell
2013-07-25 13:37 ` [Qemu-devel] [PATCH 1/2] hw/virtio/virtio: Don't allow guests to add/remove queues Peter Maydell
2013-07-25 22:33   ` Michael S. Tsirkin
2013-07-25 22:37     ` Peter Maydell
2013-07-25 23:27       ` Michael S. Tsirkin
2013-07-26  8:05         ` Peter Maydell
2013-07-28  6:54           ` Michael S. Tsirkin
2013-07-25 13:37 ` [Qemu-devel] [PATCH 2/2] hw/virtio/virtio-mmio: Make QueueNumMax read 0 for unavailable queues Peter Maydell
2013-07-25 22:34   ` Michael S. Tsirkin [this message]
2013-07-25 22:37     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130725223442.GB28632@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=fred.konrad@greensocs.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.