summary refs log tree commit diff stats
path: root/include
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@intel.com>2023-10-09 11:09:14 +0200
committerCédric Le Goater <clg@redhat.com>2023-10-18 10:10:49 +0200
commit7103ef7e765dfdf84ba7042f46d3cc0da682cb89 (patch)
tree498bf7ccf1b0fafd4f801174d3d6c39b07b917f2 /include
parentc8fcb90c968717323a763d2152bc6103ce720b65 (diff)
downloadfocaccia-qemu-7103ef7e765dfdf84ba7042f46d3cc0da682cb89.tar.gz
focaccia-qemu-7103ef7e765dfdf84ba7042f46d3cc0da682cb89.zip
vfio/common: Introduce a per container device list
Several functions need to iterate over the VFIO devices attached to
a given container.  This is currently achieved by iterating over the
groups attached to the container and then over the devices in the group.
Let's introduce a per container device list that simplifies this
search.

Per container list is used in below functions:
vfio_devices_all_dirty_tracking
vfio_devices_all_device_dirty_tracking
vfio_devices_all_running_and_mig_active
vfio_devices_dma_logging_stop
vfio_devices_dma_logging_start
vfio_devices_query_dirty_bitmap

This will also ease the migration of IOMMUFD by hiding the group
specificity.

Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/vfio/vfio-common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index c486bdef2a..8ca70dd821 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -98,6 +98,7 @@ typedef struct VFIOContainer {
     QLIST_HEAD(, VFIOGroup) group_list;
     QLIST_HEAD(, VFIORamDiscardListener) vrdl_list;
     QLIST_ENTRY(VFIOContainer) next;
+    QLIST_HEAD(, VFIODevice) device_list;
 } VFIOContainer;
 
 typedef struct VFIOGuestIOMMU {
@@ -129,6 +130,7 @@ typedef struct VFIODeviceOps VFIODeviceOps;
 
 typedef struct VFIODevice {
     QLIST_ENTRY(VFIODevice) next;
+    QLIST_ENTRY(VFIODevice) container_next;
     struct VFIOGroup *group;
     char *sysfsdev;
     char *name;