[Devel] [PATCH hci-8.1 1/5] Revert "vfio: revert "iommu driver notify callback""

Andrey Drobyshev andrey.drobyshev at virtuozzo.com
Fri Oct 23 19:53:39 MSK 2026


From: Anthony Yznaga <anthony.yznaga at oracle.com>

This reverts commit e592296cd6e15ddeebe4c8411365c550da65c8bf.

This is needed in order to re-enable support for using VFIO_UPDATE_VADDR
with vfio mediated devices which is needed to fully support Live Update.

Orabug: 35370252
Signed-off-by: Anthony Yznaga <anthony.yznaga at oracle.com>
Reviewed-by: Steve Sistare <steven.sistare at oracle.com>

https://virtuozzo.atlassian.net/browse/VSTOR-150595
(cherry picked from commit 698288d494ff9be37b208daf89ea163378a23253)
---
 drivers/vfio/container.c | 5 +++++
 drivers/vfio/vfio.h      | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/vfio/container.c b/drivers/vfio/container.c
index d53d08f16973..849785b533ce 100644
--- a/drivers/vfio/container.c
+++ b/drivers/vfio/container.c
@@ -376,6 +376,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;
 
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index 50128da18bca..a9adfe2242d8 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -196,6 +196,11 @@ static inline bool vfio_device_is_noiommu(struct vfio_device *vdev)
 #endif /* CONFIG_VFIO_GROUP */
 
 #if IS_ENABLED(CONFIG_VFIO_CONTAINER)
+/* events for the backend driver notify callback */
+enum vfio_iommu_notify_type {
+	VFIO_IOMMU_CONTAINER_CLOSE = 0,
+};
+
 /**
  * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks
  */
@@ -226,6 +231,8 @@ struct vfio_iommu_driver_ops {
 				  void *data, size_t count, bool write);
 	struct iommu_domain *(*group_iommu_domain)(void *iommu_data,
 						   struct iommu_group *group);
+	void		(*notify)(void *iommu_data,
+				  enum vfio_iommu_notify_type event);
 };
 
 struct vfio_iommu_driver {
-- 
2.47.1



More information about the Devel mailing list