From: Alex Williamson <alex@shazbot.org>
To: Zhiping Zhang <zhipingz@meta.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
Sumit Semwal <sumit.semwal@linaro.org>,
Christian Konig <christian.koenig@amd.com>,
Bjorn Helgaas <helgaas@kernel.org>, <kvm@vger.kernel.org>,
<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>,
alex@shazbot.org
Subject: Re: [PATCH v5 2/4] dma-buf: add optional get_tph() callback
Date: Wed, 27 May 2026 11:03:40 -0600 [thread overview]
Message-ID: <20260527110340.5547dd30@shazbot.org> (raw)
In-Reply-To: <20260526144401.1485788-3-zhipingz@meta.com>
On Tue, 26 May 2026 07:43:54 -0700
Zhiping Zhang <zhipingz@meta.com> wrote:
> Add an optional dma-buf get_tph callback so an exporter can return TPH
> (TLP Processing Hints) metadata to an importer.
>
> 8-bit ST and 16-bit Extended ST are distinct namespaces in the PCIe TPH
> ST table and may both be present with different values. The importer
> passes its supported steering-tag width and the exporter returns the
> matching value, or -EOPNOTSUPP if no metadata is available for that
> width.
>
> The first user is VFIO_DEVICE_FEATURE_DMA_BUF_TPH in vfio-pci, with the
> mlx5 RDMA driver as the first importer.
>
> Signed-off-by: Zhiping Zhang <zhipingz@meta.com>
> ---
> include/linux/dma-buf.h | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
> index d1203da56fc5..49eb6ad644a2 100644
> --- a/include/linux/dma-buf.h
> +++ b/include/linux/dma-buf.h
> @@ -113,6 +113,27 @@ struct dma_buf_ops {
> */
> void (*unpin)(struct dma_buf_attachment *attach);
>
> + /**
> + * @get_tph:
> + * @dmabuf: DMA buffer for which to retrieve TPH metadata
> + * @steering_tag: Returns the raw TPH steering tag for @st_width
> + * @ph: Returns the TPH processing hint (2-bit value)
> + * @st_width: Consumer's supported steering tag width in bits (8 or 16)
> + *
> + * Return the TPH (TLP Processing Hints) metadata associated with this
> + * DMA buffer for the requested steering-tag width. 8-bit ST and 16-bit
> + * Extended ST are distinct namespaces in the PCIe TPH ST table and may
> + * both be present with different values, so the exporter must select the
> + * value that matches @st_width and must not substitute one for the other.
> + *
> + * Return 0 on success, -EOPNOTSUPP if no metadata is available for the
> + * requested width, or -EINVAL if @st_width is not 8 or 16.
> + *
> + * This callback is optional.
> + */
> + int (*get_tph)(struct dma_buf *dmabuf, u16 *steering_tag, u8 *ph,
> + u8 st_width);
Why not make this `bool extended` rather than `u8 st_width` to avoid
the entire class of errors involving an invalid width? Thanks,
Alex
next prev parent reply other threads:[~2026-05-27 17:03 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 14:43 [PATCH v5 0/4] vfio/dma-buf: add TPH support for peer-to-peer access Zhiping Zhang
2026-05-26 14:43 ` [PATCH v5 1/4] PCI/TPH: expose the enabled TPH requester type Zhiping Zhang
2026-05-27 20:53 ` Alex Williamson
2026-05-28 5:35 ` Zhiping Zhang
2026-05-28 8:04 ` fengchengwen
2026-05-29 6:41 ` Zhiping Zhang
2026-05-26 14:43 ` [PATCH v5 2/4] dma-buf: add optional get_tph() callback Zhiping Zhang
2026-05-27 6:57 ` Christian König
2026-05-27 17:03 ` Alex Williamson [this message]
2026-05-26 14:43 ` [PATCH v5 3/4] vfio/pci: implement get_tph and DMA_BUF_TPH feature Zhiping Zhang
2026-05-27 18:06 ` Alex Williamson
2026-05-28 5:34 ` Zhiping Zhang
2026-05-26 14:43 ` [PATCH v5 4/4] RDMA/mlx5: get tph for p2p access when registering dma-buf mr Zhiping Zhang
2026-05-27 19:00 ` Alex Williamson
2026-05-28 5:54 ` Zhiping Zhang
2026-05-27 22:55 ` Michael Gur
2026-05-28 6:07 ` Zhiping Zhang
2026-05-27 6:55 ` [PATCH v5 0/4] vfio/dma-buf: add TPH support for peer-to-peer access Christian König
2026-05-27 12:14 ` Jason Gunthorpe
2026-05-27 12:23 ` Christian König
2026-05-27 12:36 ` Jason Gunthorpe
2026-05-27 12:53 ` Christian König
2026-05-28 4:55 ` Zhiping Zhang
2026-05-28 7:46 ` Christian König
2026-05-29 6:34 ` Zhiping Zhang
2026-05-29 7:36 ` Christian König
2026-05-29 20:11 ` Jason Gunthorpe
2026-06-01 9:59 ` Christian König
2026-06-01 17:47 ` Jason Gunthorpe
2026-06-01 18:17 ` Christian König
2026-06-01 18:48 ` Jason Gunthorpe
2026-06-02 7:14 ` Zhiping Zhang
2026-05-29 20:31 ` Keith Busch
2026-06-01 10:03 ` Christian König
2026-06-01 17:50 ` Jason Gunthorpe
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=20260527110340.5547dd30@shazbot.org \
--to=alex@shazbot.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=helgaas@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kbusch@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sumit.semwal@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.