@@ -206,6 +206,8 @@ typedef struct VFIODisplay {
VFIOAddressSpace *vfio_get_address_space(AddressSpace *as);
void vfio_put_address_space(VFIOAddressSpace *space);
+void vfio_address_space_insert(VFIOAddressSpace *space,
+ VFIOContainerBase *bcontainer);
void vfio_disable_irqindex(VFIODevice *vbasedev, int index);
void vfio_unmask_single_irqindex(VFIODevice *vbasedev, int index);
@@ -1508,6 +1508,12 @@ void vfio_put_address_space(VFIOAddressSpace *space)
}
}
+void vfio_address_space_insert(VFIOAddressSpace *space,
+ VFIOContainerBase *bcontainer)
+{
+ QLIST_INSERT_HEAD(&space->containers, bcontainer, next);
+}
+
struct vfio_device_info *vfio_get_device_info(int fd)
{
struct vfio_device_info *info;
@@ -637,7 +637,7 @@ static bool vfio_connect_container(VFIOGroup *group, AddressSpace *as,
vfio_kvm_device_add_group(group);
QLIST_INIT(&container->group_list);
- QLIST_INSERT_HEAD(&space->containers, bcontainer, next);
+ vfio_address_space_insert(space, bcontainer);
group->container = container;
QLIST_INSERT_HEAD(&container->group_list, group, container_next);
@@ -358,7 +358,7 @@ static bool iommufd_cdev_attach(const char *name, VFIODevice *vbasedev,
bcontainer = &container->bcontainer;
vfio_container_init(bcontainer, space, iommufd_vioc);
- QLIST_INSERT_HEAD(&space->containers, bcontainer, next);
+ vfio_address_space_insert(space, bcontainer);
if (!iommufd_cdev_attach_container(vbasedev, container, errp)) {
goto err_attach_container;
It will ease future changes. Signed-off-by: Cédric Le Goater <clg@redhat.com> --- include/hw/vfio/vfio-common.h | 2 ++ hw/vfio/common.c | 6 ++++++ hw/vfio/container.c | 2 +- hw/vfio/iommufd.c | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-)