get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2196476,
    "url": "http://patchwork.ozlabs.org/api/patches/2196476/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260214034135.220413-9-zhenzhong.duan@intel.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/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": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260214034135.220413-9-zhenzhong.duan@intel.com>",
    "list_archive_url": null,
    "date": "2026-02-14T03:41:28",
    "name": "[RFCv2,08/13] intel_iommu: Handle PASID entry removal for pc_inv_dsc request",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "0c39b6233fb29887bc6f285ecb83c4453ad4cc5d",
    "submitter": {
        "id": 81636,
        "url": "http://patchwork.ozlabs.org/api/people/81636/?format=api",
        "name": "Zhenzhong Duan",
        "email": "zhenzhong.duan@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260214034135.220413-9-zhenzhong.duan@intel.com/mbox/",
    "series": [
        {
            "id": 492156,
            "url": "http://patchwork.ozlabs.org/api/series/492156/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492156",
            "date": "2026-02-14T03:41:20",
            "name": "intel_iommu: Enable PASID support for passthrough device",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/492156/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2196476/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2196476/checks/",
    "tags": {},
    "related": [],
    "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=jdQActmP;\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 4fCZcw3Pzdz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 14:43:12 +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 1vr6Y3-0005CB-2B; Fri, 13 Feb 2026 22:42:23 -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 1vr6Y0-0005Bn-VV\n for qemu-devel@nongnu.org; Fri, 13 Feb 2026 22:42:20 -0500",
            "from mgamail.intel.com ([198.175.65.12])\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 1vr6Xy-0008J1-Fp\n for qemu-devel@nongnu.org; Fri, 13 Feb 2026 22:42:20 -0500",
            "from orviesa009.jf.intel.com ([10.64.159.149])\n by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Feb 2026 19:42:18 -0800",
            "from unknown (HELO gnr-sp-2s-612.sh.intel.com) ([10.112.230.229])\n by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Feb 2026 19:42:14 -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=1771040538; x=1802576538;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=PKdn5LzomzWI5ewjG4Qibnqt/n1gU9PWe89FsmPl/so=;\n b=jdQActmP1twxHNKSEP24pm3lo/UgsIbJPrmLvrxAQMM2FvONN7aTWd1+\n 12UhV9dtnK1PP9TDRr1H8i0m2BPq+8nqqDCScFX2Lrb/21E8ELOVyBREh\n rHOYOpvUOVh4rM3/dEw/HMMsQFl3xHV/U+N/YluK2UnJ0K+0ZV93hRbsZ\n P0L+5A1j1YcVp23fLDveBBWUjUfSUBJ2jOG3R0S5/7kcAuJq+Tn5z/zOu\n apVx7BfHAEHdWvQ8NyQaH2IrGGPKbP2Yf74MeoHbyDLolXSHnynOiCYR2\n Xjd32XQmGRcWsFitJQ0rLxLvPekmPGvvnkvec4pLvnVUpP/5tb1d3Kpnw w==;",
        "X-CSE-ConnectionGUID": [
            "j/M9rqY9Qu+WylUlfzxVBw==",
            "5PpxZZbVTZGGl63NKaPSqQ=="
        ],
        "X-CSE-MsgGUID": [
            "OxkGp+dkQtGAAalXANd1OA==",
            "fpK3rWh0QVKdatcXyP5UHA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6800,10657,11700\"; a=\"83666851\"",
            "E=Sophos;i=\"6.21,289,1763452800\"; d=\"scan'208\";a=\"83666851\"",
            "E=Sophos;i=\"6.21,289,1763452800\"; d=\"scan'208\";a=\"212933098\""
        ],
        "X-ExtLoop1": "1",
        "From": "Zhenzhong Duan <zhenzhong.duan@intel.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "alex@shazbot.org, clg@redhat.com, eric.auger@redhat.com, mst@redhat.com,\n jasowang@redhat.com, jgg@nvidia.com, nicolinc@nvidia.com,\n skolothumtho@nvidia.com, joao.m.martins@oracle.com,\n clement.mathieu--drif@eviden.com, kevin.tian@intel.com, yi.l.liu@intel.com,\n xudong.hao@intel.com, Zhenzhong Duan <zhenzhong.duan@intel.com>",
        "Subject": "[RFCv2 PATCH 08/13] intel_iommu: Handle PASID entry removal for\n pc_inv_dsc request",
        "Date": "Fri, 13 Feb 2026 22:41:28 -0500",
        "Message-ID": "<20260214034135.220413-9-zhenzhong.duan@intel.com>",
        "X-Mailer": "git-send-email 2.47.3",
        "In-Reply-To": "<20260214034135.220413-1-zhenzhong.duan@intel.com>",
        "References": "<20260214034135.220413-1-zhenzhong.duan@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=198.175.65.12;\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 development <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": "When guest deletes PASID entries, QEMU will capture the pasid cache\ninvalidation request, walk through pasid_cache_list in each passthrough\ndevice to find stale VTDACCELPASIDCacheEntry and delete them.\n\nThis happen before the PASID entry addition, because a new added entry\nshould never be removed.\n\nSigned-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>\n---\n hw/i386/intel_iommu_accel.c | 70 +++++++++++++++++++++++++++++++++++++\n 1 file changed, 70 insertions(+)",
    "diff": "diff --git a/hw/i386/intel_iommu_accel.c b/hw/i386/intel_iommu_accel.c\nindex 0acf3ae77f..5a956af916 100644\n--- a/hw/i386/intel_iommu_accel.c\n+++ b/hw/i386/intel_iommu_accel.c\n@@ -16,6 +16,28 @@\n #include \"hw/pci/pci_bus.h\"\n #include \"trace.h\"\n \n+static inline int vtd_hiod_get_pe_from_pasid(VTDACCELPASIDCacheEntry *vtd_pce,\n+                                             VTDPASIDEntry *pe)\n+{\n+    VTDHostIOMMUDevice *vtd_hiod = vtd_pce->vtd_hiod;\n+    IntelIOMMUState *s = vtd_hiod->iommu_state;\n+    uint32_t pasid = vtd_pce->pasid;\n+    VTDContextEntry ce;\n+    int ret;\n+\n+    if (!s->dmar_enabled || !s->root_scalable) {\n+        return -VTD_FR_RTADDR_INV_TTM;\n+    }\n+\n+    ret = vtd_dev_to_context_entry(s, pci_bus_num(vtd_hiod->bus),\n+                                   vtd_hiod->devfn, &ce);\n+    if (ret) {\n+        return ret;\n+    }\n+\n+    return vtd_ce_get_pasid_entry(s, &ce, pe, pasid);\n+}\n+\n bool vtd_check_hiod_accel(IntelIOMMUState *s, VTDHostIOMMUDevice *vtd_hiod,\n                           Error **errp)\n {\n@@ -257,6 +279,52 @@ void vtd_flush_host_piotlb_all_locked(IntelIOMMUState *s, uint16_t domain_id,\n                          vtd_flush_host_piotlb_locked, &piotlb_info);\n }\n \n+static void vtd_pasid_cache_invalidate_one(VTDACCELPASIDCacheEntry *vtd_pce,\n+                                           VTDPASIDCacheInfo *pc_info)\n+{\n+    VTDPASIDEntry pe;\n+    uint16_t did;\n+\n+    /*\n+     * VTD_INV_DESC_PASIDC_G_DSI and VTD_INV_DESC_PASIDC_G_PASID_SI require\n+     * DID check. If DID doesn't match the value in cache or memory, then\n+     * it's not a pasid entry we want to invalidate.\n+     */\n+    switch (pc_info->type) {\n+    case VTD_INV_DESC_PASIDC_G_PASID_SI:\n+        if (pc_info->pasid != vtd_pce->pasid) {\n+            return;\n+        }\n+        /* Fall through */\n+    case VTD_INV_DESC_PASIDC_G_DSI:\n+        did = VTD_SM_PASID_ENTRY_DID(&vtd_pce->pe);\n+        if (pc_info->did != did) {\n+            return;\n+        }\n+    }\n+\n+    if (vtd_hiod_get_pe_from_pasid(vtd_pce, &pe)) {\n+        /*\n+         * No valid pasid entry in guest memory. e.g. pasid entry was modified\n+         * to be either all-zero or non-present. Either case means existing\n+         * pasid cache should be invalidated.\n+         */\n+        QLIST_REMOVE(vtd_pce, next);\n+        g_free(vtd_pce);\n+    }\n+}\n+\n+/* Delete invalid pasid cache entry from pasid_cache_list */\n+static void vtd_pasid_cache_invalidate(VTDHostIOMMUDevice *vtd_hiod,\n+                                       VTDPASIDCacheInfo *pc_info)\n+{\n+    VTDACCELPASIDCacheEntry *vtd_pce, *next;\n+\n+    QLIST_FOREACH_SAFE(vtd_pce, &vtd_hiod->pasid_cache_list, next, next) {\n+        vtd_pasid_cache_invalidate_one(vtd_pce, pc_info);\n+    }\n+}\n+\n static void vtd_find_add_pc(VTDHostIOMMUDevice *vtd_hiod, uint32_t pasid,\n                             VTDPASIDEntry *pe)\n {\n@@ -423,6 +491,8 @@ void vtd_pasid_cache_sync_accel(IntelIOMMUState *s, VTDPASIDCacheInfo *pc_info)\n                                  TYPE_HOST_IOMMU_DEVICE_IOMMUFD)) {\n             continue;\n         }\n+\n+        vtd_pasid_cache_invalidate(vtd_hiod, pc_info);\n         vtd_replay_pasid_bind_for_dev(vtd_hiod, start, end, pc_info);\n     }\n }\n",
    "prefixes": [
        "RFCv2",
        "08/13"
    ]
}