vfio/iommufd: Add support for iova_ranges and pgsizes
commit714e9affa8ae1d84007c8afde7bb10fef9cb883d
authorZhenzhong Duan <zhenzhong.duan@intel.com>
Tue, 21 Nov 2023 08:44:05 +0000 (21 16:44 +0800)
committerCédric Le Goater <clg@redhat.com>
Tue, 19 Dec 2023 18:03:38 +0000 (19 19:03 +0100)
tree2c772372dd0952aaa588a81b86652e792ca0fe5d
parent36e84d0c17102fa1c887d8c650a13ec08fca0ec0
vfio/iommufd: Add support for iova_ranges and pgsizes

Some vIOMMU such as virtio-iommu use IOVA ranges from host side to
setup reserved ranges for passthrough device, so that guest will not
use an IOVA range beyond host support.

Use an uAPI of IOMMUFD to get IOVA ranges of host side and pass to
vIOMMU just like the legacy backend, if this fails, fallback to
64bit IOVA range.

Also use out_iova_alignment returned from uAPI as pgsizes instead of
qemu_real_host_page_size() as a fallback.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/vfio/iommufd.c