public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Chengwen Feng <fengchengwen@huawei.com>
Cc: alex@shazbot.org, jgg@ziepe.ca, wathsala.vithanage@arm.com,
	wangzhou1@hisilicon.com, wangyushan12@huawei.com,
	liuyonglong@huawei.com, kvm@vger.kernel.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 RESEND 1/5] pci/tph: Export pcie_tph_get_st_modes() for external use
Date: Thu, 16 Apr 2026 15:49:48 -0500	[thread overview]
Message-ID: <20260416204948.GA35511@bhelgaas> (raw)
In-Reply-To: <20260416093041.42070-2-fengchengwen@huawei.com>

On Thu, Apr 16, 2026 at 05:30:37PM +0800, Chengwen Feng wrote:
> Export the helper to retrieve supported PCIe TPH steering tag modes so
> that drivers like VFIO can query and expose device capabilities to
> userspace.
> 
> And also add pcie_tph_get_st_table_size() and
> pcie_tph_get_st_table_loc() stub implementation in the !CONFIG_PCI_TPH
> case.
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>

Update subject to "PCI/TPH: Export ..." to match history.

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

I notice commit logs of other patches could be rewrapped to fill 75
columns.

> ---
>  drivers/pci/tph.c       | 13 +++++++++++--
>  include/linux/pci-tph.h |  7 +++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
> index 91145e8d9d95..f8767bf6fee9 100644
> --- a/drivers/pci/tph.c
> +++ b/drivers/pci/tph.c
> @@ -145,7 +145,15 @@ static void set_ctrl_reg_req_en(struct pci_dev *pdev, u8 req_type)
>  	pci_write_config_dword(pdev, pdev->tph_cap + PCI_TPH_CTRL, reg);
>  }
>  
> -static u8 get_st_modes(struct pci_dev *pdev)
> +/**
> + * pcie_tph_get_st_modes - Get supported Steering Tag modes
> + * @pdev: PCI device to query
> + *
> + * Return:
> + *  Bitmask of supported ST modes (PCI_TPH_CAP_ST_NS, PCI_TPH_CAP_ST_IV,
> + *                                 PCI_TPH_CAP_ST_DS)
> + */
> +u8 pcie_tph_get_st_modes(struct pci_dev *pdev)
>  {
>  	u32 reg;
>  
> @@ -154,6 +162,7 @@ static u8 get_st_modes(struct pci_dev *pdev)
>  
>  	return reg;
>  }
> +EXPORT_SYMBOL(pcie_tph_get_st_modes);
>  
>  /**
>   * pcie_tph_get_st_table_loc - Return the device's ST table location
> @@ -400,7 +409,7 @@ int pcie_enable_tph(struct pci_dev *pdev, int mode)
>  
>  	/* Sanitize and check ST mode compatibility */
>  	mode &= PCI_TPH_CTRL_MODE_SEL_MASK;
> -	dev_modes = get_st_modes(pdev);
> +	dev_modes = pcie_tph_get_st_modes(pdev);
>  	if (!((1 << mode) & dev_modes))
>  		return -EINVAL;
>  
> diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h
> index be68cd17f2f8..586c75b19e01 100644
> --- a/include/linux/pci-tph.h
> +++ b/include/linux/pci-tph.h
> @@ -30,6 +30,7 @@ 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_get_st_modes(struct pci_dev *pdev);
>  #else
>  static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
>  					unsigned int index, u16 tag)
> @@ -41,6 +42,12 @@ 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 u16 pcie_tph_get_st_table_size(struct pci_dev *pdev)
> +{ return 0; }
> +static inline u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
> +{ return 0x7FF; /* Values that do not appear in normal case */ }
> +static inline u8 pcie_tph_get_st_modes(struct pci_dev *pdev)
> +{ return 0; }
>  #endif
>  
>  #endif /* LINUX_PCI_TPH_H */
> -- 
> 2.17.1
> 

  reply	other threads:[~2026-04-16 20:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  9:30 [PATCH v2 RESEND 0/5] vfio/pci: Add PCIe TPH support Chengwen Feng
2026-04-16  9:30 ` [PATCH v2 RESEND 1/5] pci/tph: Export pcie_tph_get_st_modes() for external use Chengwen Feng
2026-04-16 20:49   ` Bjorn Helgaas [this message]
2026-04-17  2:50     ` fengchengwen
2026-04-16  9:30 ` [PATCH v2 RESEND 2/5] vfio/pci: Add PCIe TPH interface with capability query Chengwen Feng
2026-04-16  9:30 ` [PATCH v2 RESEND 3/5] vfio/pci: Add PCIe TPH enable/disable support Chengwen Feng
2026-04-16  9:30 ` [PATCH v2 RESEND 4/5] vfio/pci: Add PCIe TPH GET_ST interface Chengwen Feng
2026-04-16  9:30 ` [PATCH v2 RESEND 5/5] vfio/pci: Add PCIe TPH SET_ST interface Chengwen Feng

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=20260416204948.GA35511@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alex@shazbot.org \
    --cc=fengchengwen@huawei.com \
    --cc=jgg@ziepe.ca \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=wangyushan12@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=wathsala.vithanage@arm.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