[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJaqyWdxjmDVX4DQOdW90mkW_-MbP7AtK+Q_KdrsU0=nRdtGXQ@mail.gmail.com>
Date: Wed, 25 May 2022 08:43:27 +0200
From: Eugenio Perez Martin <eperezma@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: netdev <netdev@...r.kernel.org>,
virtualization <virtualization@...ts.linux-foundation.org>,
"Michael S. Tsirkin" <mst@...hat.com>, kvm <kvm@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Parav Pandit <parav@...dia.com>,
Zhang Min <zhang.min9@....com.cn>,
Harpreet Singh Anand <hanand@...inx.com>,
Zhu Lingshan <lingshan.zhu@...el.com>, tanuj.kamde@....com,
"Dawar, Gautam" <gautam.dawar@....com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Xie Yongji <xieyongji@...edance.com>,
Dinan Gunawardena <dinang@...inx.com>,
habetsm.xilinx@...il.com, Eli Cohen <elic@...dia.com>,
Pablo Cascon Katchadourian <pabloc@...inx.com>,
Laurent Vivier <lvivier@...hat.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Cindy Lu <lulu@...hat.com>,
Wu Zongyong <wuzongyong@...ux.alibaba.com>,
ecree.xilinx@...il.com, "Uminski, Piotr" <Piotr.Uminski@...el.com>,
Martin Porter <martinpo@...inx.com>,
Stefano Garzarella <sgarzare@...hat.com>,
Si-Wei Liu <si-wei.liu@...cle.com>,
Longpeng <longpeng2@...wei.com>,
Martin Petrus Hubertus Habets <martinh@...inx.com>
Subject: Re: [PATCH v2 3/4] vhost-vdpa: uAPI to stop the device
On Wed, May 25, 2022 at 4:51 AM Jason Wang <jasowang@...hat.com> wrote:
>
> On Wed, May 25, 2022 at 1:06 AM Eugenio Pérez <eperezma@...hat.com> wrote:
> >
> > The ioctl adds support for stop the device from userspace.
> >
> > Signed-off-by: Eugenio Pérez <eperezma@...hat.com>
> > ---
> > drivers/vhost/vdpa.c | 18 ++++++++++++++++++
> > include/uapi/linux/vhost.h | 3 +++
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> > index 32713db5831d..a5d33bad92f9 100644
> > --- a/drivers/vhost/vdpa.c
> > +++ b/drivers/vhost/vdpa.c
> > @@ -478,6 +478,21 @@ static long vhost_vdpa_get_vqs_count(struct vhost_vdpa *v, u32 __user *argp)
> > return 0;
> > }
> >
> > +static long vhost_vdpa_stop(struct vhost_vdpa *v, u32 __user *argp)
> > +{
> > + struct vdpa_device *vdpa = v->vdpa;
> > + const struct vdpa_config_ops *ops = vdpa->config;
> > + int stop;
> > +
> > + if (!ops->stop)
> > + return -EOPNOTSUPP;
> > +
> > + if (copy_from_user(&stop, argp, sizeof(stop)))
> > + return -EFAULT;
> > +
> > + return ops->stop(vdpa, stop);
> > +}
> > +
> > static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
> > void __user *argp)
> > {
> > @@ -650,6 +665,9 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
> > case VHOST_VDPA_GET_VQS_COUNT:
> > r = vhost_vdpa_get_vqs_count(v, argp);
> > break;
> > + case VHOST_STOP:
> > + r = vhost_vdpa_stop(v, argp);
> > + break;
> > default:
> > r = vhost_dev_ioctl(&v->vdev, cmd, argp);
> > if (r == -ENOIOCTLCMD)
> > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
> > index cab645d4a645..e7526968ab0c 100644
> > --- a/include/uapi/linux/vhost.h
> > +++ b/include/uapi/linux/vhost.h
> > @@ -171,4 +171,7 @@
> > #define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, \
> > struct vhost_vring_state)
> >
> > +/* Stop or resume a device so it does not process virtqueue requests anymore */
> > +#define VHOST_STOP _IOW(VHOST_VIRTIO, 0x7D, int)
> > +
>
> Unless we know it's a vhost general uAPI, let's use VHOST_VDPA_STOP here.
>
Ok I'll rename.
Thanks!
> Thanks
>
> > #endif
> > --
> > 2.27.0
> >
>
Powered by blists - more mailing lists