aboutsummaryrefslogtreecommitdiff
path: root/hw/vfio
diff options
context:
space:
mode:
authorCédric Le Goater <clg@redhat.com>2024-06-17 08:34:08 +0200
committerCédric Le Goater <clg@redhat.com>2024-06-24 23:15:31 +0200
commitb052f73cbec3bf593a04b2f5cdaf3569256859a3 (patch)
tree7fcb7c9cdbaaf6fbcb493350a2fc5573aff2a1f6 /hw/vfio
parent2f7243cb8a3184cc26c70805e5aaec07fac943d1 (diff)
vfio/container: Introduce vfio_iommu_legacy_instance_init()
Just as we did for the VFIOContainerBase object, introduce an instance_init() handler for the legacy VFIOContainer object and do the specific initialization there. Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio')
-rw-r--r--hw/vfio/container.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 3f2032d5c4..45123acbdd 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -639,7 +639,6 @@ static bool vfio_connect_container(VFIOGroup *group, AddressSpace *as,
vfio_kvm_device_add_group(group);
- QLIST_INIT(&container->group_list);
vfio_address_space_insert(space, bcontainer);
group->container = container;
@@ -1183,6 +1182,13 @@ hiod_legacy_vfio_get_iova_ranges(HostIOMMUDevice *hiod, Error **errp)
return l;
}
+static void vfio_iommu_legacy_instance_init(Object *obj)
+{
+ VFIOContainer *container = VFIO_IOMMU_LEGACY(obj);
+
+ QLIST_INIT(&container->group_list);
+}
+
static void hiod_legacy_vfio_class_init(ObjectClass *oc, void *data)
{
HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
@@ -1196,6 +1202,7 @@ static const TypeInfo types[] = {
{
.name = TYPE_VFIO_IOMMU_LEGACY,
.parent = TYPE_VFIO_IOMMU,
+ .instance_init = vfio_iommu_legacy_instance_init,
.instance_size = sizeof(VFIOContainer),
.class_init = vfio_iommu_legacy_class_init,
}, {