[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V3 10/14] virtio: introduce virtio_queue_get_ind
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH V3 10/14] virtio: introduce virtio_queue_get_index() |
Date: |
Thu, 5 Mar 2015 14:12:31 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, 03/05 13:48, Jason Wang wrote:
> This patch introduces a helper that can get the queue index of a
> VirtQueue. This is useful when traversing the list of VirtQueues.
>
> Cc: Anthony Liguori <address@hidden>
> Cc: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Jason Wang <address@hidden>
> ---
> hw/virtio/virtio.c | 5 +++++
> include/hw/virtio/virtio.h | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 5e6b879..bd32518 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -725,6 +725,11 @@ hwaddr virtio_queue_get_addr(VirtIODevice *vdev, int n)
> return vdev->vq[n].pa;
> }
>
> +int virtio_queue_get_index(VirtIODevice *vdev, VirtQueue *vq)
> +{
> + return vq - vdev->vq;
Probably assert the return value is within [0, virtio_get_queue_max(vdev))?
Fam
> +}
> +
> void virtio_queue_set_num(VirtIODevice *vdev, int n, int num)
> {
> /* Don't allow guest to flip queue between existent and
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index ceab8e8..37aa9c4 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -217,6 +217,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);
> +int virtio_queue_get_index(VirtIODevice *vdev, VirtQueue *vq);
> void virtio_queue_set_num(VirtIODevice *vdev, int n, int num);
> int virtio_queue_get_num(VirtIODevice *vdev, int n);
> void virtio_queue_set_align(VirtIODevice *vdev, int n, int align);
> --
> 2.1.0
>
>
- Re: [Qemu-devel] [PATCH V3 08/14] virtio-pci: switch to use bus specific queue limit, (continued)
[Qemu-devel] [PATCH V3 07/14] virtio-mmio: switch to bus specific queue limit, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 09/14] virtio: introduce vector to virtqueues mapping, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 11/14] virtio-pci: speedup MSI-X masking and unmasking, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 10/14] virtio: introduce virtio_queue_get_index(), Jason Wang, 2015/03/05
- Re: [Qemu-devel] [PATCH V3 10/14] virtio: introduce virtio_queue_get_index(),
Fam Zheng <=
[Qemu-devel] [PATCH V3 12/14] virtio-pci: increase the maximum number of virtqueues to 513, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 14/14] virtio-pci: introduce auto_msix_bar_size property, Jason Wang, 2015/03/05
[Qemu-devel] [PATCH V3 13/14] pci: remove hard-coded bar size in msix_init_exclusive_bar(), Jason Wang, 2015/03/05
Re: [Qemu-devel] [PATCH V3 00/14] Support more virtio queues, Michael S. Tsirkin, 2015/03/12