diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/vfio/container-base.c | 9 | ||||
-rw-r--r-- | hw/vfio/container.c | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c index 55d3a35fa4..e929435751 100644 --- a/hw/vfio/container-base.c +++ b/hw/vfio/container-base.c @@ -30,3 +30,12 @@ int vfio_container_dma_unmap(VFIOContainerBase *bcontainer, g_assert(bcontainer->ops->dma_unmap); return bcontainer->ops->dma_unmap(bcontainer, iova, size, iotlb); } + +void vfio_container_init(VFIOContainerBase *bcontainer, const VFIOIOMMUOps *ops) +{ + bcontainer->ops = ops; +} + +void vfio_container_destroy(VFIOContainerBase *bcontainer) +{ +} 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); |