Re: [PATCH v6 19/20] vfio: mdev: Add device request interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
>  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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux