public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clegoate@redhat.com>
To: Tony Krowiak <akrowiak@linux.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org
Cc: jjherne@linux.ibm.com, pasic@linux.ibm.com, farman@linux.ibm.com,
	mjrosato@linux.ibm.com, alex.williamson@redhat.com,
	borntraeger@linux.ibm.com
Subject: Re: [PATCH 3/3] s390/vfio-ap: Wire in the vfio_device_ops request callback
Date: Wed, 31 May 2023 15:01:12 +0200	[thread overview]
Message-ID: <e7ec6a4c-2eeb-3a08-5add-a06e250162b6@redhat.com> (raw)
In-Reply-To: <20230530223538.279198-4-akrowiak@linux.ibm.com>

On 5/31/23 00:35, Tony Krowiak wrote:
> The mdev device is being removed, 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: Tony Krowiak <akrowiak@linux.ibm.com>

Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   drivers/s390/crypto/vfio_ap_ops.c | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index 44f159136891..a8f58e133e6e 100644
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -1736,6 +1736,26 @@ static void vfio_ap_mdev_close_device(struct vfio_device *vdev)
>   	vfio_ap_mdev_unset_kvm(matrix_mdev);
>   }
>   
> +static void vfio_ap_mdev_request(struct vfio_device *vdev, unsigned int count)
> +{
> +	struct device *dev = vdev->dev;
> +	struct ap_matrix_mdev *matrix_mdev;
> +
> +	matrix_mdev = container_of(vdev, struct ap_matrix_mdev, vdev);
> +
> +	if (matrix_mdev->req_trigger) {
> +		if (!(count % 10))
> +			dev_notice_ratelimited(dev,
> +					       "Relaying device request to user (#%u)\n",
> +					       count);
> +
> +		eventfd_signal(matrix_mdev->req_trigger, 1);
> +	} else if (count == 0) {
> +		dev_notice(dev,
> +			   "No device request registered, blocked until released by user\n");
> +	}
> +}
> +
>   static int vfio_ap_mdev_get_device_info(unsigned long arg)
>   {
>   	unsigned long minsz;
> @@ -1955,6 +1975,7 @@ static const struct vfio_device_ops vfio_ap_matrix_dev_ops = {
>   	.bind_iommufd = vfio_iommufd_emulated_bind,
>   	.unbind_iommufd = vfio_iommufd_emulated_unbind,
>   	.attach_ioas = vfio_iommufd_emulated_attach_ioas,
> +	.request = vfio_ap_mdev_request
>   };
>   
>   static struct mdev_driver vfio_ap_matrix_driver = {


  reply	other threads:[~2023-05-31 13:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 22:35 [PATCH 0/3] s390/vfio-ap: fix hang when mdev attached to guest is removed Tony Krowiak
2023-05-30 22:35 ` [PATCH 1/3] vfio: ap: realize the VFIO_DEVICE_GET_IRQ_INFO ioctl Tony Krowiak
2023-05-31 12:54   ` Cédric Le Goater
2023-05-31 13:05     ` Anthony Krowiak
2023-05-31 13:20       ` Cédric Le Goater
2023-06-01 20:46   ` Alex Williamson
2023-05-30 22:35 ` [PATCH 2/3] vfio: ap: realize the VFIO_DEVICE_SET_IRQS ioctl Tony Krowiak
2023-05-31 13:00   ` Cédric Le Goater
2023-05-30 22:35 ` [PATCH 3/3] s390/vfio-ap: Wire in the vfio_device_ops request callback Tony Krowiak
2023-05-31 13:01   ` Cédric Le Goater [this message]
2023-05-31 14:48 ` [PATCH 0/3] s390/vfio-ap: fix hang when mdev attached to guest is removed Matthew Rosato
2023-06-01 12:15   ` Anthony Krowiak
2023-06-01 12:57     ` Matthew Rosato
2023-05-31 14:51 ` Matthew Rosato
2023-06-01 20:47   ` Alex Williamson
2023-06-02 12:46     ` Alexander Gordeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7ec6a4c-2eeb-3a08-5add-a06e250162b6@redhat.com \
    --to=clegoate@redhat.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=farman@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox