From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com, clg@redhat.com,
eric.auger@redhat.com, levon@movementarian.org,
Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: [PATCH v2 2/3] vfio/iommufd: Support unmap all in one ioctl()
Date: Thu, 9 Oct 2025 00:01:33 -0400 [thread overview]
Message-ID: <20251009040134.334251-3-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20251009040134.334251-1-zhenzhong.duan@intel.com>
IOMMUFD kernel uAPI supports unmapping whole address space in one call with
[iova, size] set to [0, UINT64_MAX], this can simplify iommufd_cdev_unmap()
a bit. See iommufd_ioas_unmap() in kernel for details.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/vfio/iommufd.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 68470d552e..336f8fdb04 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -62,21 +62,8 @@ static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,
{
const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
- /* unmap in halves */
if (unmap_all) {
- Int128 llsize = int128_rshift(int128_2_64(), 1);
- int ret;
-
- ret = iommufd_backend_unmap_dma(container->be, container->ioas_id,
- 0, int128_get64(llsize));
-
- if (ret == 0) {
- ret = iommufd_backend_unmap_dma(container->be, container->ioas_id,
- int128_get64(llsize),
- int128_get64(llsize));
- }
-
- return ret;
+ size = UINT64_MAX;
}
/* TODO: Handle dma_unmap_bitmap with iotlb args (migration) */
--
2.47.1
next prev parent reply other threads:[~2025-10-09 4:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Zhenzhong Duan [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251009040134.334251-3-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=alex.williamson@redhat.com \
--cc=clg@redhat.com \
--cc=eric.auger@redhat.com \
--cc=levon@movementarian.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).