[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJaqyWfhO532qW+9eWmJqV3JxvvqnB2QZfi1JqUYXPLuiAsggQ@mail.gmail.com>
Date: Wed, 20 Dec 2023 17:32:26 +0100
From: Eugenio Perez Martin <eperezma@...hat.com>
To: Dragos Tatulea <dtatulea@...dia.com>
Cc: "Michael S . Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Si-Wei Liu <si-wei.liu@...cle.com>, Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>, virtualization@...ts.linux-foundation.org,
Gal Pressman <gal@...dia.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Parav Pandit <parav@...dia.com>, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Subject: Re: [PATCH vhost v4 08/15] vdpa: Block vq state change in DRIVER_OK
unless device supports it
On Tue, Dec 19, 2023 at 7:10 PM Dragos Tatulea <dtatulea@...dia.com> wrote:
>
> Virtqueue state change during DRIVE_OK is not supported by the virtio
> standard. Allow this op in DRIVER_OK only for devices that support
> changing the state during DRIVER_OK if the device is suspended.
>
> Signed-off-by: Dragos Tatulea <dtatulea@...dia.com>
> Suggested-by: Eugenio Pérez <eperezma@...hat.com>
Acked-by: Eugenio Pérez <eperezma@...hat.com>
> ---
> drivers/vhost/vdpa.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 6bfa3391935a..77509440c723 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -641,6 +641,9 @@ static bool vhost_vdpa_vq_config_allowed(struct vhost_vdpa *v, unsigned int cmd)
> case VHOST_SET_VRING_ADDR:
> feature = VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND;
> break;
> + case VHOST_SET_VRING_BASE:
> + feature = VHOST_BACKEND_F_CHANGEABLE_VQ_STATE_IN_SUSPEND;
> + break;
> default:
> return false;
> }
> @@ -737,6 +740,9 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
> break;
>
> case VHOST_SET_VRING_BASE:
> + if (!vhost_vdpa_vq_config_allowed(v, cmd))
> + return -EOPNOTSUPP;
> +
> if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) {
> vq_state.packed.last_avail_idx = vq->last_avail_idx & 0x7fff;
> vq_state.packed.last_avail_counter = !!(vq->last_avail_idx & 0x8000);
> --
> 2.43.0
>
Powered by blists - more mailing lists