Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zhiping Zhang" <zhipingz@meta.com>
Cc: kvm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v9 2/4] dma-buf: add optional get_pci_tph() callback
Date: Mon, 22 Jun 2026 18:59:58 +0000	[thread overview]
Message-ID: <20260622185958.7EB711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622184211.2229399-3-zhipingz@meta.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The centralized DMA-BUF locking conventions documentation was not updated for the new `get_pci_tph` API.
--

commit 558f8ccf1c7e2c892ffa9049e917832eaa82ea77
Author: Zhiping Zhang <zhipingz@meta.com>

dma-buf: add optional get_pci_tph() callback

This commit introduces an optional get_pci_tph callback in dma_buf_ops and a
wrapper function dma_buf_get_pci_tph() to retrieve PCIe TLP Processing Hints.
This allows importers to request TPH namespaces that exporters can emit.
The wrapper function requires 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]
Since this wrapper and the new get_pci_tph() callback require the dma-buf
reservation lock to be held, should they be added to the centralized
"DOC: locking convention" list in drivers/dma-buf/dma-buf.c? The documentation
under "Convention for importers" and "Convention for exporters" lists other
functions that require this lock, but the new get_pci_tph API was omitted.

> +
> +	if (!dmabuf->ops->get_pci_tph)
> +		return -EOPNOTSUPP;
> +
> +	return dmabuf->ops->get_pci_tph(dmabuf, extended, steering_tag, ph);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260622184211.2229399-1-zhipingz@meta.com?part=2

  reply	other threads:[~2026-06-22 18:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 18:41 [PATCH v9 0/4] vfio/dma-buf: add TPH support for peer-to-peer access Zhiping Zhang
2026-06-22 18:41 ` [PATCH v9 1/4] PCI/TPH: Add requester/completer type helpers Zhiping Zhang
2026-06-22 19:04   ` sashiko-bot
2026-06-22 18:41 ` [PATCH v9 2/4] dma-buf: add optional get_pci_tph() callback Zhiping Zhang
2026-06-22 18:59   ` sashiko-bot [this message]
2026-06-22 18:41 ` [PATCH v9 3/4] vfio/pci: implement get_pci_tph and DMA_BUF_TPH feature Zhiping Zhang
2026-06-22 19:06   ` sashiko-bot
2026-06-22 18:41 ` [PATCH v9 4/4] RDMA/mlx5: get tph for p2p access when registering dma-buf mr Zhiping Zhang
2026-06-22 19:09   ` 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=20260622185958.7EB711F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox