Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216269/?format=api
{ "id": 2216269, "url": "http://patchwork.ozlabs.org/api/patches/2216269/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260326091130.321483-2-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": "<20260326091130.321483-2-zhenzhong.duan@intel.com>", "list_archive_url": null, "date": "2026-03-26T09:11:15", "name": "[v2,01/14] vfio/iommufd: Extend attach/detach_hwpt callback implementations with pasid", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "919c34236efc8f4dc998346d1e52798a8be3d151", "submitter": { "id": 81636, "url": "http://patchwork.ozlabs.org/api/people/81636/?format=api", "name": "Duan, Zhenzhong", "email": "zhenzhong.duan@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260326091130.321483-2-zhenzhong.duan@intel.com/mbox/", "series": [ { "id": 497556, "url": "http://patchwork.ozlabs.org/api/series/497556/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497556", "date": "2026-03-26T09:11:19", "name": "intel_iommu: Enable PASID support for passthrough device", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/497556/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216269/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216269/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=ByNfgY9g;\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 4fhJ2W2qTnz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 20:12:35 +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 1w5gkr-0002jY-PH; Thu, 26 Mar 2026 05:11:53 -0400", "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 1w5gkq-0002jO-Qt\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 05:11:52 -0400", "from mgamail.intel.com ([198.175.65.17])\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 1w5gko-0003ur-PH\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 05:11:52 -0400", "from fmviesa001.fm.intel.com ([10.60.135.141])\n by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Mar 2026 02:11:49 -0700", "from unknown (HELO gnr-sp-2s-612.sh.intel.com) ([10.112.230.229])\n by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Mar 2026 02:11:45 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1774516311; x=1806052311;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=/hc9OpwiIUiMzB1g2M8wqBhHlazPnVcuYIimrOV7Ios=;\n b=ByNfgY9g2HYiJptdG5iYwHEdTTK9Hcg8CsGgi/tgppwzthHafeQhD9fU\n PJ0PbS16XGZPRdaJmpL6SasVE+ag7kLS/f5yjhnSLWW8dfEQoXIT7mlTt\n gzQdOhZS1xw7MQT/je4UOeD8lNYbn2er8tKnXBU2E+Q/xyZwujDWlYDOf\n kvNDehOg7ziUtUMSJB8+qTQOxvLxP9pNOkoexOHQKlOBzgXnaEVQaQM/M\n 7yCw7FTOXP8wAYKBNZl7PY8whHvcpCOEA+1N4fgEnK2IHVbAc0kzL/bF7\n U3aT0GVyYkPMfHDoXeMz46kSVNsXT9MbiwPC6ojxeZyC4yd0B8ywLzzNf Q==;", "X-CSE-ConnectionGUID": [ "+mLZMOL3RcSQ8r6LEIcK/g==", "LqTuVnOURP+CODT0IYPS+g==" ], "X-CSE-MsgGUID": [ "3uuKz0UqSSKJaBYmziMtrw==", "m75a2V5xSUW8DGFue+aCsA==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11740\"; a=\"75531307\"", "E=Sophos;i=\"6.23,141,1770624000\"; d=\"scan'208\";a=\"75531307\"", "E=Sophos;i=\"6.23,141,1770624000\"; d=\"scan'208\";a=\"248368552\"" ], "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@bull.com, kevin.tian@intel.com, yi.l.liu@intel.com,\n xudong.hao@intel.com, Zhenzhong Duan <zhenzhong.duan@intel.com>", "Subject": "[PATCH v2 01/14] vfio/iommufd: Extend attach/detach_hwpt callback\n implementations with pasid", "Date": "Thu, 26 Mar 2026 05:11:15 -0400", "Message-ID": "<20260326091130.321483-2-zhenzhong.duan@intel.com>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260326091130.321483-1-zhenzhong.duan@intel.com>", "References": "<20260326091130.321483-1-zhenzhong.duan@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=198.175.65.17;\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": "For attachment with pasid, pasid together with flag VFIO_DEVICE_ATTACH_PASID\nshould be passed in.\n\nDefine IOMMU_NO_PASID to represent device attachment without pasid same as\nin kernel.\n\nThe implementation is similar for detachment.\n\nSuggested-by: Shameer Kolothum Thodi <skolothumtho@nvidia.com>\nSuggested-by: Nicolin Chen <nicolinc@nvidia.com>\nSigned-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>\nReviewed-by: Yi Liu <yi.l.liu@intel.com>\n---\n include/hw/core/iommu.h | 2 ++\n hw/vfio/iommufd.c | 44 +++++++++++++++++++++++++----------------\n hw/vfio/trace-events | 4 ++--\n 3 files changed, 31 insertions(+), 19 deletions(-)", "diff": "diff --git a/include/hw/core/iommu.h b/include/hw/core/iommu.h\nindex 86af315c15..bfcd511013 100644\n--- a/include/hw/core/iommu.h\n+++ b/include/hw/core/iommu.h\n@@ -28,4 +28,6 @@ enum host_iommu_quirks {\n HOST_IOMMU_QUIRK_NESTING_PARENT_BYPASS_RO = BIT_ULL(0),\n };\n \n+#define IOMMU_NO_PASID 0\n+\n #endif /* HW_IOMMU_H */\ndiff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c\nindex 3e33dfbb35..93f1e61a8c 100644\n--- a/hw/vfio/iommufd.c\n+++ b/hw/vfio/iommufd.c\n@@ -20,6 +20,7 @@\n #include \"trace.h\"\n #include \"qapi/error.h\"\n #include \"system/iommufd.h\"\n+#include \"hw/core/iommu.h\"\n #include \"hw/core/qdev.h\"\n #include \"hw/vfio/vfio-cpr.h\"\n #include \"system/reset.h\"\n@@ -305,43 +306,48 @@ out:\n return ret;\n }\n \n-static int iommufd_cdev_attach_ioas_hwpt(VFIODevice *vbasedev, uint32_t id,\n- Error **errp)\n+static int iommufd_cdev_pasid_attach_ioas_hwpt(VFIODevice *vbasedev,\n+ uint32_t pasid, uint32_t id,\n+ Error **errp)\n {\n int iommufd = vbasedev->iommufd->fd;\n struct vfio_device_attach_iommufd_pt attach_data = {\n .argsz = sizeof(attach_data),\n- .flags = 0,\n+ .flags = pasid == IOMMU_NO_PASID ? 0 : VFIO_DEVICE_ATTACH_PASID,\n+ .pasid = pasid,\n .pt_id = id,\n };\n \n /* Attach device to an IOAS or hwpt within iommufd */\n if (ioctl(vbasedev->fd, VFIO_DEVICE_ATTACH_IOMMUFD_PT, &attach_data)) {\n error_setg_errno(errp, errno,\n- \"[iommufd=%d] error attach %s (%d) to id=%d\",\n- iommufd, vbasedev->name, vbasedev->fd, id);\n+ \"[iommufd=%d] error attach %s (%d) pasid %d to id=%d\",\n+ iommufd, vbasedev->name, vbasedev->fd, pasid, id);\n return -errno;\n }\n \n- trace_iommufd_cdev_attach_ioas_hwpt(iommufd, vbasedev->name,\n- vbasedev->fd, id);\n+ trace_iommufd_cdev_pasid_attach_ioas_hwpt(iommufd, vbasedev->name,\n+ vbasedev->fd, pasid, id);\n return 0;\n }\n \n-static bool iommufd_cdev_detach_ioas_hwpt(VFIODevice *vbasedev, Error **errp)\n+static bool iommufd_cdev_pasid_detach_ioas_hwpt(VFIODevice *vbasedev,\n+ uint32_t pasid, Error **errp)\n {\n int iommufd = vbasedev->iommufd->fd;\n struct vfio_device_detach_iommufd_pt detach_data = {\n .argsz = sizeof(detach_data),\n- .flags = 0,\n+ .flags = pasid == IOMMU_NO_PASID ? 0 : VFIO_DEVICE_DETACH_PASID,\n+ .pasid = pasid,\n };\n \n if (ioctl(vbasedev->fd, VFIO_DEVICE_DETACH_IOMMUFD_PT, &detach_data)) {\n- error_setg_errno(errp, errno, \"detach %s failed\", vbasedev->name);\n+ error_setg_errno(errp, errno, \"detach %s pasid %d failed\",\n+ vbasedev->name, pasid);\n return false;\n }\n \n- trace_iommufd_cdev_detach_ioas_hwpt(iommufd, vbasedev->name);\n+ trace_iommufd_cdev_pasid_detach_ioas_hwpt(iommufd, vbasedev->name, pasid);\n return true;\n }\n \n@@ -362,7 +368,8 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,\n /* Try to find a domain */\n QLIST_FOREACH(hwpt, &container->hwpt_list, next) {\n if (!cpr_is_incoming()) {\n- ret = iommufd_cdev_attach_ioas_hwpt(vbasedev, hwpt->hwpt_id, errp);\n+ ret = iommufd_cdev_pasid_attach_ioas_hwpt(vbasedev, IOMMU_NO_PASID,\n+ hwpt->hwpt_id, errp);\n } else if (vbasedev->cpr.hwpt_id == hwpt->hwpt_id) {\n ret = 0;\n } else {\n@@ -435,7 +442,8 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,\n return false;\n }\n \n- ret = iommufd_cdev_attach_ioas_hwpt(vbasedev, hwpt_id, errp);\n+ ret = iommufd_cdev_pasid_attach_ioas_hwpt(vbasedev, IOMMU_NO_PASID, hwpt_id,\n+ errp);\n if (ret) {\n iommufd_backend_free_id(container->be, hwpt_id);\n return false;\n@@ -488,7 +496,8 @@ static bool iommufd_cdev_attach_container(VFIODevice *vbasedev,\n \n /* If CPR, we are already attached to ioas_id. */\n return cpr_is_incoming() ||\n- !iommufd_cdev_attach_ioas_hwpt(vbasedev, container->ioas_id, errp);\n+ !iommufd_cdev_pasid_attach_ioas_hwpt(vbasedev, IOMMU_NO_PASID,\n+ container->ioas_id, errp);\n }\n \n static void iommufd_cdev_detach_container(VFIODevice *vbasedev,\n@@ -496,7 +505,7 @@ static void iommufd_cdev_detach_container(VFIODevice *vbasedev,\n {\n Error *err = NULL;\n \n- if (!iommufd_cdev_detach_ioas_hwpt(vbasedev, &err)) {\n+ if (!iommufd_cdev_pasid_detach_ioas_hwpt(vbasedev, IOMMU_NO_PASID, &err)) {\n error_report_err(err);\n }\n \n@@ -922,7 +931,8 @@ host_iommu_device_iommufd_vfio_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,\n {\n VFIODevice *vbasedev = HOST_IOMMU_DEVICE(idev)->agent;\n \n- return !iommufd_cdev_attach_ioas_hwpt(vbasedev, hwpt_id, errp);\n+ return !iommufd_cdev_pasid_attach_ioas_hwpt(vbasedev, IOMMU_NO_PASID,\n+ hwpt_id, errp);\n }\n \n static bool\n@@ -931,7 +941,7 @@ host_iommu_device_iommufd_vfio_detach_hwpt(HostIOMMUDeviceIOMMUFD *idev,\n {\n VFIODevice *vbasedev = HOST_IOMMU_DEVICE(idev)->agent;\n \n- return iommufd_cdev_detach_ioas_hwpt(vbasedev, errp);\n+ return iommufd_cdev_pasid_detach_ioas_hwpt(vbasedev, IOMMU_NO_PASID, errp);\n }\n \n static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,\ndiff --git a/hw/vfio/trace-events b/hw/vfio/trace-events\nindex 846e3625c5..764a3e4855 100644\n--- a/hw/vfio/trace-events\n+++ b/hw/vfio/trace-events\n@@ -182,8 +182,8 @@ vfio_vmstate_change_prepare(const char *name, int running, const char *reason, c\n \n iommufd_cdev_connect_and_bind(int iommufd, const char *name, int devfd, int devid) \" [iommufd=%d] Successfully bound device %s (fd=%d): output devid=%d\"\n iommufd_cdev_getfd(const char *dev, int devfd) \" %s (fd=%d)\"\n-iommufd_cdev_attach_ioas_hwpt(int iommufd, const char *name, int devfd, int id) \" [iommufd=%d] Successfully attached device %s (%d) to id=%d\"\n-iommufd_cdev_detach_ioas_hwpt(int iommufd, const char *name) \" [iommufd=%d] Successfully detached %s\"\n+iommufd_cdev_pasid_attach_ioas_hwpt(int iommufd, const char *name, int devfd, uint32_t pasid, int id) \" [iommufd=%d] Successfully attached device %s (%d) pasid %d to id=%d\"\n+iommufd_cdev_pasid_detach_ioas_hwpt(int iommufd, const char *name, uint32_t pasid) \" [iommufd=%d] Successfully detached %s pasid %d\"\n iommufd_cdev_fail_attach_existing_container(const char *msg) \" %s\"\n iommufd_cdev_alloc_ioas(int iommufd, int ioas_id) \" [iommufd=%d] new IOMMUFD container with ioasid=%d\"\n iommufd_cdev_device_info(char *name, int devfd, int num_irqs, int num_regions, int flags) \" %s (%d) num_irqs=%d num_regions=%d flags=%d\"\n", "prefixes": [ "v2", "01/14" ] }