[{"id":3668907,"web_url":"http://patchwork.ozlabs.org/comment/3668907/","msgid":"<20260325082534.GN814676@unreal>","list_archive_url":null,"date":"2026-03-25T08:25:34","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":68852,"url":"http://patchwork.ozlabs.org/api/people/68852/","name":"Leon Romanovsky","email":"leon@kernel.org"},"content":"On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote:\n> This patch adds a callback to get the tph info on DMA buffer exporters.\n> The tph info includes both the steering tag and the process hint (ph).\n> \n> The steering tag and ph are encoded in the flags field of\n> vfio_device_feature_dma_buf instead of adding new fields to the uapi\n> struct, to preserve ABI compatibility.\n> \n> Signed-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<...>\n\n> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h\n> index 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\nThis extension of flags is basically kills future extension of this\nstruct for anything that includes TPH.\n\nAdd new\nenum vfio_device_feature_dma_buf_flags {\n    VFIO_DMABUF_FL_TPH  = 1 << 0\n}\n\n> +\t__u32\tnr_ranges;\n\nadd your \"__u16 steering_tag\" and \"__u8 ph\" fields here.\n\n>  \tstruct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);\n>  };\n> \n> --\n> 2.52.0\n> \n>","headers":{"Return-Path":"\n <linux-pci+bounces-51031-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=ltb7Z1iY;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-51031-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"ltb7Z1iY\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fggfS4c9jz1y1K\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 19:53:04 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 831D6300DA40\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 08:49:45 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id ACACE39B96B;\n\tWed, 25 Mar 2026 08:49:33 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 8801A39A060;\n\tWed, 25 Mar 2026 08:49:33 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 7DBF7C4CEF7;\n\tWed, 25 Mar 2026 08:49:31 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774428573; cv=none;\n b=qixVhTI0SPMCrrZMMKZi3Ia+CladP9cpTUACTHeZxpH9ioOZQQYgZryfWxmrVkDY4lE9I7MaKc4ojE+A0vvyTWeCmE1SU8SmTnFw4oIzJXkVXmzjjMXro5J13f1pzNphIHVssi4srD/SXxfXbNzojB6WFhv9nmArPFKpnQyj/wo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774428573; c=relaxed/simple;\n\tbh=oWiu4XCakpEEWouFgjSkDQdwlQEePei3CI0lNENWLjQ=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=JazSpMwnYNi/VQjKIb88H2WjIP2cIrLYntMm6G+h+vqtGmngwAQELdd17Vf2KbAZ2G/03hpdDcE010632nc/y0hdKaujs/PT+L3zol3rZ9/fLk96Z2PemcqEFgk6RrFdk1lxIBYuI5XY9bt6sPnZ0Eur3P77WTE8fVfWOpCBo1U=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=ltb7Z1iY; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774428573;\n\tbh=oWiu4XCakpEEWouFgjSkDQdwlQEePei3CI0lNENWLjQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ltb7Z1iYmSiPVmQYAbIrLOoN+Nr2Z+YdWmZOZaSTD/tsGAbbSQRbqSofeHb6qkCbh\n\t HKUW7VOg2Ihj0GIAPLLWBjynlKhsHh3Ys3KDc29Rem+kGcBhxtPhTWgQH2s4UvjB46\n\t gz/mVcWtL9ytM4SfSAClINJgkRMfa7FQF0FvLbaDA1RbbtL3H2i5hOfKVAd/GhZh2M\n\t /BV3cQA1QnK0kpl2xBsgdzcQdJUI1J7mUw8J3yUnCIGH3oxndxR9uhWCd629HuDhsK\n\t r7tD79zZiypj5bDBgmOipZkFwp0QdNFlX71D9qbfujgxE19uX75sx/HMaKAn6au5kl\n\t 9EpfLDDNEDCJw==","Date":"Wed, 25 Mar 2026 10:25:34 +0200","From":"Leon Romanovsky <leon@kernel.org>","To":"Zhiping Zhang <zhipingz@meta.com>","Cc":"Jason Gunthorpe <jgg@ziepe.ca>, Bjorn Helgaas <bhelgaas@google.com>,\n\tlinux-rdma@vger.kernel.org, linux-pci@vger.kernel.org,\n\tnetdev@vger.kernel.org, dri-devel@lists.freedesktop.org,\n\tKeith Busch <kbusch@kernel.org>, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<20260325082534.GN814676@unreal>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260324234615.3731237-2-zhipingz@meta.com>"}},{"id":3669991,"web_url":"http://patchwork.ozlabs.org/comment/3669991/","msgid":"<acW2BwQKaUbS3eL9@kbusch-mbp>","list_archive_url":null,"date":"2026-03-26T22:41:11","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":76219,"url":"http://patchwork.ozlabs.org/api/people/76219/","name":"Keith Busch","email":"kbusch@kernel.org"},"content":"On Wed, Mar 25, 2026 at 10:25:34AM +0200, Leon Romanovsky wrote:\n> On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote:\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> \n> This extension of flags is basically kills future extension of this\n> struct for anything that includes TPH.\n> \n> Add new\n> enum vfio_device_feature_dma_buf_flags {\n>     VFIO_DMABUF_FL_TPH  = 1 << 0\n> }\n> \n> > +\t__u32\tnr_ranges;\n> \n> add your \"__u16 steering_tag\" and \"__u8 ph\" fields here.\n\nYou're suggesting that Ziping append the new fields to the end of this\nstruct? I don't think we can modify the layout of a uapi.\n\nIf we can't carve the space for this out of the existing unused flags\nfield, I think we'd have to introduce a new vfio device feature that\nbasically copies VFIO_DEVICE_FEATURE_DMA_BUF with the extra hints\nfields.\n \n> >  \tstruct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);\n> >  };","headers":{"Return-Path":"\n <linux-pci+bounces-51241-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=PsnTFjOZ;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51241-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"PsnTFjOZ\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhf7y3nJsz1yFp\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 09:48:30 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id DD517301BCF3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 22:41:14 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 621EB2E11B0;\n\tThu, 26 Mar 2026 22:41:14 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 3EF0D4AEE2;\n\tThu, 26 Mar 2026 22:41:14 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 6F329C116C6;\n\tThu, 26 Mar 2026 22:41:13 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774564874; cv=none;\n b=f4QuN1YUM3g8/jr85AclOlk4dP0WfxyH40yo4n8sa4q2RvlxlOdTI937QWAMGQbXxUena+q4N56ASFYQCmDf88yVg3yMe3kjY74hEZze/hXYBPqfyg72T6ZfMGpsK4M6iCdY3ZNfZmBSbML3doB7i9Xe2ynbsBYu7n3b1d/PKJA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774564874; c=relaxed/simple;\n\tbh=O9RE3qPQOrONRsorAVN2XwchrtUcoeQXGzvczDsoM0I=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=O7Ry6CFRQJntveQZQzi2R+H0Nn9uINJZPQEmxy3CXFsdLUQh4nbeDu8xXCeOODvRuOa/2dkz/olOrbl45+wIHupiLjd1/N59UeKZRpxbVHmn/KGfw8Qc+ddCKalckr0m/lVJx5Xvg5yH72SKrRNK/MtOcSiUOEOZTbga4sU0nwQ=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=PsnTFjOZ; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774564873;\n\tbh=O9RE3qPQOrONRsorAVN2XwchrtUcoeQXGzvczDsoM0I=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=PsnTFjOZKBZWQ4+ymH6V5CbVtPOKgtB7APar8wQbMHAL324LaZ3YA1lEqUplGxxJM\n\t 7gowm/jZDTt4f9FAUW6Sei6Jhgt0w6JS9eeWENbE6MagiwxaAYVHC0tb/Z6vqwqwSw\n\t zjuFISZZNCdmocM8GAFf1hQDyceBOcpfyTHl+zMcCmQNOiHamfaY0Q78xxZpPA5hn4\n\t aiLf0dU4cUcJmDQ7Aa0y2Ho8lDqdhnV16Fk4Xb2dg9gInBLlHG60kzH3DVFNztBTte\n\t zSlHh29e3e8PT/Nc7LWEzjm8oOGVmmTtEeGptW1/E5KVeXER+QTapM/Q/1Z2wScHex\n\t nsy13cDBr1Vcg==","Date":"Thu, 26 Mar 2026 16:41:11 -0600","From":"Keith Busch <kbusch@kernel.org>","To":"Leon Romanovsky <leon@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<acW2BwQKaUbS3eL9@kbusch-mbp>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260325082534.GN814676@unreal>"}},{"id":3669995,"web_url":"http://patchwork.ozlabs.org/comment/3669995/","msgid":"<CAH3zFs1nbAKpYxwzMcwpC_Sdy+3tE0n0wUzxJ411gV-q1O++qQ@mail.gmail.com>","list_archive_url":null,"date":"2026-03-26T22:55:44","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":92088,"url":"http://patchwork.ozlabs.org/api/people/92088/","name":"Zhiping Zhang","email":"zhipingz@meta.com"},"content":"On Thu, Mar 26, 2026 at 3:41 PM Keith Busch <kbusch@kernel.org> wrote:\n>\n> >\n> On Wed, Mar 25, 2026 at 10:25:34AM +0200, Leon Romanovsky wrote:\n> > On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote:\n> > >  struct vfio_device_feature_dma_buf {\n> > >     __u32   region_index;\n> > >     __u32   open_flags;\n> > > -   __u32   flags;\n> > > -   __u32   nr_ranges;\n> > > +   __u32   flags;\n> > > +#define VFIO_DMABUF_FL_TPH         (1U << 0) /* TPH info is present */\n> > > +#define VFIO_DMABUF_TPH_PH_SHIFT   1         /* bits 1-2: PH (2-bit) */\n> > > +#define VFIO_DMABUF_TPH_PH_MASK    0x6U\n> > > +#define VFIO_DMABUF_TPH_ST_SHIFT   16        /* bits 16-31: steering tag */\n> > > +#define VFIO_DMABUF_TPH_ST_MASK            0xffff0000U\n> >\n> > This extension of flags is basically kills future extension of this\n> > struct for anything that includes TPH.\n> >\n> > Add new\n> > enum vfio_device_feature_dma_buf_flags {\n> >     VFIO_DMABUF_FL_TPH  = 1 << 0\n> > }\n\nyes we can do that.\n\n> >\n> > > +   __u32   nr_ranges;\n> >\n> > add your \"__u16 steering_tag\" and \"__u8 ph\" fields here.\n>\nThat is what I did in V1, Leon.\n\n> You're suggesting that Ziping append the new fields to the end of this\n> struct? I don't think we can modify the layout of a uapi.\n>\n> If we can't carve the space for this out of the existing unused flags\n> field, I think we'd have to introduce a new vfio device feature that\n> basically copies VFIO_DEVICE_FEATURE_DMA_BUF with the extra hints\n> fields.\n>\nif not using the fields in the flag, then we probably have to\nintroduce a new vfio\ndevice feature.\n\n> > >     struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);\n> > >  };","headers":{"Return-Path":"\n <linux-pci+bounces-51242-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=S+c8kVnG;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=104.64.211.4; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-51242-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=\"S+c8kVnG\"","smtp.subspace.kernel.org;\n arc=fail smtp.client-ip=67.231.145.42","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 [104.64.211.4])\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 4fhfRY0ps5z1y1j\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 10:02:01 +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 83FB23008096\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 22:56:00 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 498D033D6EF;\n\tThu, 26 Mar 2026 22:55:59 +0000 (UTC)","from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com\n [67.231.145.42])\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 D6E1A3358BE\n\tfor <linux-pci@vger.kernel.org>; Thu, 26 Mar 2026 22:55:57 +0000 (UTC)","from pps.filterd (m0109334.ppops.net [127.0.0.1])\n\tby mx0a-00082601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 62QJ6v1k3537767\n\tfor <linux-pci@vger.kernel.org>; Thu, 26 Mar 2026 15:55:57 -0700","from mail-oi1-f197.google.com (mail-oi1-f197.google.com\n [209.85.167.197])\n\tby mx0a-00082601.pphosted.com (PPS) with ESMTPS id 4d51u79e54-1\n\t(version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n\tfor <linux-pci@vger.kernel.org>; Thu, 26 Mar 2026 15:55:57 -0700 (PDT)","by mail-oi1-f197.google.com with SMTP id\n 5614622812f47-46335278e7bso6244080b6e.0\n        for <linux-pci@vger.kernel.org>; Thu, 26 Mar 2026 15:55:57 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774565759; cv=fail;\n b=Y+zjTY4r0qiOgmsSiR4NWWP/waCE8jwxZC4xrel/3pHokhtHHeS4/uB6kL1bIPBVA1JxIJMjN2fyuyJYEahU9RdRUaeXJv3J8gprYFjAffQDkUmyZOYWPnNXzrGm7LFnGBhlimyPgJCtZhkhjs4LNuul9nM+ATBLfhv/84/52+Q=","i=1; a=rsa-sha256; t=1774565756; cv=none;\n        d=google.com; s=arc-20240605;\n        b=bWl1MPZl7EOYYCfoOZFWj/T5tS0zcL4fxKWxsgioiRe7QwMUklE1PBDNVpmliYyfs0\n         5eIvPShcZbTzwiTw4m8nqj23bXLwj/azhUJJ98A0cGO93aqwUdYMjXFAXjGs/Z/P9EHG\n         vGzwagtCXjZ+BXBcwypHWvWes2WfiNvez58KhwXEWzjt4aK+LHFOcBWIEi/ILj4uaSgf\n         YHq7qtZz4XoWNmeLIRuMiunNsQyx50360awu/k+EP9I90Hn7BmtG9hyitIH45fapm9OI\n         NyKgl+0+o1xf6UUlPw3uU3JlHp4b15PfjHHJ2/y63B1wKmnJ9mMlowpV6yD2jmZ3fx3W\n         YePw=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774565759; c=relaxed/simple;\n\tbh=BdyUGS9qVrZC2M4zs7j3VJuPzuCzCdpvDKaUG3wf5J8=;\n\th=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:\n\t To:Cc:Content-Type;\n b=a5TKORBIHI/IdxBEWLh0Z0btgauVIt4vIQoRIoEzsj5CgWuu7uIpzqwRaskFgkKDQ9jwR0gtjnTk5vAGl5LyFBmXAPlYPUwtweZyNtbllcR2Lx/AzmX9ExxUhD74Rq6uqla8pu3IEPdGr83CBfq5wDFywHeXgFMkW+JukFHs3oQ=","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=content-transfer-encoding:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version;\n        bh=VGlyvxOOFksgPXoMLERC1kCayld4eO3E5k/3hyTOpHg=;\n        fh=LU2kAide0UgDR4k1tp3usvn7kAqWo6o8SZpa5q0mcUU=;\n        b=DiYBSn1wxts7ZvmZRN+aWfW/ONkCJ9Oi5IsMKz8GOEtfyUbZcEsX74iIhdy7HBOGeU\n         mS+s5Ox5CZ8/rgttaMgKYBr4pkJFUC8gQxTQ4q8567cDzE/8Ssj+BI3eY+++8YbWhNjD\n         XbqZbTtC8pq3iyldKrVcvw3mNlbjKsXyR17BkWQUcWTBS+QtaBrM5cWe+4RCIGuHKa4v\n         iobccbmAra1O1n7bkc/iD+tLa/+rn1ES3CLiSy2wJce6HxrfkqzoS3QZwJDF6V6HmEo+\n         DR3Z5vORdf/O/XlKpJb9NbU2XJtCqR9lvo1deAZjdD6iXQkfIsY1xn+OIRd42VhF4k98\n         5CGw==;\n        darn=vger.kernel.org"],"ARC-Authentication-Results":["i=2; 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=S+c8kVnG; arc=fail smtp.client-ip=67.231.145.42","i=1; mx.google.com; arc=none"],"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=gWmaYzOqDIhtbUb8Zs5Nf1ednm4S50xRfwW0Jz6U+w0=; b=S+c8kVnGsspV\n\ta654lLZZ0b8EsEWQ7eZrMsM3U42hl5QQn43gPcbCwg1iIRVkzVp2dRFBMOENsKwv\n\tSFukOMCLHJB+BVExRhe9tAQ85TnRLm8BMieG/xu8T5GxAF4nxZYBRBXXNSu81mfz\n\t72IHHjWgJ7wrMUq4HLUK01uWKkwfjjbYiSew0OJdVYtTd9jpySKJMO9QYnD5wD1F\n\thO4pop4o2ClGk5kOI5qvHHOrYSB5X7rKufRQLoSTlAVCrJgs3+MLzJEtviKWKK4E\n\trl7jpexzUWHR2QNxm3b2slr+Jfm5udNi6cLbkjrHBtc/MhaQw/bPV2OzMvUx4TNz\n\t3tP95BR8hg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1774565756; x=1775170556;\n        h=content-transfer-encoding:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=VGlyvxOOFksgPXoMLERC1kCayld4eO3E5k/3hyTOpHg=;\n        b=eo3/e8owvWa9HqSWivevlO1kFhJCoha0QtmdB0JlKcHdCB52YHJwA+cg5FUyFHu+ND\n         0PCkAKChc49eYj2fDmYjFX5WJPZ8v1OKa14rG7F0syr7GyyjvZ/XTFyRJvOOCGf6Xd4C\n         hHvV6YIqN6f0Q+FnrZc3M4Rij9C+JZ01UGRe2XWm42CERsGeuov/ovK3iP+ArOF8Nqhp\n         CwBe8tHZ7nsvE+txRG1e/exDESCgeNV1m1H2Hvnr1uGTGIIySBBbYJe1sUp2/FwWtQ75\n         RxS8Bfm3PAncBk1KSZD2y2y4woPuz7yvS4KmORn1P14LFNaPT8qbQyXzgQ+vuoDiW1KI\n         jnyA==","X-Forwarded-Encrypted":"i=1;\n AJvYcCWX77PNAHQR9iYTbkPhCtVVjSThhuQXYupiXDJrcJL0ykQrJQQPVm8KBmc6B0XvNytCN5Rk0MFtKxg=@vger.kernel.org","X-Gm-Message-State":"AOJu0YwSo75z54TxlM21i3bbaF3dCtxiju1ab9S9VCFsyIxVJTOMh0BM\n\tRSXHnPuADAsgg2XEY77NhwTE8DWOfrgARL0cy2+BLfDVR8WoEg35Wqtt1+KYu4zZvhbfnIZy2iO\n\taODcn/W8xcC1R6OYRwMpTniIKkSM28LprlLFPvk72gmDXCInnGiDdwZOKupPat53WX+dw6RYEyj\n\tlrW2zSasvUKNoKVF5N1Far4Ow+7JodMIjtoms=","X-Gm-Gg":"ATEYQzxoHGNBAudpSxXOuIRhjJECCG0a9AnPg51OJBhwqcZ+XCaelalmMiaVGpHjrM9\n\tWYeNZGd/PnQDzY6UGgkBCC9Nkmp11HbqCY2QwheYPcebKVSMoNuUMV3twEtgFkICwEuH3kqrKbf\n\tptuGhXaAWu0wWmbCjId39Q3knKfeDIgHbRGUJg3VbUV9Jg3mb4zBFX4keouov0bIE/lzA+txVEo\n\tFtuPVTqcryFZDmUYwFo+w==","X-Received":["by 2002:a05:6808:1b20:b0:45e:fd68:3dd7 with SMTP id\n 5614622812f47-46a7aa42abemr1548513b6e.32.1774565756387;\n        Thu, 26 Mar 2026 15:55:56 -0700 (PDT)","by 2002:a05:6808:1b20:b0:45e:fd68:3dd7 with SMTP id\n 5614622812f47-46a7aa42abemr1548497b6e.32.1774565755966; Thu, 26 Mar 2026\n 15:55:55 -0700 (PDT)"],"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","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal> <acW2BwQKaUbS3eL9@kbusch-mbp>","In-Reply-To":"<acW2BwQKaUbS3eL9@kbusch-mbp>","From":"Zhiping Zhang <zhipingz@meta.com>","Date":"Thu, 26 Mar 2026 15:55:44 -0700","X-Gm-Features":"AQROBzDisNUSNgd3TlIskyBeYU1qigTy8IXoqXl2UWp2Iq9LIcNA3h_mkSfPwow","Message-ID":"\n <CAH3zFs1nbAKpYxwzMcwpC_Sdy+3tE0n0wUzxJ411gV-q1O++qQ@mail.gmail.com>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","To":"Keith Busch <kbusch@kernel.org>","Cc":"Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,\n        Bjorn 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, Yochai Cohen <yochai@nvidia.com>,\n        Yishai Hadas <yishaih@nvidia.com>, Bjorn Helgaas <helgaas@kernel.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Proofpoint-ORIG-GUID":"iIjBq37o4ahcfNmUgNKH7WsNRdEGzvXV","X-Authority-Analysis":"v=2.4 cv=cIvtc1eN c=1 sm=1 tr=0 ts=69c5b97d cx=c_pps\n a=WJcna6AvsNCxL/DJwPP1KA==:117 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10\n a=VkNPw1HP01LnGYTKEx00:22 a=7x6HtfJdh03M6CCDgxCd:22 a=crHB47gyY4rKiduisYu9:22\n a=VwQbUJbxAAAA:8 a=NFdbOB6VLuGm633tFYQA:9 a=QEXdDO2ut3YA:10\n a=_Y9Zt4tPzoBS9L09Snn2:22","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwMzI2MDE2NCBTYWx0ZWRfXwF43npQp8cGk\n dldh5IALlGNrH/73+Y9C2mgnCtonmHagnrASo1ubXWvsiBxXoE5vKBF39p9bbMRE47H2hEDXnhV\n g3bOpy5+ZaPz4oLlrh/nx4DtjNyl9tbcx/Cyt4F4NaDAvqro4P1tBGkpIF+yX4oGlhzG5siiN2D\n leu8hnpQ5SJmewO4hUzFSjGENpBALklAJzWfgvOMpm1OWRYorGqhbCVLqFbfaab0TJtb8qElDsx\n EH7POwid8EMsHT2qiRpRh5Gj8XiciQVRP0EARKArwXgWsXo0pXX0DIKsWPjp8t722u+0LsEDtHX\n cCXby6WkXneD2MM5+IKyOprAsk/bqunPL2Qzn9NaF9FslbXuFHwTImHiU3zLObrO/X0sVy2TPAb\n dE762TqBQwY0eDOIzPV3U61Dz0F8Padr2tz+/qChW53rg1Fg9KlUFDGND1WLcMuJFnCCd3hE5V+\n JCELHhoMq7WUhAHn1Cg==","X-Proofpoint-GUID":"iIjBq37o4ahcfNmUgNKH7WsNRdEGzvXV","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-26_03,2026-03-26_01,2025-10-01_01"}},{"id":3670622,"web_url":"http://patchwork.ozlabs.org/comment/3670622/","msgid":"<04859df4-6fa4-4b2b-aef1-621f3c053c2e@huawei.com>","list_archive_url":null,"date":"2026-03-28T02:21:55","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":92756,"url":"http://patchwork.ozlabs.org/api/people/92756/","name":"fengchengwen","email":"fengchengwen@huawei.com"},"content":"Hi Zhiping,\n\nOn 3/25/2026 7:46 AM, Zhiping Zhang wrote:\n> This patch adds a callback to get the tph info on DMA buffer exporters.\n> The tph info includes both the steering tag and the process hint (ph).\n> \n> The steering tag and ph are encoded in the flags field of\n> vfio_device_feature_dma_buf instead of adding new fields to the uapi\n> struct, to preserve ABI compatibility.\n> \n> Signed-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> diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c\n> index 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\nIf the dmabuf exporter don't provide st&ph, this ops should return error\n\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);\n> diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h\n> index 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\nIt seemed already impl...\n\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 *\n> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h\n> index 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\nAnother question:\n1\\ PCIE protocol define 8bit and 16bit ST\n2\\ In host-device ST impl, the ACPI will provide 8bit and 16bit ST, the choice of which\n   one to use depends on the minimum supported range of the device and the RP.\n3\\ So in this P2P scene, although exporter (e.g. GPU) support 16bit ST, but the consumer\n   (e.g. RDMA NIC) only support 8bit this may lead to mis-match\n\n> \n> --\n> 2.52.0\n> \n> \n>","headers":{"Return-Path":"\n <linux-pci+bounces-51367-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 (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=2JF+WD79;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51367-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com\n header.b=\"2JF+WD79\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=113.46.200.220","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=huawei.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::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 4fjLr60TPlz1y0D\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 13:22:14 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id EA77D30416FC\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 02:22:09 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E25DE3128B6;\n\tSat, 28 Mar 2026 02:22:08 +0000 (UTC)","from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com\n [113.46.200.220])\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 03FC4C2FD;\n\tSat, 28 Mar 2026 02:22:04 +0000 (UTC)","from mail.maildlp.com (unknown [172.19.162.140])\n\tby canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4fjLjW052Kz12LDV;\n\tSat, 28 Mar 2026 10:16:31 +0800 (CST)","from kwepemk500009.china.huawei.com (unknown [7.202.194.94])\n\tby mail.maildlp.com (Postfix) with ESMTPS id C6AF52025F;\n\tSat, 28 Mar 2026 10:21:56 +0800 (CST)","from [10.67.121.161] (10.67.121.161) by\n kwepemk500009.china.huawei.com (7.202.194.94) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.2.1544.11; Sat, 28 Mar 2026 10:21:56 +0800"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774664528; cv=none;\n b=WKHkmR7Ns6nA4n+y/0iRbgk2x9bEvDNCSXTQPuvpmIzFGmbhE4JstBEhGJUpf/R1c4KG69Q4oxRLwzSsTatM7UKC9KruXaVHSsqXhOuLHh3S3URvnrUM+deEfobY4E0LjszEfUfXN6zuyK4GrUBshe5In051h/brvuS5EiUE9qo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774664528; c=relaxed/simple;\n\tbh=ilKV3fBIfOdo+efVbzrEw7HNYJHL5ePWB8l7pDMop2g=;\n\th=Message-ID:Date:MIME-Version:Subject:To:CC:References:From:\n\t In-Reply-To:Content-Type;\n b=D+/qJLw1wwjBZ40P/aI6IJ5sATLeoB/kwxus0PNUSCEpuq5IuPHTT1L3eR/d7oceU+QRAVRZV5Bmfl+rpZcqeJoy48SU15tW552u/mbz6x4kqL1Hxfvgeq6W2vximhdVUUYPvTQ8jT8P0HrV+mBGEOvk+46BCPdmCFfYibRQA+c=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com;\n spf=pass smtp.mailfrom=huawei.com;\n dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com\n header.b=2JF+WD79; arc=none smtp.client-ip=113.46.200.220","dkim-signature":"v=1; a=rsa-sha256; d=huawei.com; s=dkim;\n\tc=relaxed/relaxed; q=dns/txt;\n\th=From;\n\tbh=1OkLiW8Ed78xDJTW8wn1LfvAVL5T6iaxi219R/4j/pQ=;\n\tb=2JF+WD79kpjFM25pn6LCZ/yf1qTkA1lCV4qAW3Hli7RNh88wNlL/rQrdh3W/cX8hNZxHZ2lkE\n\tH8a4NvDibeihCShBjV0YH5znkUSkE+HPMlmAkPBcdlkb6oHMDLEHmW+jExzY7dk/sMbRagOAkdE\n\tjipw2J80WKKr6DZU8huwfzA=","Message-ID":"<04859df4-6fa4-4b2b-aef1-621f3c053c2e@huawei.com>","Date":"Sat, 28 Mar 2026 10:21:55 +0800","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","User-Agent":"Mozilla Thunderbird","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","To":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>, Leon\n Romanovsky <leon@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>,\n\t<linux-rdma@vger.kernel.org>, <linux-pci@vger.kernel.org>,\n\t<netdev@vger.kernel.org>, <dri-devel@lists.freedesktop.org>, Keith Busch\n\t<kbusch@kernel.org>, Yochai Cohen <yochai@nvidia.com>, Yishai Hadas\n\t<yishaih@nvidia.com>","CC":"Bjorn Helgaas <helgaas@kernel.org>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>","Content-Language":"en-US","From":"fengchengwen <fengchengwen@huawei.com>","In-Reply-To":"<20260324234615.3731237-2-zhipingz@meta.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"7bit","X-ClientProxiedBy":"kwepems100001.china.huawei.com (7.221.188.238) To\n kwepemk500009.china.huawei.com (7.202.194.94)"}},{"id":3671372,"web_url":"http://patchwork.ozlabs.org/comment/3671372/","msgid":"<CAH3zFs2ia80jkLRTUdExd4wQM4tK_FSgGTgZumDWpL-gjoDERg@mail.gmail.com>","list_archive_url":null,"date":"2026-03-31T00:49:49","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":92088,"url":"http://patchwork.ozlabs.org/api/people/92088/","name":"Zhiping Zhang","email":"zhipingz@meta.com"},"content":"On Fri, Mar 27, 2026 at 7:22 PM fengchengwen <fengchengwen@huawei.com> wrote:\n>\n> >\n> Hi Zhiping,\n>\n> On 3/25/2026 7:46 AM, Zhiping Zhang wrote:\n> > This patch adds a callback to get the tph info on DMA buffer exporters.\n> > The tph info includes both the steering tag and the process hint (ph).\n> >\n> > The steering tag and ph are encoded in the flags field of\n> > vfio_device_feature_dma_buf instead of adding new fields to the uapi\n> > struct, to preserve ABI compatibility.\n> >\n> > Signed-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> > diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c\n> > index 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> >       struct phys_vec *phys_vec;\n> >       struct p2pdma_provider *provider;\n> >       u32 nr_ranges;\n> > +     u16 steering_tag;\n> > +     u8 ph;\n> >       u8 revoked : 1;\n> >  };\n> >\n> > @@ -60,6 +62,15 @@ vfio_pci_dma_buf_map(struct dma_buf_attachment *attachment,\n> >                                      priv->size, dir);\n> >  }\n> >\n> > +static int vfio_pci_dma_buf_get_tph(struct dma_buf *dmabuf, u16 *steering_tag,\n> > +                                 u8 *ph)\n> > +{\n> > +     struct vfio_pci_dma_buf *priv = dmabuf->priv;\n> > +     *steering_tag = priv->steering_tag;\n> > +     *ph = priv->ph;\n>\n> If the dmabuf exporter don't provide st&ph, this ops should return error\n\nThat is a good call, let me address that in the new revision.\n\n>\n> > +     return 0;\n> > +}\n> > +\n> >  static void vfio_pci_dma_buf_unmap(struct dma_buf_attachment *attachment,\n> >                                  struct sg_table *sgt,\n> >                                  enum dma_data_direction dir)\n> > @@ -90,6 +101,7 @@ static const struct dma_buf_ops vfio_pci_dmabuf_ops = {\n> >       .unpin = vfio_pci_dma_buf_unpin,\n> >       .attach = vfio_pci_dma_buf_attach,\n> >       .map_dma_buf = vfio_pci_dma_buf_map,\n> > +     .get_tph = vfio_pci_dma_buf_get_tph,\n> >       .unmap_dma_buf = vfio_pci_dma_buf_unmap,\n> >       .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> >       if (copy_from_user(&get_dma_buf, arg, sizeof(get_dma_buf)))\n> >               return -EFAULT;\n> >\n> > -     if (!get_dma_buf.nr_ranges || get_dma_buf.flags)\n> > +     if (!get_dma_buf.nr_ranges ||\n> > +         (get_dma_buf.flags & ~(VFIO_DMABUF_FL_TPH |\n> > +                                VFIO_DMABUF_TPH_PH_MASK |\n> > +                                VFIO_DMABUF_TPH_ST_MASK)))\n> >               return -EINVAL;\n> >\n> >       /*\n> > @@ -285,7 +300,14 @@ int vfio_pci_core_feature_dma_buf(struct vfio_pci_core_device *vdev, u32 flags,\n> >               ret = PTR_ERR(priv->dmabuf);\n> >               goto err_dev_put;\n> >       }\n> > -\n> > +     if (get_dma_buf.flags & VFIO_DMABUF_FL_TPH) {\n> > +             priv->steering_tag = (get_dma_buf.flags &\n> > +                                   VFIO_DMABUF_TPH_ST_MASK) >>\n> > +                                  VFIO_DMABUF_TPH_ST_SHIFT;\n> > +             priv->ph = (get_dma_buf.flags &\n> > +                         VFIO_DMABUF_TPH_PH_MASK) >>\n> > +                        VFIO_DMABUF_TPH_PH_SHIFT;\n> > +     }\n> >       /* dma_buf_put() now frees priv */\n> >       INIT_LIST_HEAD(&priv->dmabufs_elm);\n> >       down_write(&vdev->memory_lock);\n> > diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h\n> > index 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> >        */\n> >       void (*unpin)(struct dma_buf_attachment *attach);\n> >\n> > +     /**\n> > +      * @get_tph:\n> > +      *\n> > +      * Get the TPH (TLP Processing Hints) for this DMA buffer.\n> > +      *\n> > +      * This callback allows DMA buffer exporters to provide TPH including\n> > +      * both the steering tag and the process hints (ph), which can be used\n> > +      * to optimize peer-to-peer (P2P) memory access. The TPH info is typically\n> > +      * used in scenarios where:\n> > +      * - A PCIe device (e.g., RDMA NIC) needs to access memory on another\n> > +      *   PCIe device (e.g., GPU),\n> > +      * - The system supports TPH and can use steering tags / ph to optimize\n> > +      *   cache placement and memory access patterns,\n> > +      * - The memory is exported via DMABUF for cross-device sharing.\n> > +      *\n> > +      * @dmabuf: [in] The DMA buffer for which to retrieve TPH\n> > +      * @steering_tag: [out] Pointer to store the 16-bit TPH steering tag value\n> > +      * @ph: [out] Pointer to store the 8-bit TPH processing-hint value\n> > +      *\n> > +      * Returns:\n> > +      * * 0 - Success, steering tag stored in @steering_tag\n> > +      * * -EOPNOTSUPP - TPH steering tags not supported for this buffer\n> > +      * * -EINVAL - Invalid parameters\n> > +      *\n> > +      * This callback is optional. If not implemented, the buffer does not\n> > +      * support TPH.\n>\n> It seemed already impl...\n\nYup, it's supposed to be implemented.\n\n>\n> > +      *\n> > +      */\n> > +     int (*get_tph)(struct dma_buf *dmabuf, u16 *steering_tag, u8 *ph);\n> > +\n> >       /**\n> >        * @map_dma_buf:\n> >        *\n> > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h\n> > index 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> >       __u32   region_index;\n> >       __u32   open_flags;\n> > -     __u32   flags;\n> > -     __u32   nr_ranges;\n> > +     __u32   flags;\n> > +#define VFIO_DMABUF_FL_TPH           (1U << 0) /* TPH info is present */\n> > +#define VFIO_DMABUF_TPH_PH_SHIFT     1         /* bits 1-2: PH (2-bit) */\n> > +#define VFIO_DMABUF_TPH_PH_MASK      0x6U\n> > +#define VFIO_DMABUF_TPH_ST_SHIFT     16        /* bits 16-31: steering tag */\n> > +#define VFIO_DMABUF_TPH_ST_MASK              0xffff0000U\n> > +     __u32   nr_ranges;\n> >       struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);\n> >  };\n>\n> Another question:\n> 1\\ PCIE protocol define 8bit and 16bit ST\n> 2\\ In host-device ST impl, the ACPI will provide 8bit and 16bit ST, the choice of which\n>    one to use depends on the minimum supported range of the device and the RP.\n> 3\\ So in this P2P scene, although exporter (e.g. GPU) support 16bit ST, but the consumer\n>    (e.g. RDMA NIC) only support 8bit this may lead to mis-match\n>\n\nHmm, let me check how we can address this mis-match issue. One option\nis to add an\nadditional parameter and fail the get_tph call when a mis-match is found.\n\n> >\n> > --\n> > 2.52.0\n> >\n> >\n> >\n>","headers":{"Return-Path":"\n <linux-pci+bounces-51518-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=hmtSJqlW;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-51518-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=\"hmtSJqlW\"","smtp.subspace.kernel.org;\n arc=fail smtp.client-ip=67.231.145.42","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 tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fl8fk3zpjz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 11:50:22 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id EEB9D303EBB2\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 00:50:09 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 063182FE56F;\n\tTue, 31 Mar 2026 00:50:05 +0000 (UTC)","from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com\n [67.231.145.42])\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 1C8071AAE28\n\tfor <linux-pci@vger.kernel.org>; Tue, 31 Mar 2026 00:50:01 +0000 (UTC)","from pps.filterd (m0044012.ppops.net [127.0.0.1])\n\tby mx0a-00082601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 62ULJkaQ3729754\n\tfor <linux-pci@vger.kernel.org>; Mon, 30 Mar 2026 17:50:01 -0700","from mail-ot1-f70.google.com (mail-ot1-f70.google.com\n [209.85.210.70])\n\tby mx0a-00082601.pphosted.com (PPS) with ESMTPS id 4d6xq3sgfh-1\n\t(version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n\tfor <linux-pci@vger.kernel.org>; Mon, 30 Mar 2026 17:50:01 -0700 (PDT)","by mail-ot1-f70.google.com with SMTP id\n 46e09a7af769-7d7c848c866so8014987a34.0\n        for <linux-pci@vger.kernel.org>; Mon, 30 Mar 2026 17:50:01 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774918204; cv=fail;\n b=gTpAeTpWW+egFvE8XTBSt2NNvOKNEZmSb+3g6eq6ksRsy5tNO3tBOZu1kTvX1eHEuIuvW+54ih/B0PXyfQ7UJDriDktMKwBqKPXrZ5WbDL05XovOKsLxGyV5G9TkUDLyr+kV/U/h4Pr5jkXcCsCG+VSnDqnPddt3yozUGXrpVD8=","i=1; a=rsa-sha256; t=1774918200; cv=none;\n        d=google.com; s=arc-20240605;\n        b=ZHGcYKjyENOGTfnT3HmfvQLg52nFaLvPljgMOvHkBYp1ZY8fYgxm9p//e8XRzYPytH\n         1rgnFCoyqDnt6NN0ElFVKw/yB5uXGpGJi4e7nZeoQoot00AkeD4B/Y4XLKk2cOEG0YMG\n         wsktvtdOnfeupEJz0+Uc4gL1FQBhTVKY3owLwLj3G0oq6nzsOS1JRmf2hxew8HjPhoBp\n         J8MJXcG+4zfukdZz+2DKWHcJibSdb0P8SYzEILmie//ksyR9ldaxFDyubQMbPkLre8hx\n         1Ehm0boDo1ueg9yK2D55nN1lR6cOB3XQpgWKiMTWED587LSL2PZDX+i7BDe2ZQyiZ+Pd\n         7fMw=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774918204; c=relaxed/simple;\n\tbh=L9wxjJkVn9DCD3Je0oXdQaiq061HikX6e+NC7GqD39M=;\n\th=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:\n\t To:Cc:Content-Type;\n b=NceyfXILl45fgxUzaUJjK50zN9Az3NJrxUr4GNl/UV/+vHmzxKdMYGoHLziN6w5c2H6zrmjMAEOtQCSuMa5e6y24xqEGXT+Y9Ec+lgZqfumcxYZVGBqJ4E/MQ7tTNw9TjuYl+YFa8Kee8XIwknDpz4tJO/ZesBaMwQfozjqqoaU=","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=content-transfer-encoding:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version;\n        bh=TOfgVd4WxlQKE+hK9yudL6ZnSayBQl5VVP5wHI64dXg=;\n        fh=aElIoE42+eCD0Meo9tehe6yJ3LlShuk2iF0R8622gaM=;\n        b=P3eVyzuhyE+tI22Jcr1TxjyfsrL+1LygXvhQ6iiJGAU0F38d9rMe7kcycwCyIhFK/p\n         daqb+AnrtB1JhipEaooGdkQb4tqFy78oz1xFS6GiuO6lbTqHVRuQJeT7cymyM2jv7FPO\n         /FOMBHoQ85ySPMr+lsu1MhiHssPKZBCZIUKvDPESDhJwZk7dU//EjcFtGknOfWZ7kLYN\n         bbEZ6++qdTrV2ijblzDQkE3x0zPA5956zYSfvh8R9RaFI8hQDFBBQ6mZUIYlTydBV0Xp\n         E9LKpsTKFIQkpwR9GGvcy8zq1lwV8+kMQUrk75UopaoN9pzCZdC/41pgR7MHtOMDMOoD\n         Ty+w==;\n        darn=vger.kernel.org"],"ARC-Authentication-Results":["i=2; 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=hmtSJqlW; arc=fail smtp.client-ip=67.231.145.42","i=1; mx.google.com; arc=none"],"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=G9PUQuU9Xd7OgZlLFFg33R8o/sQFjvSbJ31P2p7vH2c=; b=hmtSJqlWLivr\n\tFpTCzdmZ1sdgK0lw6T1On9MlFTNr/uNvKi/cXLpsRpNesknsvaBMgIL79u+XmQ4X\n\tOvONh8klorX+4pLd8y8kkhUDUQTnOoHsKZW+iV8xX7MGNxRD5b2L9dy2O8krlqFT\n\tT4CSD5bI4B7RrT4qwqBKOb4ybQ//NBf86XefGKXCzg+XsF/ie0yV8UBASZD+WhiY\n\tgHfb9ugRF/OC6V2rmi2H21Z8NJ7kJVUQ3wl8TD8HczsB5w6HeFYEojFVp/BfWvYQ\n\thI+l07YKBq3lwSAlJXh0h1OGR0o8bpFCEz5x3yz03g+scWTCs0skkJpFTqyKTDiT\n\tLC6Prj3gjA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1774918200; x=1775523000;\n        h=content-transfer-encoding:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=TOfgVd4WxlQKE+hK9yudL6ZnSayBQl5VVP5wHI64dXg=;\n        b=EDg4YWCe9sZOX/ocykHjLztjLiV78+ffMJm2lmCQjYtGAYAtvsIIOfO3iq1GCf4XMt\n         FAowrB+vOoqmM7p2WawQmo2g6HOmqTYj9OCRu/SnX2g/GVgFCKBvzSpOuKQh/32ub0Xg\n         hxueXAQ8qwVWuYHGusziNVdlZT/vmVIOhByV+YJ9BEYhxgg4qeM4X7XBkJtWTB8yZjfs\n         gnC1DHZeZb8A8tYadA+gj6t1Kou63BS+vpYQ/xmT4nlBqf2C4TKbh0kJPuxCYrpa9Y/w\n         e/uK9vCig4DQcpXay5KUTyXie4f/9pg7VJN3GwDLwASz8DzSZn0mIt4LNbW2fyIb7B+9\n         efTg==","X-Forwarded-Encrypted":"i=1;\n AJvYcCVQ01kAnx81JEIzdVaCxHbRf0jj2ueSlOggdRNLxwjUzlhGdI2AZn1pLP95MkdLd55zivMbxkoo+ms=@vger.kernel.org","X-Gm-Message-State":"AOJu0Yzb/813GG3My4vmr03eyOFZaDnHgoMMnCC67OTBYx04Q/6hPXPc\n\tEMDszq6s0rxGY14pjKAF2JlCuxQYfG6P21CX2I270I86lRAgfMWtVVHhIMTbQ4q9BesUcuuWmcL\n\thmZaVio+LEslycuAhRDO3Zv2HZ6h/5EctZIvzB/AKcGaSMYIbTy+hsv7mPU/shf/ZrCLBXDdr4j\n\tfiKKdlWPzXW2m1PQzuCYyMbd+VHVRqPuaITow=","X-Gm-Gg":"ATEYQzyl+7RY021nzk7WyTEuO+3E8uDNgRX8nxM5Is3V6D3BBYErGZQCpFSz6dnvc5U\n\tJYykzTTxwXJewFSEyCuZ4NntlXGq1v4oM4V+zU72rshjhLzOgQM7Yz0eBC4bElQ6BQ3FYfCcj4H\n\tlYgKpue+RMa8C5Mt585nENtaVzpv923KkWAY5HleyJwwEcnXtRpCtIry9JhLdV4v19Vz8I9RFRF\n\tXjgi1+crGs1zZI+q/M=","X-Received":["by 2002:a05:6830:6d4f:b0:7d7:d4ee:c02d with SMTP id\n 46e09a7af769-7d9faebd4e9mr8218630a34.21.1774918200479;\n        Mon, 30 Mar 2026 17:50:00 -0700 (PDT)","by 2002:a05:6830:6d4f:b0:7d7:d4ee:c02d with SMTP id\n 46e09a7af769-7d9faebd4e9mr8218613a34.21.1774918200006; Mon, 30 Mar 2026\n 17:50:00 -0700 (PDT)"],"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","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <04859df4-6fa4-4b2b-aef1-621f3c053c2e@huawei.com>","In-Reply-To":"<04859df4-6fa4-4b2b-aef1-621f3c053c2e@huawei.com>","From":"Zhiping Zhang <zhipingz@meta.com>","Date":"Mon, 30 Mar 2026 17:49:49 -0700","X-Gm-Features":"AQROBzDnJHaZAUclxmUw4Fi3GhjHKGCAE6QyCPHZcIf2necy4jORB1gzd3l2wJA","Message-ID":"\n <CAH3zFs2ia80jkLRTUdExd4wQM4tK_FSgGTgZumDWpL-gjoDERg@mail.gmail.com>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","To":"fengchengwen <fengchengwen@huawei.com>","Cc":"Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,\n        Bjorn 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 Cohen <yochai@nvidia.com>, Yishai Hadas <yishaih@nvidia.com>,\n        Bjorn Helgaas <helgaas@kernel.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-Authority-Analysis":"v=2.4 cv=eqzSD4pX c=1 sm=1 tr=0 ts=69cb1a39 cx=c_pps\n a=7uPEO8VhqeOX8vTJ3z8K6Q==:117 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10\n a=VkNPw1HP01LnGYTKEx00:22 a=7x6HtfJdh03M6CCDgxCd:22 a=PAz_-FQ8hEVmOPYdF0yf:22\n a=i0EeH86SAAAA:8 a=VabnemYjAAAA:8 a=o_g7sp7U41fvUp2KB-EA:9 a=QEXdDO2ut3YA:10\n a=EXS-LbY8YePsIyqnH6vw:22 a=gKebqoRLp9LExxC7YDUY:22","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwMzMxMDAwNSBTYWx0ZWRfX1pS/+zryED+e\n 7dCUlYvcjXwEz0e1YkL781b5BKxsv2T6mh0JprfTxqjZgl08kMfMxBnr662Dn/VEEGLvX/Y1Tnn\n 47sRJ7ebB8vf+YZMYaCLqlJqyStvVY5I1TZAoUk8KZFY3uOe7IPDfThruxv7ufRMj0XBCVBwQgn\n xQR9NMSSjWF1xtWoH+asES9G0eYgBfJ4zjkCvby/SyAwLWtE/nNoARhTu8l4ScY2gvuG4N8jR5r\n psfAZfJhJpSUhWK/48CUtFifdprRyA5Irf7YS0zz74Fu8+xnhCSVy6h+dq9x5iY6pIav7YmgcIJ\n KayMU4/p7l4IoPdCJbdXk6OMw1EW30CRsaxQzUoCVj46sxpYgWrGWHq8rpDPy206ZL1VYSupP9p\n z+DW3pdTlDL7xAyZ6w5m0hKLJXyJgW3OtinEKOW/Wf7hd0MghpQwZCTvsKtHcUoTH0FaXenYoNM\n GMednoyoWH/6+CCxsBA==","X-Proofpoint-GUID":"jGFeaAZSOwZX0uyEvHLrRUuFBD6KtANB","X-Proofpoint-ORIG-GUID":"jGFeaAZSOwZX0uyEvHLrRUuFBD6KtANB","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-30_02,2026-03-28_01,2025-10-01_01"}},{"id":3671546,"web_url":"http://patchwork.ozlabs.org/comment/3671546/","msgid":"<20260331083758.GA814676@unreal>","list_archive_url":null,"date":"2026-03-31T08:37:58","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":68852,"url":"http://patchwork.ozlabs.org/api/people/68852/","name":"Leon Romanovsky","email":"leon@kernel.org"},"content":"On Thu, Mar 26, 2026 at 04:41:11PM -0600, Keith Busch wrote:\n> On Wed, Mar 25, 2026 at 10:25:34AM +0200, Leon Romanovsky wrote:\n> > On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote:\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> > \n> > This extension of flags is basically kills future extension of this\n> > struct for anything that includes TPH.\n> > \n> > Add new\n> > enum vfio_device_feature_dma_buf_flags {\n> >     VFIO_DMABUF_FL_TPH  = 1 << 0\n> > }\n> > \n> > > +\t__u32\tnr_ranges;\n> > \n> > add your \"__u16 steering_tag\" and \"__u8 ph\" fields here.\n> \n> You're suggesting that Ziping append the new fields to the end of this\n> struct? I don't think we can modify the layout of a uapi.\n\nHe needs to add before flex array. This struct is submitted by the user\nand kernel can easily calculate the position of that array.\n\nSomething like this:\ndiff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c\nindex b1d658b8f7b51..d78d915992232 100644\n--- a/drivers/vfio/pci/vfio_pci_dmabuf.c\n+++ b/drivers/vfio/pci/vfio_pci_dmabuf.c\n@@ -237,7 +237,11 @@ int vfio_pci_core_feature_dma_buf(struct vfio_pci_core_device *vdev, u32 flags,\n        if (get_dma_buf.region_index >= VFIO_PCI_ROM_REGION_INDEX)\n                return -ENODEV;\n\n-       dma_ranges = memdup_array_user(&arg->dma_ranges, get_dma_buf.nr_ranges,\n+       if (!tph_supplied)\n+               dma_ranges = memdup_array_user(old_dma_ranges_pos, get_dma_buf.nr_ranges,\n+                                      sizeof(*dma_ranges));\n+       else\n+               dma_ranges = memdup_array_user(&arg->dma_ranges, get_dma_buf.nr_ranges,\n                                       sizeof(*dma_ranges));\n        if (IS_ERR(dma_ranges))\n                return PTR_ERR(dma_ranges);\n~\n\n\nThanks\n\n> \n> If we can't carve the space for this out of the existing unused flags\n> field, I think we'd have to introduce a new vfio device feature that\n> basically copies VFIO_DEVICE_FEATURE_DMA_BUF with the extra hints\n> fields.\n>  \n> > >  \tstruct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);\n> > >  };","headers":{"Return-Path":"\n <linux-pci+bounces-51539-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=eYOeSSSF;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51539-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"eYOeSSSF\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flM6p1B1tz1yGH\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 19:41:54 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id BE9C030A9499\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 08:38:03 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 050343E024D;\n\tTue, 31 Mar 2026 08:38:03 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 D5DD43BE649;\n\tTue, 31 Mar 2026 08:38:02 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 08CB8C19423;\n\tTue, 31 Mar 2026 08:38:01 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774946282; cv=none;\n b=bHVOjvKVxzi7H9xJyfWuE4vOAlZtqV6ir+sJzPuri5sc3YpnUgTjtiUaZ58pZl53eTOJpm8S6qk8wUK2nT9w1TIgVu0aj2I9S4xy3sxdkMB3fJUs2xDIrdw0OnYiuQcfQXfYfCbDTsUNivNbzvs7cE16adAq7No2n45UCIAYLsI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774946282; c=relaxed/simple;\n\tbh=lkgsi7G8x5At2O5V1snIySUQ9gANaxTJ3/quUuCINCg=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=eLQSo5WdBGnlKPkKEOJLjF1rsTtlNFSUIdIB0arzu1jm6GcIiJ4f5tCVLtAYHq1WOjdR8zeb4aGF6PQO2C2h1JFkLlRVm4k0cSJ+V2ZFAcKbFkz87VlS4cZIQTG2xNoYxII/ZHNx5AdMZptakMDoudo8j1SmuXCzzbA6QBNdHQ8=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=eYOeSSSF; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774946282;\n\tbh=lkgsi7G8x5At2O5V1snIySUQ9gANaxTJ3/quUuCINCg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=eYOeSSSFW0WXX4mmb2MsptPkJdbl34XCp/M4zjYe56EoUT29R9MHtfTXKQPdaNTCC\n\t km+65bU1EFEOKw5dFVpsTcaiMT//g3eVQ5wQFTIo/I7oJ/THNQwpC5I8OveBHsLJSv\n\t 3TLow+1Vv81z+6ZpRvaJ+yJWkL2V+tUPyY4nPDYssx0+yV1YmWFpME3575WC2Pv8mV\n\t GFTL9SNY7QSYH4J+O7uv1C5fcawUeC5d6HW7UF+4i8Box0HYi2vuZ4MBWER521nK0Q\n\t SenJKH1W+1P9Rtm0e28iNy23S+AdcNCUTs9CjfxLv0EdzgY1EGenaxFTOtyUWS9Nz4\n\t 6i/D/wPac9ByA==","Date":"Tue, 31 Mar 2026 11:37:58 +0300","From":"Leon Romanovsky <leon@kernel.org>","To":"Keith Busch <kbusch@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<20260331083758.GA814676@unreal>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<acW2BwQKaUbS3eL9@kbusch-mbp>"}},{"id":3671549,"web_url":"http://patchwork.ozlabs.org/comment/3671549/","msgid":"<20260331083936.GB814676@unreal>","list_archive_url":null,"date":"2026-03-31T08:39:36","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":68852,"url":"http://patchwork.ozlabs.org/api/people/68852/","name":"Leon Romanovsky","email":"leon@kernel.org"},"content":"On Thu, Mar 26, 2026 at 03:55:44PM -0700, Zhiping Zhang wrote:\n> On Thu, Mar 26, 2026 at 3:41 PM Keith Busch <kbusch@kernel.org> wrote:\n> >\n> > >\n> > On Wed, Mar 25, 2026 at 10:25:34AM +0200, Leon Romanovsky wrote:\n> > > On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote:\n> > > >  struct vfio_device_feature_dma_buf {\n> > > >     __u32   region_index;\n> > > >     __u32   open_flags;\n> > > > -   __u32   flags;\n> > > > -   __u32   nr_ranges;\n> > > > +   __u32   flags;\n> > > > +#define VFIO_DMABUF_FL_TPH         (1U << 0) /* TPH info is present */\n> > > > +#define VFIO_DMABUF_TPH_PH_SHIFT   1         /* bits 1-2: PH (2-bit) */\n> > > > +#define VFIO_DMABUF_TPH_PH_MASK    0x6U\n> > > > +#define VFIO_DMABUF_TPH_ST_SHIFT   16        /* bits 16-31: steering tag */\n> > > > +#define VFIO_DMABUF_TPH_ST_MASK            0xffff0000U\n> > >\n> > > This extension of flags is basically kills future extension of this\n> > > struct for anything that includes TPH.\n> > >\n> > > Add new\n> > > enum vfio_device_feature_dma_buf_flags {\n> > >     VFIO_DMABUF_FL_TPH  = 1 << 0\n> > > }\n> \n> yes we can do that.\n> \n> > >\n> > > > +   __u32   nr_ranges;\n> > >\n> > > add your \"__u16 steering_tag\" and \"__u8 ph\" fields here.\n> >\n> That is what I did in V1, Leon.\n\nNot really, you did only half of the work. You didn't introduce new flag\nand didn't calculate \"old dma range\" position.\n\nThanks","headers":{"Return-Path":"\n <linux-pci+bounces-51540-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=QXdHaeEt;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51540-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"QXdHaeEt\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flMCS5Pjwz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 19:45:56 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id B8382302AC11\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 08:39:41 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 19E203E024D;\n\tTue, 31 Mar 2026 08:39:41 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 E93A123536B;\n\tTue, 31 Mar 2026 08:39:40 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id E524DC19423;\n\tTue, 31 Mar 2026 08:39:39 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774946381; cv=none;\n b=KlWOK8OgTa9U27QrwNoqW2Tdc8MY2LyD0cUREqgklWYpmh+e1y4xLJ84ZWxb6fiEXNYqUKMDU25cfTmrjunIaW2MCyP6ftD/XGQbekGMtpnv1Uc5hxKvx/2XjGgnAi8EJXpfVViYOg/58LrZSyCDxCsXyexFp6n/uUiF6TqK/YM=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774946381; c=relaxed/simple;\n\tbh=9sA0RSLV5+ly21pfDzUPFohcEh6PFz1+BwavgS11Jjk=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=YYmSgpPv2eEwjvMGhml08haE/RXfa7ty0YlCjPJ0GPaBy8cGQuOdlAMDpSsbEwXj2JuUuee86UsuwB5UAN6kVj2x4Qiq52nVSip3TyjQr/KnCVyuoidBnD1kur9oL9ExCWUwHPgNPuLtf8Y2kUs9zBupS+8eLqK8qzt7RQhDQe0=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=QXdHaeEt; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774946380;\n\tbh=9sA0RSLV5+ly21pfDzUPFohcEh6PFz1+BwavgS11Jjk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QXdHaeEtt5Ygpyji6z/xXuLjEqwGjMQ/Sp1FN/mQ2+fxi2PSQp7uWY/j0NOmTQSTw\n\t wL8FNAz3qm7sxxFcktmOGZoPY0Ijih+SPXYWE8u6EYWx5qVJ87XUTfv6G+eIXPVNuh\n\t mbDjmCJQlg4JPOprQJhnmegmjeeTDKhk7fAXzwQHPdd4KVN60L7abuTEXxteDa1mV9\n\t P2SCxMQ3nTv39zNrP4dCNDeUH88jiuMxgs6k9PqoPpCFkSLvJuwquC2I/jeBe8S67m\n\t ywYE3vpGeijji9987NQqLhFiSlMRfwsXVV1LMpaeO5cKfvGYMtHiqkGjGR5SyMmXKy\n\t NVL5A4/QbSnFA==","Date":"Tue, 31 Mar 2026 11:39:36 +0300","From":"Leon Romanovsky <leon@kernel.org>","To":"Zhiping Zhang <zhipingz@meta.com>","Cc":"Keith Busch <kbusch@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<20260331083936.GB814676@unreal>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <CAH3zFs1nbAKpYxwzMcwpC_Sdy+3tE0n0wUzxJ411gV-q1O++qQ@mail.gmail.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-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"\n <CAH3zFs1nbAKpYxwzMcwpC_Sdy+3tE0n0wUzxJ411gV-q1O++qQ@mail.gmail.com>"}},{"id":3671659,"web_url":"http://patchwork.ozlabs.org/comment/3671659/","msgid":"<acvFV8c5QVxnt3Em@kbusch-mbp>","list_archive_url":null,"date":"2026-03-31T13:00:07","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":76219,"url":"http://patchwork.ozlabs.org/api/people/76219/","name":"Keith Busch","email":"kbusch@kernel.org"},"content":"On Tue, Mar 31, 2026 at 11:37:58AM +0300, Leon Romanovsky wrote:\n> On Thu, Mar 26, 2026 at 04:41:11PM -0600, Keith Busch wrote:\n> > \n> > You're suggesting that Ziping append the new fields to the end of this\n> > struct? I don't think we can modify the layout of a uapi.\n> \n> He needs to add before flex array. This struct is submitted by the user\n> and kernel can easily calculate the position of that array.\n\nNo, you can't just do that. Existing applications would break when they\ncompile against the updated kernel header. They don't know about this\nnew \"tph\" supplied flag, but they'll all accidently use the new\ndma_ranges offset. \n \n> Something like this:\n> diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c\n> index b1d658b8f7b51..d78d915992232 100644\n> --- a/drivers/vfio/pci/vfio_pci_dmabuf.c\n> +++ b/drivers/vfio/pci/vfio_pci_dmabuf.c\n> @@ -237,7 +237,11 @@ int vfio_pci_core_feature_dma_buf(struct vfio_pci_core_device *vdev, u32 flags,\n>         if (get_dma_buf.region_index >= VFIO_PCI_ROM_REGION_INDEX)\n>                 return -ENODEV;\n> \n> -       dma_ranges = memdup_array_user(&arg->dma_ranges, get_dma_buf.nr_ranges,\n> +       if (!tph_supplied)\n> +               dma_ranges = memdup_array_user(old_dma_ranges_pos, get_dma_buf.nr_ranges,\n> +                                      sizeof(*dma_ranges));\n> +       else\n> +               dma_ranges = memdup_array_user(&arg->dma_ranges, get_dma_buf.nr_ranges,\n>                                        sizeof(*dma_ranges));\n>         if (IS_ERR(dma_ranges))\n>                 return PTR_ERR(dma_ranges);\n> ~","headers":{"Return-Path":"\n <linux-pci+bounces-51558-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=D1GvVZwr;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51558-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"D1GvVZwr\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flSy95zp4z1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 00:04:49 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 716B9302BB9B\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 13:00:11 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 67AF73E3C7E;\n\tTue, 31 Mar 2026 13:00:10 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 427153E3C56;\n\tTue, 31 Mar 2026 13:00:09 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 5715FC19423;\n\tTue, 31 Mar 2026 13:00:09 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774962010; cv=none;\n b=LwmYFPa2sGIEXL/P1Mn+H145iQOM9NxKP6D2kI5ZQ2rSA7FB4Bvc0wz5S+860UigggeohwJ/gd9XtVJf+cF3RZVn8RjpPKE7vVLsdSdTch6X44wBdHx2WuYXevTBy8sS1RebLFV/47OCOH91A4FKmEYtdd+xIp4aNyPvgAj/kOo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774962010; c=relaxed/simple;\n\tbh=Aid6A4kU1rFuiXFfYoqlUcE12Y1zwl4OGNPuijYgxwQ=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=kXwv8iogwHKgw71VKhGcEcC56jx9bnBZQjdMU+DR1dYPaezl+2XQAh6z+sRmEnDq+OI2sqiS+vVmSttUX/1uHeTljEqgp0B5NsGlmyAl3NJ5PU0Gm/CPiC/y1+Crfc+pJGmXmTJNKr8ptCz72to1kaTgGHK7GRxdeamGARQwsVo=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=D1GvVZwr; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774962009;\n\tbh=Aid6A4kU1rFuiXFfYoqlUcE12Y1zwl4OGNPuijYgxwQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=D1GvVZwrBJF+RmNmadu1Zd61sTNOaNDCVjyCiMVFWQWQUMH+6Zzw1Hz9oznH2f3ks\n\t ljnsOTeYS0CRUSQrFS62kxo3o64EI2TpzBCxN9YSxtR1BxnimRdrdbRJ8y+vT/5pXU\n\t 6ieoDwrOo6tkLAJP7hqhT7bXIx4yxGfg/E4FdIipIi1mejoJD0XpfZrs6bQnMwQFfB\n\t uiHpGijKiTtJ/HdI8OxLMiqKha8jj/0Mbfxjx5oCFIwRfLoyLosrSvvdg42a1BQ87h\n\t ASGO07Q6376XU49mwx6thSd118eOZPEc3avvWEdnznnVHDetxJ5BpVRMlfQAqSb+Dz\n\t 9S//mLmMysm2g==","Date":"Tue, 31 Mar 2026 07:00:07 -0600","From":"Keith Busch <kbusch@kernel.org>","To":"Leon Romanovsky <leon@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<acvFV8c5QVxnt3Em@kbusch-mbp>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260331083758.GA814676@unreal>"}},{"id":3671683,"web_url":"http://patchwork.ozlabs.org/comment/3671683/","msgid":"<20260331132942.GC814676@unreal>","list_archive_url":null,"date":"2026-03-31T13:29:42","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":68852,"url":"http://patchwork.ozlabs.org/api/people/68852/","name":"Leon Romanovsky","email":"leon@kernel.org"},"content":"On Tue, Mar 31, 2026 at 07:00:07AM -0600, Keith Busch wrote:\n> On Tue, Mar 31, 2026 at 11:37:58AM +0300, Leon Romanovsky wrote:\n> > On Thu, Mar 26, 2026 at 04:41:11PM -0600, Keith Busch wrote:\n> > > \n> > > You're suggesting that Ziping append the new fields to the end of this\n> > > struct? I don't think we can modify the layout of a uapi.\n> > \n> > He needs to add before flex array. This struct is submitted by the user\n> > and kernel can easily calculate the position of that array.\n> \n> No, you can't just do that. Existing applications would break when they\n> compile against the updated kernel header. They don't know about this\n> new \"tph\" supplied flag, but they'll all accidently use the new\n> dma_ranges offset. \n\nSo we need to always pass TPH flag and treat 0 as do-nothing-field.\n\nThanks","headers":{"Return-Path":"\n <linux-pci+bounces-51564-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=hdU2s016;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=104.64.211.4; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-51564-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"hdU2s016\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flTYx169jz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 00:32:21 +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 DBED53016161\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 13:29:53 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id EDD8D3D811A;\n\tTue, 31 Mar 2026 13:29:50 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 C9EF1393DD8;\n\tTue, 31 Mar 2026 13:29:50 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 130B4C19423;\n\tTue, 31 Mar 2026 13:29:49 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774963790; cv=none;\n b=ZTg/trpMmAQNYZ22j1bobJVsZGGjrCS2gWZUJaTHayb+9zteHe656fx4iSPzwXLkKuGrDOF5uMtH1GAaLcvat5JsxukoxcL70oZUY6QV404mMFh/LrAd0K6rdDuHtl8fYxTEC0xHvgH3ZfgemjGKkxgo2FE1o1kM4b1ylEKu0sA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774963790; c=relaxed/simple;\n\tbh=yOspeiVvS+gNtJplzbM2Dxr/WR4OJO96oQHUmIt9v0Y=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=MDIvbEHbHPIdmwnSodqUqJ7QfndJdqtDNuaJ/SkmgbhPiiwgYewodcBZR1xRI0LG0iVZ+iNBHqri+PArt1xyCoV1IV2yGzOV36RdBofUoxSw0OdSwkONH7qWO+bkk8wKaTwUg88Cto5/59XWqo3dylzx8YQ1++Dc9c2j2CDDdbk=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=hdU2s016; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774963790;\n\tbh=yOspeiVvS+gNtJplzbM2Dxr/WR4OJO96oQHUmIt9v0Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hdU2s016zAmRsWGzEOu4gpXir2KwMeVSQjx8oTukDGOEZ5d55Ib7wtjtIX6XCGH1p\n\t 2tHDRTfLxzvY+yUuDP+yN6a1Ef7FxclNurfMXNAXFvql5oDKubioR9l5thGX7x42QS\n\t Tfj57n4w7/1pVYC6zdDTmDfUsUgt88IDR1g/mWSvZRE3MW0+tNxG54UGWDOKcQ/tSt\n\t tQ1kBpDF8XU5i31oN0KdhMQdjEtGwz5vCrVgj/8TjL5xtChvGTutVbAmxnfrUrZNRt\n\t hUGeAiYo/xIoX2g1a+/HqGzOBC8pXYDhzKZMcWT2NbSH5SCBjtNBURTKrNokktb6BR\n\t OWC1YLGYTX5GQ==","Date":"Tue, 31 Mar 2026 16:29:42 +0300","From":"Leon Romanovsky <leon@kernel.org>","To":"Keith Busch <kbusch@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<20260331132942.GC814676@unreal>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>\n <acvFV8c5QVxnt3Em@kbusch-mbp>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<acvFV8c5QVxnt3Em@kbusch-mbp>"}},{"id":3671686,"web_url":"http://patchwork.ozlabs.org/comment/3671686/","msgid":"<acvNsvS5ShlQlrox@kbusch-mbp>","list_archive_url":null,"date":"2026-03-31T13:35:46","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":76219,"url":"http://patchwork.ozlabs.org/api/people/76219/","name":"Keith Busch","email":"kbusch@kernel.org"},"content":"On Tue, Mar 31, 2026 at 04:29:42PM +0300, Leon Romanovsky wrote:\n> On Tue, Mar 31, 2026 at 07:00:07AM -0600, Keith Busch wrote:\n> > On Tue, Mar 31, 2026 at 11:37:58AM +0300, Leon Romanovsky wrote:\n> > > On Thu, Mar 26, 2026 at 04:41:11PM -0600, Keith Busch wrote:\n> > > > \n> > > > You're suggesting that Ziping append the new fields to the end of this\n> > > > struct? I don't think we can modify the layout of a uapi.\n> > > \n> > > He needs to add before flex array. This struct is submitted by the user\n> > > and kernel can easily calculate the position of that array.\n> > \n> > No, you can't just do that. Existing applications would break when they\n> > compile against the updated kernel header. They don't know about this\n> > new \"tph\" supplied flag, but they'll all accidently use the new\n> > dma_ranges offset. \n> \n> So we need to always pass TPH flag and treat 0 as do-nothing-field.\n\nI don't think you're understanding the implications. If Zhiping appends\nnew fields in front of the flex array dma_ranges, then existing\napplications will implicitly use the new offset if they are recompiled\nagainst the new kernel header. But if the binary was compiled against\nthe older kernel header, then that application would use the previous\noffset. Both applications have the TPH flag cleared to 0. How is the\nkernel supposed to know which offset the application used?","headers":{"Return-Path":"\n <linux-pci+bounces-51566-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=K81gF7XR;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-51566-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"K81gF7XR\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flThf19wsz1yGH\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 00:38:10 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 5B23E3025A71\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 13:35:52 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 365BE32BF51;\n\tTue, 31 Mar 2026 13:35:49 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 121BC3019A4;\n\tTue, 31 Mar 2026 13:35:48 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id F3D6EC19423;\n\tTue, 31 Mar 2026 13:35:47 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774964149; cv=none;\n b=MWeDdKmHIOUqf6rhXshVIDodRRO+6GQ0+ove/PgadEmgSHoFkpiOXAtzD81fykLaxpkDDW0FS0q0pdB81I5VFflAuMblqw768KuEM73EHttQF+r2u2MmfwQK6EfjscleXlGpAEZyPPK57/AboYj3HzYt0nsVDf5kZEqz5UvKwqE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774964149; c=relaxed/simple;\n\tbh=T7CKcWnw0/Y648smPZCLrFLT4ryWZtkgPW//JWGynMw=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=dRIXuF14A9dmEff/2ajIU/vgUEMpj2Rn5NvSOEwzJLoAk/h2kb248yN5NYacE9Y0w0b9gFQgnHqnMElHhX/spxLm1JZEaaZuCO+7BzQL0QY9oABVsp1mvzzFZa7CIq3h+N5zAInygAlsa0oNkNTtltsGMAtY2KnzDyvfq2oeo/4=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=K81gF7XR; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774964148;\n\tbh=T7CKcWnw0/Y648smPZCLrFLT4ryWZtkgPW//JWGynMw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=K81gF7XRIHDSqtDeXLYPJ49+bK0BxJmbsE9v1yZoU0aXCXcf96P4V2APhihTnCt0D\n\t CZOIQQqb58JErx9VcfbX3QTfkyJlb01SNRArlqjjUIXfVGLYt7dPW95Pu2KsdmNwNR\n\t 4ycSoDd+/RPv701ksTbAW4Au8cr3OZ6ccMwL7zLJs9vwvFDWr9Cb0p6mjbIv6jds1V\n\t ISGAxfZurcIMqWk02UViuL5pFtTZ7LEBH/Nbg4ODW4iH8gas8f/cz9wuerbJU+JFxy\n\t 8vTwwE1+2O+PEEyJSRDfcyZ43PerNEL+bUsfN06Z3IC2SVho9tK8ZuqvFYAQQJ1hfe\n\t xkPhRr1qLLchw==","Date":"Tue, 31 Mar 2026 07:35:46 -0600","From":"Keith Busch <kbusch@kernel.org>","To":"Leon Romanovsky <leon@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<acvNsvS5ShlQlrox@kbusch-mbp>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>\n <acvFV8c5QVxnt3Em@kbusch-mbp>\n <20260331132942.GC814676@unreal>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260331132942.GC814676@unreal>"}},{"id":3671701,"web_url":"http://patchwork.ozlabs.org/comment/3671701/","msgid":"<20260331140309.GH814676@unreal>","list_archive_url":null,"date":"2026-03-31T14:03:09","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":68852,"url":"http://patchwork.ozlabs.org/api/people/68852/","name":"Leon Romanovsky","email":"leon@kernel.org"},"content":"On Tue, Mar 31, 2026 at 07:35:46AM -0600, Keith Busch wrote:\n> On Tue, Mar 31, 2026 at 04:29:42PM +0300, Leon Romanovsky wrote:\n> > On Tue, Mar 31, 2026 at 07:00:07AM -0600, Keith Busch wrote:\n> > > On Tue, Mar 31, 2026 at 11:37:58AM +0300, Leon Romanovsky wrote:\n> > > > On Thu, Mar 26, 2026 at 04:41:11PM -0600, Keith Busch wrote:\n> > > > > \n> > > > > You're suggesting that Ziping append the new fields to the end of this\n> > > > > struct? I don't think we can modify the layout of a uapi.\n> > > > \n> > > > He needs to add before flex array. This struct is submitted by the user\n> > > > and kernel can easily calculate the position of that array.\n> > > \n> > > No, you can't just do that. Existing applications would break when they\n> > > compile against the updated kernel header. They don't know about this\n> > > new \"tph\" supplied flag, but they'll all accidently use the new\n> > > dma_ranges offset. \n> > \n> > So we need to always pass TPH flag and treat 0 as do-nothing-field.\n> \n> I don't think you're understanding the implications. If Zhiping appends\n> new fields in front of the flex array dma_ranges, then existing\n> applications will implicitly use the new offset if they are recompiled\n> against the new kernel header. But if the binary was compiled against\n> the older kernel header, then that application would use the previous\n> offset. Both applications have the TPH flag cleared to 0. How is the\n> kernel supposed to know which offset the application used?\n\nI understand, my proposal is always set TPH flag when new struct is\nused. Everything will be much easier if we can add fields after flex\narray.\n\nThanks","headers":{"Return-Path":"\n <linux-pci+bounces-51571-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=DTxfuMQN;\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-51571-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"DTxfuMQN\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"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 4flVGb4Mcgz1yGH\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 01:04:07 +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 B9888301F6B2\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 14:03:44 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 7860F3F7AA2;\n\tTue, 31 Mar 2026 14:03:14 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 226903FAE1A;\n\tTue, 31 Mar 2026 14:03:13 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id CC1EFC19424;\n\tTue, 31 Mar 2026 14:03:12 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774965794; cv=none;\n b=In0p8Wns/gbB8jI9N5R9WVP56ryqVj2tGJcI2BY8h6IhPJJQRgrbi/tJMLNmPu+qwFZuh14faa5CKV7nTjmbaiL8WGrEfsryIFd3La7XcIS2PUXVRPGvlf7J3dFx2X/QqXOvgxH53h3t4EsCuqf3LU96YopRXETBIgV/2wfD+gs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774965794; c=relaxed/simple;\n\tbh=IL6FrHP3uHz8//ln3rvV3AwE9xShRnaGlba1Swd/CcU=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=T8snW71rsKMSZTfrFtR3Tmq3YunfIIClXB869+BCaQRqFw24+GWkF1mKibrVMr1BGnOT0kBpskm3JWat8N1eEvcOVKnSLetBVkRCn2bM7EuHAcYO2CEV9+5juErZQ+7gKOYRL+DdIyhR+BznwqM66g/PTv9OFwWlnmA9TL7KVGo=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=DTxfuMQN; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774965793;\n\tbh=IL6FrHP3uHz8//ln3rvV3AwE9xShRnaGlba1Swd/CcU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DTxfuMQNcKnBOZV95n5BWavkoaGlKAWWfExhRT+itzUFx5gqCaXswy6i02Gq73KjI\n\t Q2IOghUst9Rx7ZdlOj9a3+Yj+GV9iSozAtDTP8PoHt9qa2MrX1RvEIsMbdGTwhd0R1\n\t ps0sQQ/kfn+Pjmk+pwd970gylvPJW8FBSVzDD8ZaFefaI2BMXgPwcnOdiQEXGK7WII\n\t AtzvVT2u9PcGxSOiIRMbs9DkNzB5Dmm2SK+2vEpVZPYRRXn+n5oGdU/JuF0PJqddAc\n\t VW81dIkzz3F2ZAQtqeFBjWifnIQgDFyQuD0x4jf51t8xqI+vo+RPCbk1GA6ii4yPCN\n\t OmwfmJsz6icIg==","Date":"Tue, 31 Mar 2026 17:03:09 +0300","From":"Leon Romanovsky <leon@kernel.org>","To":"Keith Busch <kbusch@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<20260331140309.GH814676@unreal>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>\n <acvFV8c5QVxnt3Em@kbusch-mbp>\n <20260331132942.GC814676@unreal>\n <acvNsvS5ShlQlrox@kbusch-mbp>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<acvNsvS5ShlQlrox@kbusch-mbp>"}},{"id":3671709,"web_url":"http://patchwork.ozlabs.org/comment/3671709/","msgid":"<acvWplw67b3Gwlkc@kbusch-mbp>","list_archive_url":null,"date":"2026-03-31T14:13:58","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":76219,"url":"http://patchwork.ozlabs.org/api/people/76219/","name":"Keith Busch","email":"kbusch@kernel.org"},"content":"On Tue, Mar 31, 2026 at 05:03:09PM +0300, Leon Romanovsky wrote:\n> I understand, my proposal is always set TPH flag when new struct is\n> used.\n\nAn existing application recompiled against the new kernel api implicitly\nuses the new struct layout without setting the TPH flag, so kernel and\napplication are out of sync on where dma_ranges exists with your\nproposal.","headers":{"Return-Path":"\n <linux-pci+bounces-51577-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=LzRtQzHM;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51577-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"LzRtQzHM\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4flVb31sKHz1yCp\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 01:18:23 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 1E1993096626\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 14:14:02 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E015A3F99F1;\n\tTue, 31 Mar 2026 14:14:00 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 BBA843B388E;\n\tTue, 31 Mar 2026 14:14:00 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id E590CC19423;\n\tTue, 31 Mar 2026 14:13:59 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774966440; cv=none;\n b=uj+KkhSBlw9Hik++lU1lMJnTecqnhshYd1/bkg4iaoHVT5Pi1yINuf0iBvLeHj1QW91EOBW6RFYUCQROmIU8mB/3L/vYdikrVLnai9Kqj2UJonQ9XeNa0GY4GVl01xehfB8WRr4UffDLbu0ckLL7ShLiZZaDl6yFibIQfA9nb7Q=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774966440; c=relaxed/simple;\n\tbh=WuDTh1qvVfpreyA+FwkOQW5WOW/1M6AkJSQhmwhXYQk=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=PIti58WNiX734+ivxl0mt6ZsCsDj3OLcSnuKdWbt9Z+MFfUJBm5CGQk+m9vcCnOIJ+maW4UwrCyM8mQh/wTuzbYjJCBmn3gK+BmclrqT1TNiy454F1WuecIZML+rjSzDElibK9ZZLFVIFj/+KB1jwj2xfqq5PN/ecYrNnbXAQLU=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=LzRtQzHM; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774966440;\n\tbh=WuDTh1qvVfpreyA+FwkOQW5WOW/1M6AkJSQhmwhXYQk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=LzRtQzHM+7ul0hm/xfo7NgRoHCrt2OsiKzgRPhjDXdWwcxZjjMA1P5HJP8+thKeSW\n\t dCZGnt2cfmJYCJbx98mUnoWzGgRzMfMJF2stE704IIgW7Tbjgn72daUYEYUry8Gmdy\n\t R8tCM+cdqhYylcd1eMFh+0+fIMAuEvhIYQC/4ADz7OL7uwS0JgIFfh9OJzC+/6zn/W\n\t VLoTaYI7N0MTfj5Gy52dDY/TJpv4+V4DS/SkF8E1cEIMSB4RKLDsZKgG39HAc4uk5P\n\t 9MD72pRxxmuRylRmH+eDnH0Dyh7f1qRJkvRsUmOIpXJo9oT68WCv6AHCtRXSjeOilT\n\t nobVfwLzY6fow==","Date":"Tue, 31 Mar 2026 08:13:58 -0600","From":"Keith Busch <kbusch@kernel.org>","To":"Leon Romanovsky <leon@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<acvWplw67b3Gwlkc@kbusch-mbp>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>\n <acvFV8c5QVxnt3Em@kbusch-mbp>\n <20260331132942.GC814676@unreal>\n <acvNsvS5ShlQlrox@kbusch-mbp>\n <20260331140309.GH814676@unreal>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260331140309.GH814676@unreal>"}},{"id":3671877,"web_url":"http://patchwork.ozlabs.org/comment/3671877/","msgid":"<20260331190220.GI814676@unreal>","list_archive_url":null,"date":"2026-03-31T19:02:20","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":68852,"url":"http://patchwork.ozlabs.org/api/people/68852/","name":"Leon Romanovsky","email":"leon@kernel.org"},"content":"On Tue, Mar 31, 2026 at 08:13:58AM -0600, Keith Busch wrote:\n> On Tue, Mar 31, 2026 at 05:03:09PM +0300, Leon Romanovsky wrote:\n> > I understand, my proposal is always set TPH flag when new struct is\n> > used.\n> \n> An existing application recompiled against the new kernel api implicitly\n> uses the new struct layout without setting the TPH flag, so kernel and\n> application are out of sync on where dma_ranges exists with your\n> proposal.\n\nRight, what about adding TPH fields to struct vfio_region_dma_range\ninstead of struct vfio_device_feature_dma_buf?\n\nThanks","headers":{"Return-Path":"\n <linux-pci+bounces-51615-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=HotHbz1V;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-51615-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"HotHbz1V\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::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 4flcyt4xDJz1yGH\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 06:05:58 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id C2913304C079\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 19:02:28 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E8AB93914EB;\n\tTue, 31 Mar 2026 19:02:27 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 C56503845C2;\n\tTue, 31 Mar 2026 19:02:27 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id C9A1DC19423;\n\tTue, 31 Mar 2026 19:02:26 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774983747; cv=none;\n b=MEoXFUWyRio/VqCfkPkq88SpQqlIVufcfM00TFFxpGl6KuNB+ntdekGVstBW4xz2+VKaJLhXxyQZDWmi76WnDw/MoofmXWnoKMT0yKnyGKGGyyB0Xq4tulwJOvqukaOgXfFmw6U87KbOoljTmPAl5/LvYMulYyXGvNLrWxDiOdc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774983747; c=relaxed/simple;\n\tbh=R94WVshWogD2v4hXHETq37YTuAedBBrvIpKh2CGxklY=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=r6ch8u+sTA29x35rkToEdeneffvUmW6+9pqYHcThOrHodWiy8X6eU58IilvH+4wvj21lvSUhoPVSY/QobyN5xhSNDZcpQ2HawsFHXgnajEmrkakkMPHampBTxSPo8c9ygXoHEZixbtgaVmSOzApssRbkC7lh9yluHKiEHgbAhMc=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=HotHbz1V; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774983747;\n\tbh=R94WVshWogD2v4hXHETq37YTuAedBBrvIpKh2CGxklY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=HotHbz1VpN+dUNKQYC7KDVOBp2EtyGMtsxbWiR4UaZdlPXa08F1P+GYNo8X0Y+PPq\n\t ISowxrEU6fREnIPbKnvZjP5om8QNQpMUADWipKo8TsAkRHMai/75MFcTYP1JCN89Mg\n\t NQVZTkO4VWfilvnfBAUIrauuZXubwNw17NP+GPHrPQAn3FUu4mFiDyR228UirXOhJl\n\t 0NY7OWzfD+3DlAUcC8ASJuQIbvKNwv2nDDIJ3cCJDhWH0ROsKcnLwAsyiUv9FPNqrU\n\t yhNr8p3UYkImGirMJoJkt6oDzxbkZNOXiJ3PM7DYGtmpdUZfeXb71HdYdNrN1RMutv\n\t OggMmxcQa/t9w==","Date":"Tue, 31 Mar 2026 22:02:20 +0300","From":"Leon Romanovsky <leon@kernel.org>","To":"Keith Busch <kbusch@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<20260331190220.GI814676@unreal>","References":"<20260324234615.3731237-1-zhipingz@meta.com>\n <20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>\n <acvFV8c5QVxnt3Em@kbusch-mbp>\n <20260331132942.GC814676@unreal>\n <acvNsvS5ShlQlrox@kbusch-mbp>\n <20260331140309.GH814676@unreal>\n <acvWplw67b3Gwlkc@kbusch-mbp>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<acvWplw67b3Gwlkc@kbusch-mbp>"}},{"id":3671901,"web_url":"http://patchwork.ozlabs.org/comment/3671901/","msgid":"<acwkAo2k41xaxdTS@kbusch-mbp>","list_archive_url":null,"date":"2026-03-31T19:44:02","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":76219,"url":"http://patchwork.ozlabs.org/api/people/76219/","name":"Keith Busch","email":"kbusch@kernel.org"},"content":"On Tue, Mar 31, 2026 at 10:02:20PM +0300, Leon Romanovsky wrote:\n> \n> Right, what about adding TPH fields to struct vfio_region_dma_range\n> instead of struct vfio_device_feature_dma_buf?\n\nYou might have to show me with code what you're talking about because I\ncan't see any way we can add fields to any struct here without breaking\nbackward compatibility.\n\nIf we can't claim bits out of the unused \"flags\" field for this feature,\nthen my initial reply is the only sane approach: we can introduce a new\nfeature and struct for it that closely mirrors the existing one, but\nwith the extra hint fields.","headers":{"Return-Path":"\n <linux-pci+bounces-51624-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=Q3/LFlfZ;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-51624-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"Q3/LFlfZ\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fldwZ0d9Zz1yFv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 06:49:02 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id A609D30EAD4B\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 19:44:12 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 736A73E317F;\n\tTue, 31 Mar 2026 19:44:05 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 5080D3A75A8;\n\tTue, 31 Mar 2026 19:44:05 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id B3F5EC2BCB2;\n\tTue, 31 Mar 2026 19:44:04 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774986245; cv=none;\n b=VOxIcjkU0eba2qskcSrnNd4D1UBrPA6rjfU4h76bZRMxKM2dKPAzFkwP9w+OPAzJeRxGUfQacNRbw5MTVoF9GJ44SR7yVxPjj+jW4CYNgR9sNHr49kM6MH0ZSkhNgJCYK1WeOfKZcHgq2iy8AkBfNY9IzH6tZyDnh85+nPaAGlA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774986245; c=relaxed/simple;\n\tbh=jGGUJKYrNdV8MrZToA2w5hj3QV82YHccM4CmlfqrLZI=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=hjodHXR8mOEzrzyR8QXkdBauEsq1LG3GOZdeFkQKcRb3eG+WiMOAof10RhEplvGOA0RTHZf0E7olkmdQ155jSoAHEg9IZHmsoLn7ycJCAfu2HyalSRglSO2nqZ6O5qlSYJQpgHfEsr/x3cOrC2cDFk75HHqjy+sco5q9EZd5bOk=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=Q3/LFlfZ; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774986245;\n\tbh=jGGUJKYrNdV8MrZToA2w5hj3QV82YHccM4CmlfqrLZI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Q3/LFlfZuSyNzsTx+6YfPrMA8hjusRnQdSbDNm1uLtyw2tdOl0S/wuHE+sPFUrKHx\n\t vBNdpyBqm5EjQXRbJgCLoKwCwUAA15df0M2MJ4HLq0fsV83v8LW5RC2oDT7aAA8UJX\n\t 8bwdTpDVolQoPS0sF48lnz0DXH2mUiVAMxuLpmkeg+L/uviUi4p2NGmHjqjTk1cKzT\n\t bHeWYYJNPnXHa7hhXi9pjF0M2I52ntniXF0Q2sYFxQHqZxfNtd+0ftCaxZ222xj++W\n\t XZDKarZ7rwu30MFv95BHt8xBnzedg3sCeHRf8SxbEAoBXu9PHr+rCW/ubZAfxD4z+g\n\t 4RbgcSXcTlBRA==","Date":"Tue, 31 Mar 2026 13:44:02 -0600","From":"Keith Busch <kbusch@kernel.org>","To":"Leon Romanovsky <leon@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<acwkAo2k41xaxdTS@kbusch-mbp>","References":"<20260324234615.3731237-2-zhipingz@meta.com>\n <20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>\n <acvFV8c5QVxnt3Em@kbusch-mbp>\n <20260331132942.GC814676@unreal>\n <acvNsvS5ShlQlrox@kbusch-mbp>\n <20260331140309.GH814676@unreal>\n <acvWplw67b3Gwlkc@kbusch-mbp>\n <20260331190220.GI814676@unreal>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260331190220.GI814676@unreal>"}},{"id":3675271,"web_url":"http://patchwork.ozlabs.org/comment/3675271/","msgid":"<20260409120415.GF86584@unreal>","list_archive_url":null,"date":"2026-04-09T12:04:15","subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","submitter":{"id":68852,"url":"http://patchwork.ozlabs.org/api/people/68852/","name":"Leon Romanovsky","email":"leon@kernel.org"},"content":"On Tue, Mar 31, 2026 at 01:44:02PM -0600, Keith Busch wrote:\n> On Tue, Mar 31, 2026 at 10:02:20PM +0300, Leon Romanovsky wrote:\n> > \n> > Right, what about adding TPH fields to struct vfio_region_dma_range\n> > instead of struct vfio_device_feature_dma_buf?\n> \n> You might have to show me with code what you're talking about because I\n> can't see any way we can add fields to any struct here without breaking\n> backward compatibility.\n> \n> If we can't claim bits out of the unused \"flags\" field for this feature,\n> then my initial reply is the only sane approach: we can introduce a new\n> feature and struct for it that closely mirrors the existing one, but\n> with the extra hint fields.\n\nSomething like that, on top of this proposal:\n\ndiff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c\nindex 3961afa640391..70d5ee1e3ef7b 100644\n--- a/drivers/vfio/pci/vfio_pci_dmabuf.c\n+++ b/drivers/vfio/pci/vfio_pci_dmabuf.c\n@@ -241,9 +241,7 @@ int vfio_pci_core_feature_dma_buf(struct vfio_pci_core_device *vdev, u32 flags,\n \t\treturn -EFAULT;\n \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    (get_dma_buf.flags & ~VFIO_DMABUF_FLAG_TPH))\n \t\treturn -EINVAL;\n \n \t/*\n@@ -300,13 +298,10 @@ 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-\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+\tif (get_dma_buf.flags & VFIO_DMABUF_FLAG_TPH) {\n+\t\tpriv->steering_tag =\n+\t\t\tdma_ranges[get_dma_buf.nr_ranges + 1].tph.tag;\n+\t\tpriv->ph = dma_ranges[get_dma_buf.nr_ranges + 1].tph.ph;\n \t}\n \t/* dma_buf_put() now frees priv */\n \tINIT_LIST_HEAD(&priv->dmabufs_elm);\ndiff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h\nindex e2a8962641d2c..a8b8d8b1a3278 100644\n--- a/include/uapi/linux/vfio.h\n+++ b/include/uapi/linux/vfio.h\n@@ -1497,20 +1497,30 @@ struct vfio_device_feature_bus_master {\n  */\n #define VFIO_DEVICE_FEATURE_DMA_BUF 11\n \n+struct vfio_region_dma_tph {\n+\tu16 tag;\n+\tu8 ph;\n+};\n+\n struct vfio_region_dma_range {\n-\t__u64 offset;\n-\t__u64 length;\n+\tunion {\n+\t\t__u64 offset;\n+\t\tstruct vfio_region_dma_tph tph;\n+\t};\n+\tunion {\n+\t\t__u64 length;\n+\t\t__u64 reserved;\n+\t};\n+};\n+\n+enum {\n+\tVFIO_DMABUF_FLAG_TPH = 1 << 0,\n };\n \n struct vfio_device_feature_dma_buf {\n \t__u32\tregion_index;\n \t__u32\topen_flags;\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 };","headers":{"Return-Path":"\n <linux-pci+bounces-52211-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=ZfPMl7+i;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52211-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"ZfPMl7+i\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frzBM0tFGz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 22:04:27 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id E9AF0300EF4C\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  9 Apr 2026 12:04:23 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4FC7D37FF65;\n\tThu,  9 Apr 2026 12:04:23 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 2A8B73033CB;\n\tThu,  9 Apr 2026 12:04:22 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 4EA7BC2BC9E;\n\tThu,  9 Apr 2026 12:04:22 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775736263; cv=none;\n b=G62KME2NurEjYY1Jvc9B0PAkr1aJNaOqpnYqHXn9vHC4xniQ9kg7HLbgJkgYusmkHbZp3qvCvu/MzwD1Wtd5UW6/OtGG9ABQKUyAygRWFEzoGDyq2emJn2OsT/nbvWQGc8cgCrb0MMJZDYHxIr1IlliSlO5GoZavwXH0MFQqbps=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775736263; c=relaxed/simple;\n\tbh=G/ay3tEaFHjwK7ia51ZNouAZfQhcoggXMm0N8BsIcwU=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=ZYTw9N29Zl+K3iUGXL0ag2j6eFGOuXrbCiNI2cwWFrqFUD1q3dbxPUdt1ZtOAhKbpxxaIj1u8bvDN7AsMFN/Ea7122P2SrB3QcdfKFR4AKpIb3qgP96prnLztEZ+sKB4z2/xQ1n+1lW2nFmka8ga4B2G+yxC0W6qI3Ob111DYdo=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=ZfPMl7+i; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775736262;\n\tbh=G/ay3tEaFHjwK7ia51ZNouAZfQhcoggXMm0N8BsIcwU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZfPMl7+iL3vOhEXSU+Aq9hVIsplbGHKLlwtR/ABoHcMLvMGWw0874KFC9D5E9LSys\n\t lsLrOwbum6ynlKAR+KkIWnePLFrG5xO8yJ6I7eP/AoeNKOz/K3QKxQ5vZTOuejmY+2\n\t yKCk4Jl52X4QD4S+WPKCWyWqZUlemWl8/oQRfeqG6feHLK11KB+WCZbhzfHM9zUtbJ\n\t OLRm8NsBrliLji9tDVcMftFeGU06pb63Uemi5Jk2/OGN7PjdzwNZjF9FsSpvwjXasG\n\t hOo3pBbjX4oP/wvBvGCOQgPR6+Tu1s1xeAepm7KHx3adpZ6uoOk9VdGQ7BLSDGlUku\n\t QSQ4xu30TdMew==","Date":"Thu, 9 Apr 2026 15:04:15 +0300","From":"Leon Romanovsky <leon@kernel.org>","To":"Keith Busch <kbusch@kernel.org>","Cc":"Zhiping Zhang <zhipingz@meta.com>, Jason Gunthorpe <jgg@ziepe.ca>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-rdma@vger.kernel.org,\n\tlinux-pci@vger.kernel.org, netdev@vger.kernel.org,\n\tdri-devel@lists.freedesktop.org, Yochai Cohen <yochai@nvidia.com>,\n\tYishai Hadas <yishaih@nvidia.com>,\n\tBjorn Helgaas <helgaas@kernel.org>","Subject":"Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf","Message-ID":"<20260409120415.GF86584@unreal>","References":"<20260325082534.GN814676@unreal>\n <acW2BwQKaUbS3eL9@kbusch-mbp>\n <20260331083758.GA814676@unreal>\n <acvFV8c5QVxnt3Em@kbusch-mbp>\n <20260331132942.GC814676@unreal>\n <acvNsvS5ShlQlrox@kbusch-mbp>\n <20260331140309.GH814676@unreal>\n <acvWplw67b3Gwlkc@kbusch-mbp>\n <20260331190220.GI814676@unreal>\n <acwkAo2k41xaxdTS@kbusch-mbp>","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-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<acwkAo2k41xaxdTS@kbusch-mbp>"}}]