From: sashiko-bot@kernel.org
To: "Zhiping Zhang" <zhipingz@meta.com>
Cc: linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org,
kvm@vger.kernel.org
Subject: Re: [PATCH v10 2/4] dma-buf: add optional get_pci_tph() callback
Date: Tue, 30 Jun 2026 23:01:28 +0000 [thread overview]
Message-ID: <20260630230129.63ED71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630224328.3218796-3-zhipingz@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The newly added dma-buf API `dma_buf_get_pci_tph()` and its corresponding `get_pci_tph` callback are missing from the centralized dma-buf locking convention documentation.
--
commit aa25de1b77cd2b1778e96e6bffe1b1b6ce39fd9c
Author: Zhiping Zhang <zhipingz@meta.com>
dma-buf: add optional get_pci_tph() callback
This commit adds an optional get_pci_tph callback to dma_buf_ops and a
corresponding wrapper function dma_buf_get_pci_tph() for importers. These
allow importers to retrieve PCIe TLP Processing Hint (TPH) metadata for
peer-to-peer DMA. Both the callback and the wrapper require the dma-buf
reservation lock to be held.
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index d504c636dc294..7a4c9b0d5dab4 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
[ ... ]
> @@ -1144,6 +1144,31 @@ void dma_buf_unpin(struct dma_buf_attachment *attach)
> }
> EXPORT_SYMBOL_NS_GPL(dma_buf_unpin, "DMA_BUF");
>
> +/**
> + * dma_buf_get_pci_tph - Retrieve PCIe TLP Processing Hint (TPH) metadata
> + * @dmabuf: DMA buffer to query
> + * @extended: false for 8-bit ST, true for 16-bit Extended ST
> + * @steering_tag: returns the raw steering tag for the requested namespace
> + * @ph: returns the TPH processing hint
> + *
> + * Wrapper for the optional &dma_buf_ops.get_pci_tph callback.
> + *
> + * Must be called with &dma_buf.resv held. Returns -EOPNOTSUPP if the
> + * exporter does not implement the callback or has no metadata for the
> + * requested namespace.
> + */
> +int dma_buf_get_pci_tph(struct dma_buf *dmabuf, bool extended,
> + u16 *steering_tag, u8 *ph)
> +{
> + dma_resv_assert_held(dmabuf->resv);
[Severity: Low]
This isn't a bug, but should dma_buf_get_pci_tph() be added to the list of
functions in the "DOC: locking convention" block earlier in this file?
The centralized documentation block serves as a single source of truth for
importers by listing all functions that require the dma-buf reservation lock,
such as dma_buf_pin() and dma_buf_vmap(). Adding this new function to that
list would help keep the locking documentation complete.
> +
> + if (!dmabuf->ops->get_pci_tph)
> + return -EOPNOTSUPP;
> +
> + return dmabuf->ops->get_pci_tph(dmabuf, extended, steering_tag, ph);
> +}
> +EXPORT_SYMBOL_NS_GPL(dma_buf_get_pci_tph, "DMA_BUF");
[ ... ]
> diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
> index d1203da56fc5f..53b2686ad8fc6 100644
> --- a/include/linux/dma-buf.h
> +++ b/include/linux/dma-buf.h
[ ... ]
> @@ -113,6 +113,26 @@ struct dma_buf_ops {
> */
> void (*unpin)(struct dma_buf_attachment *attach);
>
> + /**
> + * @get_pci_tph:
> + *
> + * Retrieve PCIe TLP Processing Hint (TPH) steering metadata for
> + * this buffer so an importer can program a matching ST/PH hint on
> + * outbound TLPs targeting the exporter for peer-to-peer DMA.
> + *
> + * @dmabuf: DMA buffer for which to retrieve TPH metadata
> + * @extended: false for 8-bit ST, true for 16-bit Extended ST
> + * @steering_tag: Returns the raw TPH steering tag for the requested
> + * namespace
> + * @ph: Returns the TPH processing hint (2-bit value)
> + *
> + * Optional callback for dma_buf_get_pci_tph(). Called with
> + * &dma_buf.resv held. Returns 0 on success or -EOPNOTSUPP when
> + * the exporter has no metadata for the requested namespace.
> + */
> + int (*get_pci_tph)(struct dma_buf *dmabuf, bool extended,
> + u16 *steering_tag, u8 *ph);
[Severity: Low]
Similarly, should &dma_buf_ops.get_pci_tph() be appended to the list of
callbacks in the same "DOC: locking convention" block?
The existing documentation explicitly calls out exporter callbacks that are
invoked with the locked dma-buf reservation, so updating it here would keep
the locking contract documentation consistent.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630224328.3218796-1-zhipingz@meta.com?part=2
next prev parent reply other threads:[~2026-06-30 23:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 22:42 [PATCH v10 0/4] vfio/dma-buf: add TPH support for peer-to-peer access Zhiping Zhang
2026-06-30 22:42 ` [PATCH v10 1/4] PCI/TPH: Add requester/completer type helpers Zhiping Zhang
2026-06-30 23:07 ` sashiko-bot
2026-06-30 22:42 ` [PATCH v10 2/4] dma-buf: add optional get_pci_tph() callback Zhiping Zhang
2026-06-30 23:01 ` sashiko-bot [this message]
2026-07-01 8:25 ` Christian König
2026-07-01 17:53 ` Zhiping Zhang
2026-07-02 7:06 ` Christian König
2026-06-30 22:42 ` [PATCH v10 3/4] vfio/pci: implement get_pci_tph and DMA_BUF_TPH feature Zhiping Zhang
2026-06-30 23:08 ` sashiko-bot
2026-07-01 18:07 ` Alex Williamson
2026-07-01 21:07 ` Zhiping Zhang
2026-06-30 22:42 ` [PATCH v10 4/4] RDMA/mlx5: get tph for p2p access when registering dma-buf mr Zhiping Zhang
2026-06-30 23:11 ` sashiko-bot
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=20260630230129.63ED71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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.