summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2021-01-29 19:54:10 +0300
committerAlex Williamson <alex.williamson@redhat.com>2021-02-01 23:20:07 +0300
commitec5e32940cc9d2a8a321cb7d756fb6ae45702d03 (patch)
treee0314bcdcfd0ddb83fcf52a1c76b5f1b9bc94e73 /drivers/vfio
parentc3cbab24db3860d68924d8a3f752a97d3cca1623 (diff)
downloadlinux-ec5e32940cc9d2a8a321cb7d756fb6ae45702d03.tar.xz
vfio: iommu driver notify callback
Define a vfio_iommu_driver_ops notify callback, for sending events to the driver. Drivers are not required to provide the callback, and may ignore any events. The handling of events is driver specific. Define the CONTAINER_CLOSE event, called when the container's file descriptor is closed. This event signifies that no further state changes will occur via container ioctl's. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/vfio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 4ad8a35667a7..38779e6fd80c 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -1220,6 +1220,11 @@ static int vfio_fops_open(struct inode *inode, struct file *filep)
static int vfio_fops_release(struct inode *inode, struct file *filep)
{
struct vfio_container *container = filep->private_data;
+ struct vfio_iommu_driver *driver = container->iommu_driver;
+
+ if (driver && driver->ops->notify)
+ driver->ops->notify(container->iommu_data,
+ VFIO_IOMMU_CONTAINER_CLOSE);
filep->private_data = NULL;