Re: [RFC PATCH 2/2] vfio-ccw: Wire in the request callback

Cornelia Huck
2020-11-19T12:00:26Z

On Thu, 19 Nov 2020 12:43:26 +0100
Cornelia Huck <cohuck@redhat.com> wrote:

> On Tue, 17 Nov 2020 04:21:39 +0100
> Eric Farman <farman@linux.ibm.com> wrote:
>
> > The device is being unplugged, so pass the request to userspace to
> > ask for a graceful cleanup. This should free up the thread that
> > would otherwise loop waiting for the device to be fully released.
> >
> > Signed-off-by: Eric Farman <farman@linux.ibm.com>
> > ---
> > drivers/s390/cio/vfio_ccw_ops.c | 26 ++++++++++++++++++++++++++
> > drivers/s390/cio/vfio_ccw_private.h | 4 ++++
> > include/uapi/linux/vfio.h | 1 +
> > 3 files changed, 31 insertions(+)
> >
>
> (...)
>
> > @@ -607,6 +611,27 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev,
> > }
> > }
> >
> > +/* Request removal of the device*/
> > +static void vfio_ccw_mdev_request(struct mdev_device *mdev, unsigned int count)
> > +{
> > + struct vfio_ccw_private *private = dev_get_drvdata(mdev_parent_dev(mdev));
> > +
> > + if (!private)
> > + return;
> > +
> > + if (private->req_trigger) {
> > + if (!(count % 10))
> > + dev_notice_ratelimited(mdev_dev(private->mdev),
> > + "Relaying device request to user (#%u)\n",
> > + count);
> > +
> > + eventfd_signal(private->req_trigger, 1);
> > + } else if (count == 0) {
> > + dev_notice(mdev_dev(private->mdev),
> > + "No device request channel registered, blocked until released by user\n");
> > + }
> > +}
>
> This looks like the vfio-pci request handler, so probably good :)
>
> Still have to read up on the QEMU side, but a LGTM for now.

And now that I've looked at the QEMU code:

Reviewed-by: Cornelia Huck <cohuck@redhat.com>