[PATCH v11 06/12] vhost: forbid change vq groups ASID if DRIVER_OK is set

Eugenio Pérez posted 12 patches 4 weeks, 1 day ago
There is a newer version of this series
[PATCH v11 06/12] vhost: forbid change vq groups ASID if DRIVER_OK is set
Posted by Eugenio Pérez 4 weeks, 1 day ago
Only vdpa_sim support it.  Forbid this behavious as there is no use for
it right now, we can always enable it in the future with a feature flag.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 drivers/vhost/vdpa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 9d25b735b43d..3f0184d42075 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -682,6 +682,8 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
 			return -EFAULT;
 		if (idx >= vdpa->ngroups || s.num >= vdpa->nas)
 			return -EINVAL;
+		if (ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)
+			return -EBUSY;
 		if (!ops->set_group_asid)
 			return -EOPNOTSUPP;
 		return ops->set_group_asid(vdpa, idx, s.num);
-- 
2.52.0

Re: [PATCH v11 06/12] vhost: forbid change vq groups ASID if DRIVER_OK is set
Posted by Michael S. Tsirkin 4 weeks ago
On Fri, Jan 09, 2026 at 04:24:24PM +0100, Eugenio Pérez wrote:
> Only vdpa_sim support it.  Forbid this behavious as there is no use for

behaviour

> it right now, we can always enable it in the future with a feature flag.
> 
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>  drivers/vhost/vdpa.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 9d25b735b43d..3f0184d42075 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -682,6 +682,8 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
>  			return -EFAULT;
>  		if (idx >= vdpa->ngroups || s.num >= vdpa->nas)
>  			return -EINVAL;
> +		if (ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)
> +			return -EBUSY;
>  		if (!ops->set_group_asid)
>  			return -EOPNOTSUPP;
>  		return ops->set_group_asid(vdpa, idx, s.num);
> -- 
> 2.52.0
Re: [PATCH v11 06/12] vhost: forbid change vq groups ASID if DRIVER_OK is set
Posted by Eugenio Perez Martin 3 weeks, 6 days ago
On Sun, Jan 11, 2026 at 12:49 AM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Fri, Jan 09, 2026 at 04:24:24PM +0100, Eugenio Pérez wrote:
> > Only vdpa_sim support it.  Forbid this behavious as there is no use for
>
> behaviour
>

Fixing in the next version, thanks!

> > it right now, we can always enable it in the future with a feature flag.
> >
> > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > ---
> >  drivers/vhost/vdpa.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> > index 9d25b735b43d..3f0184d42075 100644
> > --- a/drivers/vhost/vdpa.c
> > +++ b/drivers/vhost/vdpa.c
> > @@ -682,6 +682,8 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
> >                       return -EFAULT;
> >               if (idx >= vdpa->ngroups || s.num >= vdpa->nas)
> >                       return -EINVAL;
> > +             if (ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)
> > +                     return -EBUSY;
> >               if (!ops->set_group_asid)
> >                       return -EOPNOTSUPP;
> >               return ops->set_group_asid(vdpa, idx, s.num);
> > --
> > 2.52.0
>