[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210523223810.GE1002214@nvidia.com>
Date: Sun, 23 May 2021 19:38:10 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Dave Jiang <dave.jiang@...el.com>
Cc: alex.williamson@...hat.com, kwankhede@...dia.com,
tglx@...utronix.de, vkoul@...nel.org, megha.dey@...el.com,
jacob.jun.pan@...el.com, ashok.raj@...el.com, yi.l.liu@...el.com,
baolu.lu@...el.com, kevin.tian@...el.com, sanjay.k.kumar@...el.com,
tony.luck@...el.com, dan.j.williams@...el.com,
eric.auger@...hat.com, pbonzini@...hat.com,
dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH v6 19/20] vfio: mdev: Add device request interface
On Fri, May 21, 2021 at 05:21:03PM -0700, Dave Jiang wrote:
> Similar to commit 6140a8f56238 ("vfio-pci: Add device request interface").
> Add request interface for mdev to allow userspace to opt in to receive
> a device request notification, indicating that the device should be
> released.
>
> Signed-off-by: Dave Jiang <dave.jiang@...el.com>
> ---
> drivers/vfio/mdev/mdev_irqs.c | 23 +++++++++++++++++++++++
> include/linux/mdev.h | 15 +++++++++++++++
> 2 files changed, 38 insertions(+)
Please don't add new things to mdev, put the req_trigger in the vdcm_idxd
struct vfio_device class.
> diff --git a/drivers/vfio/mdev/mdev_irqs.c b/drivers/vfio/mdev/mdev_irqs.c
> index ed2d11a7c729..11b1f8df020c 100644
> --- a/drivers/vfio/mdev/mdev_irqs.c
> +++ b/drivers/vfio/mdev/mdev_irqs.c
and similarly this shouldn't be called mdev_irqs and the code in here
should have nothign to do with mdevs. Providing the special IRQ
emulation stuff is just generic vfio_device functionality with no
linkage to mdev.
> @@ -316,3 +316,26 @@ void mdev_irqs_free(struct mdev_device *mdev)
> memset(&mdev->mdev_irq, 0, sizeof(mdev->mdev_irq));
> }
> EXPORT_SYMBOL_GPL(mdev_irqs_free);
> +
> +void vfio_mdev_request(struct vfio_device *vdev, unsigned int count)
> +{
> + struct device *dev = vdev->dev;
> + struct mdev_device *mdev = to_mdev_device(dev);
Yuk, don't do stuff like that, if it needs a mdev then pass in a mdev.
Jason
Powered by blists - more mailing lists