get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.0/patches/2175431/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2175431,
    "url": "http://patchwork.ozlabs.org/api/1.0/patches/2175431/?format=api",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.0/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20251218062643.624796-7-zhenzhong.duan@intel.com>",
    "date": "2025-12-18T06:26:27",
    "name": "[v6,6/9] intel_iommu: Fix unmap_bitmap failure with legacy VFIO backend",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7cbde4e99c432b204b38a87d2840275019c97adf",
    "submitter": {
        "id": 81636,
        "url": "http://patchwork.ozlabs.org/api/1.0/people/81636/?format=api",
        "name": "Duan, Zhenzhong",
        "email": "zhenzhong.duan@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20251218062643.624796-7-zhenzhong.duan@intel.com/mbox/",
    "series": [
        {
            "id": 485789,
            "url": "http://patchwork.ozlabs.org/api/1.0/series/485789/?format=api",
            "date": "2025-12-18T06:26:21",
            "name": "vfio: relax the vIOMMU check",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/485789/mbox/"
        }
    ],
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2175431/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=PoFsqDnd;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dX12Q0yC9z1xty\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 17:28:30 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vW7UH-0003Nr-EJ; Thu, 18 Dec 2025 01:27:45 -0500",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zhenzhong.duan@intel.com>)\n id 1vW7UD-0003NN-RV\n for qemu-devel@nongnu.org; Thu, 18 Dec 2025 01:27:42 -0500",
            "from mgamail.intel.com ([198.175.65.18])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zhenzhong.duan@intel.com>)\n id 1vW7UC-000176-8f\n for qemu-devel@nongnu.org; Thu, 18 Dec 2025 01:27:41 -0500",
            "from orviesa005.jf.intel.com ([10.64.159.145])\n by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Dec 2025 22:27:39 -0800",
            "from unknown (HELO gnr-sp-2s-612.sh.intel.com) ([10.112.230.229])\n by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Dec 2025 22:27:36 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1766039260; x=1797575260;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=70TY9FcSVSzvfgLc9xmiUg5o1saVK6Fm05MtLWcPp/Q=;\n b=PoFsqDndw8Ori6XkU1V3MbT87TKuwTwjh0XcpkgMVK0onzesj7FoGSoj\n 7Wr0UaEtb6oTp4csW2ZH9UfVgrwW6VbmHRDhMGEXFRXvgtC4vsaYKGyrN\n b+Egy2V80WE5kegtbTNMF6DYa6Smb2eUs2c6X153X0837IkBAYvPLbKSX\n EWa/TEAH7HqF/ZaldX2BdMPn2TkDms/puWUDv6qBs7TiCYDZXJFtF3M5q\n 1RHFIo6RHNxuEAdqqTHoLIlUpcHk79AAppFjOBiA9jEsx3M8VgXnicE4j\n tzzxx0IaRYUj1AaLfWdm6tyksjo2J1jXbQ6FVj5XqhGZWiqcTl40A0SaW Q==;",
        "X-CSE-ConnectionGUID": [
            "ZvqHIlvvR/GZLcvNifWjBw==",
            "QvEc0k+dSvKhnQo4QYbF6Q=="
        ],
        "X-CSE-MsgGUID": [
            "JSCzp98gRzCEUnoQq2SjEA==",
            "eV6gh4XVT+mob4bcVoTHYg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6800,10657,11645\"; a=\"68028552\"",
            "E=Sophos;i=\"6.21,156,1763452800\"; d=\"scan'208\";a=\"68028552\"",
            "E=Sophos;i=\"6.21,156,1763452800\"; d=\"scan'208\";a=\"203569898\""
        ],
        "X-ExtLoop1": "1",
        "From": "Zhenzhong Duan <zhenzhong.duan@intel.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "alex@shazbot.org, clg@redhat.com, mst@redhat.com, jasowang@redhat.com,\n yi.l.liu@intel.com, clement.mathieu--drif@eviden.com,\n eric.auger@redhat.com, joao.m.martins@oracle.com, avihaih@nvidia.com,\n xudong.hao@intel.com, giovanni.cabiddu@intel.com, rohith.s.r@intel.com,\n mark.gross@intel.com, arjan.van.de.ven@intel.com,\n Zhenzhong Duan <zhenzhong.duan@intel.com>",
        "Subject": "[PATCH v6 6/9] intel_iommu: Fix unmap_bitmap failure with legacy VFIO\n backend",
        "Date": "Thu, 18 Dec 2025 01:26:27 -0500",
        "Message-ID": "<20251218062643.624796-7-zhenzhong.duan@intel.com>",
        "X-Mailer": "git-send-email 2.47.1",
        "In-Reply-To": "<20251218062643.624796-1-zhenzhong.duan@intel.com>",
        "References": "<20251218062643.624796-1-zhenzhong.duan@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=198.175.65.18;\n envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com",
        "X-Spam_score_int": "-43",
        "X-Spam_score": "-4.4",
        "X-Spam_bar": "----",
        "X-Spam_report": "(-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "If a VFIO device in guest switches from IOMMU domain to block domain,\nvtd_address_space_unmap() is called to unmap whole address space.\n\nIf that happens during migration, migration fails with legacy VFIO\nbackend as below:\n\nStatus: failed (vfio_container_dma_unmap(0x561bbbd92d90, 0x100000000000, 0x100000000000) = -7 (Argument list too long))\n\nBecause legacy VFIO limits maximum bitmap size to 256MB which maps to 8TB on\n4K page system, when 16TB sized UNMAP notification is sent, unmap_bitmap\nioctl fails. Normally such large UNMAP notification come from IOVA range\nrather than system memory.\n\nApart from that, vtd_address_space_unmap() sends UNMAP notification with\ntranslated_addr = 0, because there is no valid translated_addr for unmapping\na whole iommu memory region. This breaks dirty tracking no matter which VFIO\nbackend is used.\n\nFix them all by iterating over DMAMap list to unmap each range with active\nmapping when global_dirty_tracking is active. global_dirty_tracking is\nprotected by BQL, so it's safe to reference it directly. If it's not active,\nunmapping the whole address space in one go is optimal.\n\nSigned-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>\nReviewed-by: Yi Liu <yi.l.liu@intel.com>\nTested-by: Giovannio Cabiddu <giovanni.cabiddu@intel.com>\nTested-by: Rohith S R <rohith.s.r@intel.com>\n---\n hw/i386/intel_iommu.c | 42 ++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 42 insertions(+)",
    "diff": "diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c\nindex 7220a3d9f4..7c72fbaa52 100644\n--- a/hw/i386/intel_iommu.c\n+++ b/hw/i386/intel_iommu.c\n@@ -4764,6 +4764,43 @@ static uint64_t vtd_get_viommu_flags(void *opaque)\n     return flags;\n }\n \n+/*\n+ * There is no valid translated_addr for unmapping a whole iommu memory region.\n+ * When dirty tracking is enabled, we need it to set dirty bitmaps. Iterate\n+ * over DMAMap list to unmap each range with active mapping and translated_addr\n+ * value.\n+ */\n+static void vtd_address_space_unmap_in_dirty_tracking(VTDAddressSpace *as,\n+                                                      IOMMUNotifier *n)\n+{\n+    const DMAMap *map;\n+    const DMAMap target = {\n+        .iova = n->start,\n+        .size = n->end,\n+    };\n+    IOVATree *tree = as->iova_tree;\n+\n+    /*\n+     * DMAMap is created during IOMMU page table sync, it's either 4KB or huge\n+     * page size and always a power of 2 in size. So the range of DMAMap could\n+     * be used for UNMAP notification directly.\n+     */\n+    while ((map = iova_tree_find(tree, &target))) {\n+        IOMMUTLBEvent event;\n+\n+        event.type = IOMMU_NOTIFIER_UNMAP;\n+        event.entry.iova = map->iova;\n+        event.entry.addr_mask = map->size;\n+        event.entry.target_as = &address_space_memory;\n+        event.entry.perm = IOMMU_NONE;\n+        /* This field is needed to set dirty bigmap */\n+        event.entry.translated_addr = map->translated_addr;\n+        memory_region_notify_iommu_one(n, &event);\n+\n+        iova_tree_remove(tree, *map);\n+    }\n+}\n+\n /* Unmap the whole range in the notifier's scope. */\n static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)\n {\n@@ -4773,6 +4810,11 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)\n     IntelIOMMUState *s = as->iommu_state;\n     DMAMap map;\n \n+    if (global_dirty_tracking) {\n+        vtd_address_space_unmap_in_dirty_tracking(as, n);\n+        return;\n+    }\n+\n     /*\n      * Note: all the codes in this function has a assumption that IOVA\n      * bits are no more than VTD_MGAW bits (which is restricted by\n",
    "prefixes": [
        "v6",
        "6/9"
    ]
}