summary refs log tree commit diff stats
path: root/hw/vfio/container.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@redhat.com>2023-12-19 07:58:16 +0100
committerCédric Le Goater <clg@redhat.com>2024-01-05 21:25:20 +0100
commit001a013ea3f125d2ec0e709b5765754149d8d968 (patch)
treed586d9d93105734079f062f23acc639cb54b9f29 /hw/vfio/container.c
parent0c1eccd368af8805ec0fb11e6cf25d0684d37328 (diff)
downloadfocaccia-qemu-001a013ea3f125d2ec0e709b5765754149d8d968.tar.gz
focaccia-qemu-001a013ea3f125d2ec0e709b5765754149d8d968.zip
vfio/spapr: Extend VFIOIOMMUOps with a release handler
This allows to abstract a bit more the sPAPR IOMMU support in the
legacy IOMMU backend.

Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Tested-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/container.c')
-rw-r--r--hw/vfio/container.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index b22feb8ded..1e77a2929e 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -632,9 +632,8 @@ listener_release_exit:
     QLIST_REMOVE(bcontainer, next);
     vfio_kvm_device_del_group(group);
     memory_listener_unregister(&bcontainer->listener);
-    if (container->iommu_type == VFIO_SPAPR_TCE_v2_IOMMU ||
-        container->iommu_type == VFIO_SPAPR_TCE_IOMMU) {
-        vfio_spapr_container_deinit(container);
+    if (bcontainer->ops->release) {
+        bcontainer->ops->release(bcontainer);
     }
 
 enable_discards_exit:
@@ -667,9 +666,8 @@ static void vfio_disconnect_container(VFIOGroup *group)
      */
     if (QLIST_EMPTY(&container->group_list)) {
         memory_listener_unregister(&bcontainer->listener);
-        if (container->iommu_type == VFIO_SPAPR_TCE_v2_IOMMU ||
-            container->iommu_type == VFIO_SPAPR_TCE_IOMMU) {
-            vfio_spapr_container_deinit(container);
+        if (bcontainer->ops->release) {
+            bcontainer->ops->release(bcontainer);
         }
     }