qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
	"Zhenzhong Duan" <zhenzhong.duan@intel.com>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 07/12] vfio/iommufd: Support unmap all in one ioctl()
Date: Wed, 22 Oct 2025 14:18:41 +0200	[thread overview]
Message-ID: <20251022121846.874152-8-clg@redhat.com> (raw)
In-Reply-To: <20251022121846.874152-1-clg@redhat.com>

From: Zhenzhong Duan <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>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20251009040134.334251-3-zhenzhong.duan@intel.com
Signed-off-by: Cédric Le Goater <clg@redhat.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 24a99efa87f4df268d0df7198f26bba37976874b..fc9cd9d22ff2d6f126d3c0964d7033eee33ed9f2 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.51.0



  parent reply	other threads:[~2025-10-22 12:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 12:18 [PULL 00/12] vfio queue Cédric Le Goater
2025-10-22 12:18 ` [PULL 01/12] vfio/container: Remap only populated parts in a section Cédric Le Goater
2025-10-22 12:18 ` [PULL 02/12] vfio/cpr-legacy: drop an erroneous assert Cédric Le Goater
2025-10-22 12:18 ` [PULL 03/12] vfio/iommufd: Set cpr.ioas_id on source side for CPR transfer Cédric Le Goater
2025-10-22 12:18 ` [PULL 04/12] vfio/iommufd: Restore vbasedev's reference to hwpt after " Cédric Le Goater
2025-10-22 12:18 ` [PULL 05/12] accel/kvm: Fix an erroneous check on coalesced_mmio_ring Cédric Le Goater
2025-10-22 12:18 ` [PULL 06/12] vfio/container: Support unmap all in one ioctl() Cédric Le Goater
2025-10-22 12:18 ` Cédric Le Goater [this message]
2025-10-22 12:18 ` [PULL 08/12] vfio/listener: Add an assertion for unmap_all Cédric Le Goater
2025-10-22 12:18 ` [PULL 09/12] docs/system/devices/vfio-user: fix formatting Cédric Le Goater
2025-10-22 12:18 ` [PULL 10/12] MAINTAINERS: Update Alex Williamson's email address Cédric Le Goater
2025-10-22 12:18 ` [PULL 11/12] vfio: rename field to "num_initial_regions" Cédric Le Goater
2025-10-22 12:18 ` [PULL 12/12] vfio: only check region info cache for initial regions Cédric Le Goater
2025-10-22 12:55 ` [PULL 00/12] vfio queue Cédric Le Goater
2025-10-23  9:53   ` Michael Tokarev
2025-10-23 12:16     ` Cédric Le Goater
2025-10-22 14:31 ` Richard Henderson

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=20251022121846.874152-8-clg@redhat.com \
    --to=clg@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhenzhong.duan@intel.com \
    /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).