Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2215641/?format=api
{ "id": 2215641, "url": "http://patchwork.ozlabs.org/api/patches/2215641/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260324234615.3731237-2-zhipingz@meta.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260324234615.3731237-2-zhipingz@meta.com>", "list_archive_url": null, "date": "2026-03-24T23:46:02", "name": "[RFC,v2,1/2] vfio: add callback to get tph info for dmabuf", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "acb0b289940b07162195c390cea4cc207de33aeb", "submitter": { "id": 92088, "url": "http://patchwork.ozlabs.org/api/people/92088/?format=api", "name": "Zhiping Zhang", "email": "zhipingz@meta.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260324234615.3731237-2-zhipingz@meta.com/mbox/", "series": [ { "id": 497360, "url": "http://patchwork.ozlabs.org/api/series/497360/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=497360", "date": "2026-03-24T23:46:02", "name": "Retrieve tph from dmabuf for PCIe P2P memory access", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/497360/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2215641/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2215641/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-50996-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=meta.com header.i=@meta.com header.a=rsa-sha256\n header.s=s2048-2025-q2 header.b=UeOYGNcg;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-50996-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com\n header.b=\"UeOYGNcg\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=67.231.153.30", "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=meta.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=meta.com" ], "Received": [ "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgRf040xNz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 10:51:52 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 016573015ECD\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 24 Mar 2026 23:51:51 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E3A7729D28F;\n\tTue, 24 Mar 2026 23:51:49 +0000 (UTC)", "from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com\n [67.231.153.30])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 42C72237713\n\tfor <linux-pci@vger.kernel.org>; Tue, 24 Mar 2026 23:51:47 +0000 (UTC)", "from pps.filterd (m0001303.ppops.net [127.0.0.1])\n\tby m0001303.ppops.net (8.18.1.11/8.18.1.11) with ESMTP id 62OMH8fd2096836\n\tfor <linux-pci@vger.kernel.org>; Tue, 24 Mar 2026 16:51:47 -0700", "from maileast.thefacebook.com ([163.114.135.16])\n\tby m0001303.ppops.net (PPS) with ESMTPS id 4d4397gucf-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)\n\tfor <linux-pci@vger.kernel.org>; Tue, 24 Mar 2026 16:51:46 -0700 (PDT)", "from twshared25002.15.frc2.facebook.com (2620:10d:c0a8:1b::30) by\n mail.thefacebook.com (2620:10d:c0a9:6f::8fd4) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.2.2562.35; Tue, 24 Mar 2026 23:51:46 +0000", "by devbig259.ftw1.facebook.com (Postfix, from userid 664516)\n\tid 8DA221D7CF55; Tue, 24 Mar 2026 16:46:26 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774396309; cv=none;\n b=ommcDnzqyhmPzNjNV/fQpQMCmIXVm3wyXzMg+IeOLxu64En6hTHIfCpWnqNvGTCGjpidmDmHzhxjqld4VqVviN+nX8E0Z3wwCaYpnpzOt/TPjnIYaAiX9InLycQ2eQSCpq063COC1U0iO/naZbz4AwVfyuQhMqpowVrbypxDL3w=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774396309; c=relaxed/simple;\n\tbh=uwHcFpcEFvAMgOCDAacpOu2ncyNjXE7KawDeNG96/EQ=;\n\th=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=eQijUJo78CmJVk/cZccfRTXSRhKyF7HNdJMo42VTJ563WzyVfWHTfdW3SLPOJY3h7LV3BFKKw4kzElRaFd3VS1Ky1kXSgh11nKTMSfm+njI2ubRSqTAFo2Mv/YB/cGJGZq12fDY//RQtHEUbtcQXNWjh+pT0C3Of5qnm2PQU0XE=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=meta.com;\n spf=pass smtp.mailfrom=meta.com;\n dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com\n header.b=UeOYGNcg; arc=none smtp.client-ip=67.231.153.30", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=cc\n\t:content-transfer-encoding:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to; s=s2048-2025-q2;\n\t bh=B4WuddQzak0iMs+x+SFLQE/xEKY5OBiF+Wu5h4lGL3o=; b=UeOYGNcgp3H5\n\tTduUlpqGXTYgT2Q9D/GPNOXzh9XnVHI8ldO3rbkDsSieTaencdeWe3FEzmmQFLo9\n\tyQUVfQDqtlZHleg/lJFvwS2mA5wl0gAPpIwLFuR+PXtoxXqWT8gYFJKu+mf2Xy4Q\n\tg2zpRB1AbAWFsikg1g4GJklKIsw0oMdms3A/+QgYl7GUTOSaqa6WHAe17JesKs9e\n\tdzuZH8e8Il6fRFaEvXK231nTHShFGD/ba5KWCF36ReRxufwl8FC+zo9ke9KPpNZu\n\tkqWAZ8s0mYg7rb3+pNOB8XsqnZIDtjwfzLge2BusvK0lgDmunLf4Pl1NrgxYf380\n\tL1CwELs+Vg==", "From": "Zhiping Zhang <zhipingz@meta.com>", "To": "Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,\n Bjorn\n Helgaas <bhelgaas@google.com>, <linux-rdma@vger.kernel.org>,\n <linux-pci@vger.kernel.org>, <netdev@vger.kernel.org>,\n <dri-devel@lists.freedesktop.org>, Keith Busch <kbusch@kernel.org>,\n Yochai\n Cohen <yochai@nvidia.com>, Yishai Hadas <yishaih@nvidia.com>", "CC": "Bjorn Helgaas <helgaas@kernel.org>, Zhiping Zhang <zhipingz@meta.com>", "Subject": "[RFC v2 1/2] vfio: add callback to get tph info for dmabuf", "Date": "Tue, 24 Mar 2026 16:46:02 -0700", "Message-ID": "<20260324234615.3731237-2-zhipingz@meta.com>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260324234615.3731237-1-zhipingz@meta.com>", "References": "<20260324234615.3731237-1-zhipingz@meta.com>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "quoted-printable", "X-FB-Internal": "Safe", "Content-Type": "text/plain", "X-Authority-Analysis": "v=2.4 cv=Na7rFmD4 c=1 sm=1 tr=0 ts=69c32393 cx=c_pps\n a=MfjaFnPeirRr97d5FC5oHw==:117 a=MfjaFnPeirRr97d5FC5oHw==:17\n a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=7x6HtfJdh03M6CCDgxCd:22\n a=_78whYxrdx1mplLwxq1U:22 a=VabnemYjAAAA:8 a=9vb4j_dHmgPK81v2NVsA:9\n a=gKebqoRLp9LExxC7YDUY:22", "X-Proofpoint-GUID": "J_3985V3C1lBqXpOAtYMTrc27aki48zq", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMzI0MDE4NCBTYWx0ZWRfX3KtZghW06qyu\n iOn5BUn/HZIUI3JpmyNDhA6UePrX7CHNva0DN7grAJYT1VQGIGo6rn335gz3vpugs6n2n2FIUVQ\n WYbecxtl4IVjF3N3ek4LTCncAcmUfTti96T3GY3UfSj+dki/mX4n4a8k9Q9Y/XckZoH5tGiQlRh\n yCixNdvYhm5pXRlYZ78Uq0IHoCPYutVyFcL12YcEzo+oZWqN30DZpxL1HNWJdWT3B4wfX7iazfz\n Os6U84WoMFwOJaNldCyDhpMBtUdwMd+TCj/fVFooLM+ar3B4URAPqK3pjFbHZbq5WczaqLumafp\n F78+ayqjBZQx4icx/H+5R/ZMxhyQMFg4WubERSXQ1xdzlbrWNBjkHfm67PH5aJU/O9ABJNMCBVD\n wx9v1GsbhJNOicg0J55zEGGv6TtnIOp4BNyxV+zERu+IN0vb1Hsfn46Vi0GyqRtUd+BXh0JyiVd\n Vhc4vfat7Z4eqrk10uQ==", "X-Proofpoint-ORIG-GUID": "J_3985V3C1lBqXpOAtYMTrc27aki48zq", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-03-24_04,2026-03-24_01,2025-10-01_01" }, "content": "This patch adds a callback to get the tph info on DMA buffer exporters.\nThe tph info includes both the steering tag and the process hint (ph).\n\nThe steering tag and ph are encoded in the flags field of\nvfio_device_feature_dma_buf instead of adding new fields to the uapi\nstruct, to preserve ABI compatibility.\n\nSigned-off-by: Zhiping Zhang <zhipingz@meta.com>\n---\n drivers/vfio/pci/vfio_pci_dmabuf.c | 26 ++++++++++++++++++++++++--\n include/linux/dma-buf.h | 30 ++++++++++++++++++++++++++++++\n include/uapi/linux/vfio.h | 9 +++++++--\n 3 files changed, 61 insertions(+), 4 deletions(-)\n\n--\n2.52.0", "diff": "diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c\nindex 478beafc6ac3..c45cb3884b85 100644\n--- a/drivers/vfio/pci/vfio_pci_dmabuf.c\n+++ b/drivers/vfio/pci/vfio_pci_dmabuf.c\n@@ -17,6 +17,8 @@ struct vfio_pci_dma_buf {\n \tstruct phys_vec *phys_vec;\n \tstruct p2pdma_provider *provider;\n \tu32 nr_ranges;\n+\tu16 steering_tag;\n+\tu8 ph;\n \tu8 revoked : 1;\n };\n\n@@ -60,6 +62,15 @@ vfio_pci_dma_buf_map(struct dma_buf_attachment *attachment,\n \t\t\t\t priv->size, dir);\n }\n\n+static int vfio_pci_dma_buf_get_tph(struct dma_buf *dmabuf, u16 *steering_tag,\n+\t\t\t\t u8 *ph)\n+{\n+\tstruct vfio_pci_dma_buf *priv = dmabuf->priv;\n+\t*steering_tag = priv->steering_tag;\n+\t*ph = priv->ph;\n+\treturn 0;\n+}\n+\n static void vfio_pci_dma_buf_unmap(struct dma_buf_attachment *attachment,\n \t\t\t\t struct sg_table *sgt,\n \t\t\t\t enum dma_data_direction dir)\n@@ -90,6 +101,7 @@ static const struct dma_buf_ops vfio_pci_dmabuf_ops = {\n \t.unpin = vfio_pci_dma_buf_unpin,\n \t.attach = vfio_pci_dma_buf_attach,\n \t.map_dma_buf = vfio_pci_dma_buf_map,\n+\t.get_tph = vfio_pci_dma_buf_get_tph,\n \t.unmap_dma_buf = vfio_pci_dma_buf_unmap,\n \t.release = vfio_pci_dma_buf_release,\n };\n@@ -228,7 +240,10 @@ int vfio_pci_core_feature_dma_buf(struct vfio_pci_core_device *vdev, u32 flags,\n \tif (copy_from_user(&get_dma_buf, arg, sizeof(get_dma_buf)))\n \t\treturn -EFAULT;\n\n-\tif (!get_dma_buf.nr_ranges || get_dma_buf.flags)\n+\tif (!get_dma_buf.nr_ranges ||\n+\t (get_dma_buf.flags & ~(VFIO_DMABUF_FL_TPH |\n+\t\t\t\t VFIO_DMABUF_TPH_PH_MASK |\n+\t\t\t\t VFIO_DMABUF_TPH_ST_MASK)))\n \t\treturn -EINVAL;\n\n \t/*\n@@ -285,7 +300,14 @@ int vfio_pci_core_feature_dma_buf(struct vfio_pci_core_device *vdev, u32 flags,\n \t\tret = PTR_ERR(priv->dmabuf);\n \t\tgoto err_dev_put;\n \t}\n-\n+\tif (get_dma_buf.flags & VFIO_DMABUF_FL_TPH) {\n+\t\tpriv->steering_tag = (get_dma_buf.flags &\n+\t\t\t\t VFIO_DMABUF_TPH_ST_MASK) >>\n+\t\t\t\t VFIO_DMABUF_TPH_ST_SHIFT;\n+\t\tpriv->ph = (get_dma_buf.flags &\n+\t\t\t VFIO_DMABUF_TPH_PH_MASK) >>\n+\t\t\t VFIO_DMABUF_TPH_PH_SHIFT;\n+\t}\n \t/* dma_buf_put() now frees priv */\n \tINIT_LIST_HEAD(&priv->dmabufs_elm);\n \tdown_write(&vdev->memory_lock);\ndiff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h\nindex 133b9e637b55..26705c83ad80 100644\n--- a/include/linux/dma-buf.h\n+++ b/include/linux/dma-buf.h\n@@ -113,6 +113,36 @@ struct dma_buf_ops {\n \t */\n \tvoid (*unpin)(struct dma_buf_attachment *attach);\n\n+\t/**\n+\t * @get_tph:\n+\t *\n+\t * Get the TPH (TLP Processing Hints) for this DMA buffer.\n+\t *\n+\t * This callback allows DMA buffer exporters to provide TPH including\n+\t * both the steering tag and the process hints (ph), which can be used\n+\t * to optimize peer-to-peer (P2P) memory access. The TPH info is typically\n+\t * used in scenarios where:\n+\t * - A PCIe device (e.g., RDMA NIC) needs to access memory on another\n+\t * PCIe device (e.g., GPU),\n+\t * - The system supports TPH and can use steering tags / ph to optimize\n+\t * cache placement and memory access patterns,\n+\t * - The memory is exported via DMABUF for cross-device sharing.\n+\t *\n+\t * @dmabuf: [in] The DMA buffer for which to retrieve TPH\n+\t * @steering_tag: [out] Pointer to store the 16-bit TPH steering tag value\n+\t * @ph: [out] Pointer to store the 8-bit TPH processing-hint value\n+\t *\n+\t * Returns:\n+\t * * 0 - Success, steering tag stored in @steering_tag\n+\t * * -EOPNOTSUPP - TPH steering tags not supported for this buffer\n+\t * * -EINVAL - Invalid parameters\n+\t *\n+\t * This callback is optional. If not implemented, the buffer does not\n+\t * support TPH.\n+\t *\n+\t */\n+\tint (*get_tph)(struct dma_buf *dmabuf, u16 *steering_tag, u8 *ph);\n+\n \t/**\n \t * @map_dma_buf:\n \t *\ndiff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h\nindex bb7b89330d35..e2a8962641d2 100644\n--- a/include/uapi/linux/vfio.h\n+++ b/include/uapi/linux/vfio.h\n@@ -1505,8 +1505,13 @@ struct vfio_region_dma_range {\n struct vfio_device_feature_dma_buf {\n \t__u32\tregion_index;\n \t__u32\topen_flags;\n-\t__u32 flags;\n-\t__u32 nr_ranges;\n+\t__u32\tflags;\n+#define VFIO_DMABUF_FL_TPH\t\t(1U << 0) /* TPH info is present */\n+#define VFIO_DMABUF_TPH_PH_SHIFT\t1 /* bits 1-2: PH (2-bit) */\n+#define VFIO_DMABUF_TPH_PH_MASK\t0x6U\n+#define VFIO_DMABUF_TPH_ST_SHIFT\t16 /* bits 16-31: steering tag */\n+#define VFIO_DMABUF_TPH_ST_MASK\t\t0xffff0000U\n+\t__u32\tnr_ranges;\n \tstruct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);\n };\n\n", "prefixes": [ "RFC", "v2", "1/2" ] }