summary refs log tree commit diff stats
path: root/hw/vfio/device.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/device.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/device.c')
-rw-r--r--hw/vfio/device.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/vfio/device.c b/hw/vfio/device.c
index f3b9902d21..31c441a3df 100644
--- a/hw/vfio/device.c
+++ b/hw/vfio/device.c
@@ -412,3 +412,10 @@ void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainerBase *bcontainer,
 
     QLIST_INSERT_HEAD(&vfio_device_list, vbasedev, global_next);
 }
+
+void vfio_device_unprepare(VFIODevice *vbasedev)
+{
+    QLIST_REMOVE(vbasedev, container_next);
+    QLIST_REMOVE(vbasedev, global_next);
+    vbasedev->bcontainer = NULL;
+}