[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/40] vdpa: factor out vhost_vdpa_last_dev
From: |
Eugenio Perez Martin |
Subject: |
Re: [PATCH 11/40] vdpa: factor out vhost_vdpa_last_dev |
Date: |
Mon, 11 Dec 2023 14:36:54 +0100 |
On Thu, Dec 7, 2023 at 7:50 PM Si-Wei Liu <si-wei.liu@oracle.com> wrote:
>
> Generalize duplicated condition check for the last vq of vdpa
> device to a common function.
>
> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
We can also send this separately,
Reviewed-by: Eugenio Pérez <eperezma@redhat.com>
> ---
> hw/virtio/vhost-vdpa.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 30dff95..2b1cc14 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -593,6 +593,11 @@ static bool vhost_vdpa_first_dev(struct vhost_dev *dev)
> return v->index == 0;
> }
>
> +static bool vhost_vdpa_last_dev(struct vhost_dev *dev)
> +{
> + return dev->vq_index + dev->nvqs == dev->vq_index_end;
> +}
> +
> static int vhost_vdpa_get_dev_features(struct vhost_dev *dev,
> uint64_t *features)
> {
> @@ -1432,7 +1437,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev,
> bool started)
> goto out_stop;
> }
>
> - if (dev->vq_index + dev->nvqs != dev->vq_index_end) {
> + if (!vhost_vdpa_last_dev(dev)) {
> return 0;
> }
>
> @@ -1467,7 +1472,7 @@ static void vhost_vdpa_reset_status(struct vhost_dev
> *dev)
> {
> struct vhost_vdpa *v = dev->opaque;
>
> - if (dev->vq_index + dev->nvqs != dev->vq_index_end) {
> + if (!vhost_vdpa_last_dev(dev)) {
> return;
> }
>
> --
> 1.8.3.1
>
- [PATCH 09/40] vdpa: no repeat setting shadow_data, (continued)
- [PATCH 09/40] vdpa: no repeat setting shadow_data, Si-Wei Liu, 2023/12/07
- [PATCH 10/40] vdpa: assign svq descriptors a separate ASID when possible, Si-Wei Liu, 2023/12/07
- [PATCH 13/40] vdpa: ref counting VhostVDPAShared, Si-Wei Liu, 2023/12/07
- [PATCH 14/40] vdpa: convert iova_tree to ref count based, Si-Wei Liu, 2023/12/07
- [PATCH 15/40] vdpa: add svq_switching and flush_map to header, Si-Wei Liu, 2023/12/07
- [PATCH 12/40] vdpa: check map_thread_enabled before join maps thread, Si-Wei Liu, 2023/12/07
- [PATCH 11/40] vdpa: factor out vhost_vdpa_last_dev, Si-Wei Liu, 2023/12/07
- Re: [PATCH 11/40] vdpa: factor out vhost_vdpa_last_dev,
Eugenio Perez Martin <=
- [PATCH 17/40] vdpa: judge if map can be kept across reset, Si-Wei Liu, 2023/12/07
- [PATCH 18/40] vdpa: unregister listener on last dev cleanup, Si-Wei Liu, 2023/12/07
- [PATCH 08/40] vdpa: add back vhost_vdpa_net_first_nc_vdpa, Si-Wei Liu, 2023/12/07
- [PATCH 22/40] vdpa: factor out vhost_vdpa_map_batch_begin, Si-Wei Liu, 2023/12/07
- [PATCH 25/40] vdpa: add asid to dma_batch_once API, Si-Wei Liu, 2023/12/07
- [PATCH 19/40] vdpa: should avoid map flushing with persistent iotlb, Si-Wei Liu, 2023/12/07