On 10/9/25 06:01, Zhenzhong Duan wrote:
> Currently unmap_all is split into two ioctl() with each unmap half of
> the whole iova space.
>
> IOMMUFD supports unmap_all ioctl() from beginning, after kernel commit
> c19650995374 ("vfio/type1: implement unmap all") added same support
> for VFIO type1, the split becomes unnecessary.
>
> So optimize the code to only do one ioctl() to unmap_all for both
> backends.
>
> Test:
> In order to trigger unmap_all request, I have to fake a unmap_all request
> on x86. Maybe it's easy to trigger unmap_all with other arch, e.g., arm smmu,
> but for x86, iommu memory region is split by iommu_ir, unmap_all isn't
> triggered by default. See
> https://github.com/yiliu1765/qemu/commit/7afc7adac8fa601abd978b821c86e90e073d31ba
> for details.
>
> Thanks
> Zhenzhong
>
> Changelog:
> v2:
> - check unmap_all_supported instead of ioctl() for every unmap_all (John Levon)
> - make assertion a separate patch (Cedric)
> - pass VFIOLegacyContainer pointer in vfio_legacy_dma_unmap_one() (Cedric)
>
> Zhenzhong Duan (3):
> vfio/container: Support unmap all in one ioctl()
> vfio/iommufd: Support unmap all in one ioctl()
> vfio/listener: Add an assertion for unmap_all
>
> include/hw/vfio/vfio-container-legacy.h | 1 +
> hw/vfio/container-legacy.c | 38 ++++++++++++++-----------
> hw/vfio/iommufd.c | 15 +---------
> hw/vfio/listener.c | 1 +
> 4 files changed, 25 insertions(+), 30 deletions(-)
>
Applied to vfio-next.
Thanks,
C.