Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
  • Loading branch information
duanzhenzhong authored and legoater committed Dec 19, 2023
1 parent f61dddd commit d246685
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions hw/vfio/container.c
Expand Up @@ -472,6 +472,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,
Error **errp)
{
VFIOContainer *container;
VFIOContainerBase *bcontainer;
int ret, fd;
VFIOAddressSpace *space;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -933,3 +936,5 @@ void vfio_detach_device(VFIODevice *vbasedev)
vfio_put_base_device(vbasedev);
vfio_put_group(group);
}

const VFIOIOMMUOps vfio_legacy_ops;
2 changes: 1 addition & 1 deletion include/hw/vfio/vfio-common.h
Expand Up @@ -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;

Expand Down

0 comments on commit d246685

Please sign in to comment.