From: Leon Romanovsky <leon@kernel.org>
To: Zhiping Zhang <zhipingz@meta.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-rdma@vger.kernel.org, linux-pci@vger.kernel.org,
netdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
Keith Busch <kbusch@kernel.org>, Yochai Cohen <yochai@nvidia.com>,
Yishai Hadas <yishaih@nvidia.com>,
Bjorn Helgaas <helgaas@kernel.org>
Subject: Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf
Date: Wed, 25 Mar 2026 10:25:34 +0200 [thread overview]
Message-ID: <20260325082534.GN814676@unreal> (raw)
In-Reply-To: <20260324234615.3731237-2-zhipingz@meta.com>
On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote:
> This patch adds a callback to get the tph info on DMA buffer exporters.
> The tph info includes both the steering tag and the process hint (ph).
>
> The steering tag and ph are encoded in the flags field of
> vfio_device_feature_dma_buf instead of adding new fields to the uapi
> struct, to preserve ABI compatibility.
>
> Signed-off-by: Zhiping Zhang <zhipingz@meta.com>
> ---
> drivers/vfio/pci/vfio_pci_dmabuf.c | 26 ++++++++++++++++++++++++--
> include/linux/dma-buf.h | 30 ++++++++++++++++++++++++++++++
> include/uapi/linux/vfio.h | 9 +++++++--
> 3 files changed, 61 insertions(+), 4 deletions(-)
<...>
> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> index bb7b89330d35..e2a8962641d2 100644
> --- a/include/uapi/linux/vfio.h
> +++ b/include/uapi/linux/vfio.h
> @@ -1505,8 +1505,13 @@ struct vfio_region_dma_range {
> struct vfio_device_feature_dma_buf {
> __u32 region_index;
> __u32 open_flags;
> - __u32 flags;
> - __u32 nr_ranges;
> + __u32 flags;
> +#define VFIO_DMABUF_FL_TPH (1U << 0) /* TPH info is present */
> +#define VFIO_DMABUF_TPH_PH_SHIFT 1 /* bits 1-2: PH (2-bit) */
> +#define VFIO_DMABUF_TPH_PH_MASK 0x6U
> +#define VFIO_DMABUF_TPH_ST_SHIFT 16 /* bits 16-31: steering tag */
> +#define VFIO_DMABUF_TPH_ST_MASK 0xffff0000U
This extension of flags is basically kills future extension of this
struct for anything that includes TPH.
Add new
enum vfio_device_feature_dma_buf_flags {
VFIO_DMABUF_FL_TPH = 1 << 0
}
> + __u32 nr_ranges;
add your "__u16 steering_tag" and "__u8 ph" fields here.
> struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);
> };
>
> --
> 2.52.0
>
>
parent reply other threads:[~2026-03-25 8:49 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20260324234615.3731237-2-zhipingz@meta.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260325082534.GN814676@unreal \
--to=leon@kernel.org \
--cc=bhelgaas@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=helgaas@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kbusch@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yishaih@nvidia.com \
--cc=yochai@nvidia.com \
--cc=zhipingz@meta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox