From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48117 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727512AbgKSLnk (ORCPT ); Thu, 19 Nov 2020 06:43:40 -0500 Date: Thu, 19 Nov 2020 12:43:26 +0100 From: Cornelia Huck Subject: Re: [RFC PATCH 2/2] vfio-ccw: Wire in the request callback Message-ID: <20201119124326.0345a353.cohuck@redhat.com> In-Reply-To: <20201117032139.50988-3-farman@linux.ibm.com> References: <20201117032139.50988-1-farman@linux.ibm.com> <20201117032139.50988-3-farman@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-ID: To: Eric Farman Cc: Kirti Wankhede , Alex Williamson , Halil Pasic , linux-s390@vger.kernel.org, kvm@vger.kernel.org On Tue, 17 Nov 2020 04:21:39 +0100 Eric Farman 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 > --- > 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.