summary refs log tree commit diff stats
path: root/hw/vfio/iommufd.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2025-05-07 16:20:07 +0100
committerCédric Le Goater <clg@redhat.com>2025-05-09 12:42:28 +0200
commitd60fb709cf948b3dc508eb88162f5666a49762ae (patch)
tree33abc433764c6685d2164237140c1c01f5eb7e5d /hw/vfio/iommufd.c
parenta901682f53b51c07dc27aab7e30256855a2a1f2f (diff)
downloadfocaccia-qemu-d60fb709cf948b3dc508eb88162f5666a49762ae.tar.gz
focaccia-qemu-d60fb709cf948b3dc508eb88162f5666a49762ae.zip
vfio: add vfio_device_unprepare()
Add a helper that's the inverse of vfio_device_prepare().

Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: John Levon <john.levon@nutanix.com>
Link: https://lore.kernel.org/qemu-devel/20250507152020.1254632-3-john.levon@nutanix.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/iommufd.c')
-rw-r--r--hw/vfio/iommufd.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 83033c352a..62ecb758f1 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -615,9 +615,7 @@ static void iommufd_cdev_detach(VFIODevice *vbasedev)
     VFIOIOMMUFDContainer *container = container_of(bcontainer,
                                                    VFIOIOMMUFDContainer,
                                                    bcontainer);
-    QLIST_REMOVE(vbasedev, global_next);
-    QLIST_REMOVE(vbasedev, container_next);
-    vbasedev->bcontainer = NULL;
+    vfio_device_unprepare(vbasedev);
 
     if (!vbasedev->ram_block_discard_allowed) {
         iommufd_cdev_ram_block_discard_disable(false);