qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Optimize unmap_all with one ioctl()
@ 2025-10-09  4:01 Zhenzhong Duan
  2025-10-09  4:01 ` [PATCH v2 1/3] vfio/container: Support unmap all in " Zhenzhong Duan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Zhenzhong Duan @ 2025-10-09  4:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson, clg, eric.auger, levon, Zhenzhong Duan

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(-)

-- 
2.47.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-10-09  8:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09  4:01 [PATCH v2 0/3] Optimize unmap_all with one ioctl() Zhenzhong Duan
2025-10-09  4:01 ` [PATCH v2 1/3] vfio/container: Support unmap all in " Zhenzhong Duan
2025-10-09  4:01 ` [PATCH v2 2/3] vfio/iommufd: " Zhenzhong Duan
2025-10-09  4:01 ` [PATCH v2 3/3] vfio/listener: Add an assertion for unmap_all Zhenzhong Duan
2025-10-09  7:35 ` [PATCH v2 0/3] Optimize unmap_all with one ioctl() Cédric Le Goater
2025-10-09  8:05 ` Cédric Le Goater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).