Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230867/?format=api
{ "id": 2230867, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230867/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430071315.354333-2-zhenzhong.duan@intel.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/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": "<20260430071315.354333-2-zhenzhong.duan@intel.com>", "date": "2026-04-30T07:12:57", "name": "[v4,01/15] vfio/iommufd: Extend attach/detach_hwpt callback implementations with pasid", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5af500c3cc58df486bf8493e2fdfc122c1ad32e7", "submitter": { "id": 81636, "url": "http://patchwork.ozlabs.org/api/1.1/people/81636/?format=api", "name": "Duan, Zhenzhong", "email": "zhenzhong.duan@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430071315.354333-2-zhenzhong.duan@intel.com/mbox/", "series": [ { "id": 502222, "url": "http://patchwork.ozlabs.org/api/1.1/series/502222/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502222", "date": "2026-04-30T07:12:57", "name": "intel_iommu: Enable PASID support for passthrough device", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/502222/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230867/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230867/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=cLMqUzym;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.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 4g5lly0DZhz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 17:14:21 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wILap-00056p-Hm; Thu, 30 Apr 2026 03:13:54 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.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 1wILac-000569-I7\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 03:13:38 -0400", "from mgamail.intel.com ([192.198.163.13])\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 1wILaa-0008FJ-KP\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 03:13:38 -0400", "from orviesa007.jf.intel.com ([10.64.159.147])\n by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 30 Apr 2026 00:13:35 -0700", "from unknown (HELO gnr-sp-2s-612.sh.intel.com) ([10.112.230.229])\n by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 30 Apr 2026 00:13:32 -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=1777533216; x=1809069216;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=ZhTb5sAU181N0qyY+mwe86nNBLQNXm1BK91cdFXlg+k=;\n b=cLMqUzymsvj+4ByweR/hfcvJQZtRhJLQOBl/uN6Gv+RPY4QzB+d2qjde\n iGtH3T3G4P6SxLUJ4RLvNfHnLY9+d1vsUnKgbf4N58/Sr3KVd0345CqeM\n G0nN9bRM0onOt4O8ShAzDByujXd0Vwu5u5cGDu9cAwlEqH9kFUXYSrjMC\n CTYc4ph6cSiU0XAbj94SpAWRPrrWoB+4WSDxwde5gUaTfkbtlel5OkYpr\n CyA9VXrDtk6wtCy83I6fyKDXV83p/6+CLVAbNaJuu3veY08nF4yNDZY3R\n HMQ2fbSTCrulLokkmc/TAO8m/pL/a57Yo5jXV7z9PTLgyf9lVfxJfMNAO g==;", "X-CSE-ConnectionGUID": [ "G6FNcfwPRZ6yghhOaHdCCA==", "BCiz0AI5QCu+tflQ/3ffZQ==" ], "X-CSE-MsgGUID": [ "LAQpvfehRieQdNZjIyVzJA==", "ajjDNdfzRNe8cFxwceuWVg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11771\"; a=\"81051564\"", "E=Sophos;i=\"6.23,207,1770624000\"; d=\"scan'208\";a=\"81051564\"", "E=Sophos;i=\"6.23,207,1770624000\"; d=\"scan'208\";a=\"234771422\"" ], "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 v4 01/15] vfio/iommufd: Extend attach/detach_hwpt callback\n implementations with pasid", "Date": "Thu, 30 Apr 2026 03:12:57 -0400", "Message-ID": "<20260430071315.354333-2-zhenzhong.duan@intel.com>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260430071315.354333-1-zhenzhong.duan@intel.com>", "References": "<20260430071315.354333-1-zhenzhong.duan@intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=192.198.163.13;\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, 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>\nReviewed-by: Nicolin Chen <nicolinc@nvidia.com>\nReviewed-by: Cédric Le Goater <clg@redhat.com>\nTested-by: Xudong Hao <xudong.hao@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 cd59a367ce..77739d4214 100644\n--- a/include/hw/core/iommu.h\n+++ b/include/hw/core/iommu.h\n@@ -30,4 +30,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 df148a49a7..f86f6f0d7b 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@@ -363,7 +369,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@@ -442,7 +449,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@@ -495,7 +503,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@@ -503,7 +512,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@@ -929,7 +938,8 @@ host_iommu_device_iommufd_vfio_attach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,\n {\n VFIODevice *vbasedev = HOST_IOMMU_DEVICE(hiodi)->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@@ -938,7 +948,7 @@ host_iommu_device_iommufd_vfio_detach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,\n {\n VFIODevice *vbasedev = HOST_IOMMU_DEVICE(hiodi)->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": [ "v4", "01/15" ] }