All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Zhiping Zhang <zhipingz@meta.com>
Cc: Alex Williamson <alex@shazbot.org>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Christian Konig <christian.koenig@amd.com>,
	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>
Subject: Re: [PATCH v6 2/5] PCI/TPH: expose enabled requester type and capability helpers
Date: Tue, 9 Jun 2026 14:56:12 -0500	[thread overview]
Message-ID: <20260609195612.GA85322@bhelgaas> (raw)
In-Reply-To: <20260608185646.4085127-3-zhipingz@meta.com>

On Mon, Jun 08, 2026 at 11:56:39AM -0700, Zhiping Zhang wrote:
> Add pcie_tph_enabled_req_type() so drivers can query the enabled TPH
> requester mode without reaching into pci_dev internals, and
> pcie_tph_supported() so they can test whether the device exposes the
> PCIe TPH Extended Capability without doing the same.

s/exposes/advertises/

> This keeps pci_dev::tph_req_type and pci_dev::tph_cap inside the
> PCI/TPH code and provides !CONFIG_PCIE_TPH stubs for callers.

Update subject line to match capitalization of history
(use "git log --oneline drivers/pci/tph.c")

s/expose/Add/ in subject.

("Expose" suggests that the interfaces already exist and we're just
exporting them, but these interfaces didn't exist at all before.)

> Signed-off-by: Zhiping Zhang <zhipingz@meta.com>

With the above,

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/pci/tph.c       | 25 +++++++++++++++++++++++++
>  include/linux/pci-tph.h |  7 +++++++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
> index 91145e8d9d95..aa09113c46d4 100644
> --- a/drivers/pci/tph.c
> +++ b/drivers/pci/tph.c
> @@ -174,6 +174,31 @@ u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
>  }
>  EXPORT_SYMBOL(pcie_tph_get_st_table_loc);
>  
> +/**
> + * pcie_tph_enabled_req_type - Return the device's enabled TPH requester type
> + * @pdev: PCI device to query
> + *
> + * Return: PCI_TPH_REQ_DISABLE, PCI_TPH_REQ_TPH_ONLY or PCI_TPH_REQ_EXT_TPH.
> + */
> +u8 pcie_tph_enabled_req_type(struct pci_dev *pdev)
> +{
> +	return pdev->tph_req_type;
> +}
> +EXPORT_SYMBOL(pcie_tph_enabled_req_type);
> +
> +/**
> + * pcie_tph_supported - Whether the device advertises the TPH Extended Cap
> + * @pdev: PCI device to query
> + *
> + * Return: true when the device exposes the PCIe TPH Extended Capability,
> + * false otherwise.
> + */
> +bool pcie_tph_supported(struct pci_dev *pdev)
> +{
> +	return pdev->tph_cap != 0;
> +}
> +EXPORT_SYMBOL(pcie_tph_supported);
> +
>  /*
>   * Return the size of ST table. If ST table is not in TPH Requester Extended
>   * Capability space, return 0. Otherwise return the ST Table Size + 1.
> diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h
> index be68cd17f2f8..2e07bce77038 100644
> --- a/include/linux/pci-tph.h
> +++ b/include/linux/pci-tph.h
> @@ -9,6 +9,8 @@
>  #ifndef LINUX_PCI_TPH_H
>  #define LINUX_PCI_TPH_H
>  
> +#include <linux/pci_regs.h>
> +
>  /*
>   * According to the ECN for PCI Firmware Spec, Steering Tag can be different
>   * depending on the memory type: Volatile Memory or Persistent Memory. When a
> @@ -30,6 +32,8 @@ void pcie_disable_tph(struct pci_dev *pdev);
>  int pcie_enable_tph(struct pci_dev *pdev, int mode);
>  u16 pcie_tph_get_st_table_size(struct pci_dev *pdev);
>  u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
> +u8 pcie_tph_enabled_req_type(struct pci_dev *pdev);
> +bool pcie_tph_supported(struct pci_dev *pdev);
>  #else
>  static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
>  					unsigned int index, u16 tag)
> @@ -41,6 +45,9 @@ static inline int pcie_tph_get_cpu_st(struct pci_dev *dev,
>  static inline void pcie_disable_tph(struct pci_dev *pdev) { }
>  static inline int pcie_enable_tph(struct pci_dev *pdev, int mode)
>  { return -EINVAL; }
> +static inline u8 pcie_tph_enabled_req_type(struct pci_dev *pdev)
> +{ return PCI_TPH_REQ_DISABLE; }
> +static inline bool pcie_tph_supported(struct pci_dev *pdev) { return false; }
>  #endif
>  
>  #endif /* LINUX_PCI_TPH_H */
> -- 
> 2.53.0-Meta
> 

  reply	other threads:[~2026-06-09 19:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 18:56 [PATCH v6 0/5] vfio/dma-buf: add TPH support for peer-to-peer access Zhiping Zhang
2026-06-08 18:56 ` [PATCH v6 1/5] net/mlx5: free mlx5_st_idx_data on final dealloc Zhiping Zhang
2026-06-08 18:56 ` [PATCH v6 2/5] PCI/TPH: expose enabled requester type and capability helpers Zhiping Zhang
2026-06-09 19:56   ` Bjorn Helgaas [this message]
2026-06-09 23:38     ` Zhiping Zhang
2026-06-08 18:56 ` [PATCH v6 3/5] dma-buf: add optional get_tph() callback Zhiping Zhang
2026-06-09  8:10   ` Christian König
2026-06-09 14:38     ` Zhiping Zhang
2026-06-09 19:38   ` sashiko-bot
2026-06-08 18:56 ` [PATCH v6 4/5] vfio/pci: implement get_tph and DMA_BUF_TPH feature Zhiping Zhang
2026-06-09  8:12   ` Christian König
2026-06-09 14:39     ` Zhiping Zhang
2026-06-09 19:38   ` sashiko-bot
2026-06-09 21:46   ` Alex Williamson
2026-06-09 23:48     ` Zhiping Zhang
2026-06-08 18:56 ` [PATCH v6 5/5] RDMA/mlx5: get tph for p2p access when registering dma-buf mr Zhiping Zhang
2026-06-09 19:38   ` 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=20260609195612.GA85322@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alex@shazbot.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.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.