diff options
| author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2023-11-02 15:12:30 +0800 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2023-12-19 19:03:38 +0100 |
| commit | ed2f7f80170251e7cdd2965a13ee97527d1fbec8 (patch) | |
| tree | bcdb5322bc52268f2ad5cd6297f7b2a6b7174efd /hw/vfio/container.c | |
| parent | b08501a999e2448f500a46d68da503be55186b04 (diff) | |
| download | focaccia-qemu-ed2f7f80170251e7cdd2965a13ee97527d1fbec8.tar.gz focaccia-qemu-ed2f7f80170251e7cdd2965a13ee97527d1fbec8.zip | |
vfio/common: Introduce vfio_container_init/destroy helper
This adds two helper functions vfio_container_init/destroy which will be used by both legacy and iommufd containers to do base container specific initialization and release. No functional change intended. Suggested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/container.c')
| -rw-r--r-- | hw/vfio/container.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/vfio/container.c b/hw/vfio/container.c index c04df26323..32a0251dd1 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -559,7 +559,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as, QLIST_INIT(&container->giommu_list); QLIST_INIT(&container->vrdl_list); bcontainer = &container->bcontainer; - bcontainer->ops = &vfio_legacy_ops; + vfio_container_init(bcontainer, &vfio_legacy_ops); ret = vfio_init_container(container, group->fd, errp); if (ret) { @@ -661,6 +661,7 @@ put_space_exit: static void vfio_disconnect_container(VFIOGroup *group) { VFIOContainer *container = group->container; + VFIOContainerBase *bcontainer = &container->bcontainer; QLIST_REMOVE(group, container_next); group->container = NULL; @@ -695,6 +696,7 @@ static void vfio_disconnect_container(VFIOGroup *group) QLIST_REMOVE(giommu, giommu_next); g_free(giommu); } + vfio_container_destroy(bcontainer); trace_vfio_disconnect_container(container->fd); close(container->fd); |