@@ -216,6 +216,7 @@ struct vfio_device_info *vfio_get_device_info(int fd);
int vfio_attach_device(char *name, VFIODevice *vbasedev,
AddressSpace *as, Error **errp);
void vfio_detach_device(VFIODevice *vbasedev);
+void host_iommu_device_init(VFIODevice *vbasedev);
int vfio_kvm_device_add_fd(int fd, Error **errp);
int vfio_kvm_device_del_fd(int fd, Error **errp);
@@ -120,6 +120,7 @@ struct VFIOIOMMUClass {
int (*attach_device)(const char *name, VFIODevice *vbasedev,
AddressSpace *as, Error **errp);
void (*detach_device)(VFIODevice *vbasedev);
+ void (*host_iommu_device_init)(VFIODevice *vbasedev);
/* migration feature */
int (*set_dirty_page_tracking)(const VFIOContainerBase *bcontainer,
bool start);
@@ -1521,3 +1521,11 @@ void vfio_detach_device(VFIODevice *vbasedev)
}
vbasedev->bcontainer->ops->detach_device(vbasedev);
}
+
+void host_iommu_device_init(VFIODevice *vbasedev)
+{
+ const VFIOIOMMUClass *ops = vbasedev->bcontainer->ops;
+
+ assert(ops->host_iommu_device_init);
+ ops->host_iommu_device_init(vbasedev);
+}
Introduce host_iommu_device_init callback and a wrapper for it. Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> --- include/hw/vfio/vfio-common.h | 1 + include/hw/vfio/vfio-container-base.h | 1 + hw/vfio/common.c | 8 ++++++++ 3 files changed, 10 insertions(+)