diff options
| author | Eric Auger <eric.auger@redhat.com> | 2024-06-14 11:52:53 +0200 |
|---|---|---|
| committer | Cédric Le Goater <clg@redhat.com> | 2024-06-24 23:15:30 +0200 |
| commit | 3ad35d9158bde0500aeaea4147345d39ad0ae1c0 (patch) | |
| tree | 1257f28689104132debe7f8ffa26adb121131cbd /hw/vfio/container.c | |
| parent | 817ef10da23cd9a6ee61c8f31f55b845c7a74760 (diff) | |
| download | focaccia-qemu-3ad35d9158bde0500aeaea4147345d39ad0ae1c0.tar.gz focaccia-qemu-3ad35d9158bde0500aeaea4147345d39ad0ae1c0.zip | |
HostIOMMUDevice: Introduce get_iova_ranges callback
Introduce a new HostIOMMUDevice callback that allows to retrieve the usable IOVA ranges. Implement this callback in the legacy VFIO and IOMMUFD VFIO host iommu devices. This relies on the VFIODevice agent's base container iova_ranges resource. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/vfio/container.c')
| -rw-r--r-- | hw/vfio/container.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/vfio/container.c b/hw/vfio/container.c index b728b978a2..c48749c089 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -1164,12 +1164,28 @@ static int hiod_legacy_vfio_get_cap(HostIOMMUDevice *hiod, int cap, } } +static GList * +hiod_legacy_vfio_get_iova_ranges(HostIOMMUDevice *hiod, Error **errp) +{ + VFIODevice *vdev = hiod->agent; + GList *l = NULL; + + g_assert(vdev); + + if (vdev->bcontainer) { + l = g_list_copy(vdev->bcontainer->iova_ranges); + } + + return l; +} + static void hiod_legacy_vfio_class_init(ObjectClass *oc, void *data) { HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc); hioc->realize = hiod_legacy_vfio_realize; hioc->get_cap = hiod_legacy_vfio_get_cap; + hioc->get_iova_ranges = hiod_legacy_vfio_get_iova_ranges; }; static const TypeInfo types[] = { |