From: Zhenzhong Duan Date: Thu, 2 Nov 2023 07:12:28 +0000 (+0800) Subject: vfio/container: Introduce a empty VFIOIOMMUOps X-Git-Tag: v9.0.0-rc0~136^2~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d24668579184f4098779983724ec74cd3db62e10;p=thirdparty%2Fqemu.git vfio/container: Introduce a empty VFIOIOMMUOps This empty VFIOIOMMUOps named vfio_legacy_ops will hold all general IOMMU ops of legacy container. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 242010036af..4bc43ddfa44 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -472,6 +472,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as, Error **errp) { VFIOContainer *container; + VFIOContainerBase *bcontainer; int ret, fd; VFIOAddressSpace *space; @@ -552,6 +553,8 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as, container->iova_ranges = NULL; QLIST_INIT(&container->giommu_list); QLIST_INIT(&container->vrdl_list); + bcontainer = &container->bcontainer; + bcontainer->ops = &vfio_legacy_ops; ret = vfio_init_container(container, group->fd, errp); if (ret) { @@ -933,3 +936,5 @@ void vfio_detach_device(VFIODevice *vbasedev) vfio_put_base_device(vbasedev); vfio_put_group(group); } + +const VFIOIOMMUOps vfio_legacy_ops; diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 586d153c12b..678161f2079 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -255,7 +255,7 @@ typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList; extern VFIOGroupList vfio_group_list; extern VFIODeviceList vfio_device_list; - +extern const VFIOIOMMUOps vfio_legacy_ops; extern const MemoryListener vfio_memory_listener; extern int vfio_kvm_device_fd;