Linux-PCI Archive mirror
 help / color / mirror / Atom feed
From: Aksh Garg <a-garg7@ti.com>
To: Hans Zhang <18255117159@163.com>, <bhelgaas@google.com>,
	<lpieralisi@kernel.org>, <kwilczynski@kernel.org>,
	<mani@kernel.org>
Cc: <robh@kernel.org>, <mpillai@cadence.com>, <s-vadapalli@ti.com>,
	<linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 2/3] PCI: cadence: Add HPA IP debugfs for LTSSM status
Date: Wed, 20 May 2026 12:56:17 +0530	[thread overview]
Message-ID: <d9d4aa30-8d30-4025-abde-0325e102fd8d@ti.com> (raw)
In-Reply-To: <20260519123609.1595280-3-18255117159@163.com>



On 19/05/26 18:06, Hans Zhang wrote:
> Add debugfs support for HPA-based Cadence PCIe controllers. A new file
> 'ltssm_status' is created under debugfs, allowing users to read the
> current LTSSM state as a string and raw value.
> 
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
>   Documentation/ABI/testing/debugfs-cdns-pcie   |   5 +
>   drivers/pci/controller/cadence/Kconfig        |   9 +
>   drivers/pci/controller/cadence/Makefile       |   1 +
>   drivers/pci/controller/cadence/pci-sky1.c     |   4 +
>   .../controller/cadence/pcie-cadence-debugfs.c | 208 ++++++++++++++++++
>   .../cadence/pcie-cadence-host-hpa.c           |  19 +-
>   drivers/pci/controller/cadence/pcie-cadence.h | 153 +++++++++++++
>   7 files changed, 398 insertions(+), 1 deletion(-)
>   create mode 100644 Documentation/ABI/testing/debugfs-cdns-pcie
>   create mode 100644 drivers/pci/controller/cadence/pcie-cadence-debugfs.c
> 
> diff --git a/Documentation/ABI/testing/debugfs-cdns-pcie b/Documentation/ABI/testing/debugfs-cdns-pcie
> new file mode 100644
> index 000000000000..c1104e28e4ee
> --- /dev/null
> +++ b/Documentation/ABI/testing/debugfs-cdns-pcie
> @@ -0,0 +1,5 @@
> +What:		/sys/kernel/debug/cdns_pcie_<dev>/ltssm_status
> +Date:		March 2026
> +Contact:	Hans Zhang <18255117159@163.com>
> +Description:	(RO) Read will return the current PCIe LTSSM state in both
> +		string and raw value.
> \ No newline at end of file
> diff --git a/drivers/pci/controller/cadence/Kconfig b/drivers/pci/controller/cadence/Kconfig
> index 9e651d545973..cb010bc97aad 100644
> --- a/drivers/pci/controller/cadence/Kconfig
> +++ b/drivers/pci/controller/cadence/Kconfig
> @@ -6,6 +6,15 @@ menu "Cadence-based PCIe controllers"
>   config PCIE_CADENCE
>   	tristate
>   
> +config PCIE_CADENCE_DEBUGFS
> +	tristate "Cadence PCIe debugfs entries"
> +	depends on DEBUG_FS
> +	depends on PCIE_CADENCE_HOST || PCIE_CADENCE_EP
> +	help
> +	  Say Y here to enable debugfs entries for the PCIe controller. These
> +	  entries provide various debug features related to the controller and
> +	  the LTSSM status of link can be displayed.
> +
>   config PCIE_CADENCE_HOST
>   	tristate
>   	depends on OF

Sashiko pointed the compilation issues when this is build as a module.
The linkage issue needs to be resolved if we want this as a module.
Also, if we build it as m, it would requires MODULE_LICENSE() and 
MODULE_DESCRIPTION().

> diff --git a/drivers/pci/controller/cadence/Makefile b/drivers/pci/controller/cadence/Makefile
> index b8ec1cecfaa8..2cdc4617e0c2 100644
> --- a/drivers/pci/controller/cadence/Makefile
> +++ b/drivers/pci/controller/cadence/Makefile
> @@ -4,6 +4,7 @@ pcie-cadence-host-mod-y := pcie-cadence-host-common.o pcie-cadence-host.o pcie-c
>   pcie-cadence-ep-mod-y := pcie-cadence-ep.o
>   
>   obj-$(CONFIG_PCIE_CADENCE) = pcie-cadence-mod.o
> +obj-$(CONFIG_PCIE_CADENCE_DEBUGFS) += pcie-cadence-debugfs.o
>   obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host-mod.o
>   obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep-mod.o
>   obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o
> diff --git a/drivers/pci/controller/cadence/pci-sky1.c b/drivers/pci/controller/cadence/pci-sky1.c
> index e1f4a98e2ab6..b8632f1d3156 100644
> --- a/drivers/pci/controller/cadence/pci-sky1.c
> +++ b/drivers/pci/controller/cadence/pci-sky1.c
> @@ -221,6 +221,10 @@ MODULE_DEVICE_TABLE(of, of_sky1_pcie_match);

[ ... ]

>   /**
> @@ -447,6 +583,7 @@ void cdns_pcie_host_disable(struct cdns_pcie_rc *rc);
>   void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int devfn,
>   			       int where);
>   int cdns_pcie_hpa_host_setup(struct cdns_pcie_rc *rc);
> +void cdns_pcie_hpa_host_disable(struct cdns_pcie_rc *rc);
>   #else
>   static inline int cdns_pcie_host_link_setup(struct cdns_pcie_rc *rc)
>   {
> @@ -472,6 +609,10 @@ static inline void cdns_pcie_host_disable(struct cdns_pcie_rc *rc)
>   {
>   }
>   
> +static inline void cdns_pcie_hpa_host_disable(struct cdns_pcie_rc *rc)
> +{
> +}
> +
>   static inline void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int devfn,
>   					     int where)
>   {
> @@ -535,4 +676,16 @@ bool cdns_pcie_hpa_link_up(struct cdns_pcie *pcie);
>   
>   extern const struct dev_pm_ops cdns_pcie_pm_ops;
>   
> +#ifdef CONFIG_PCIE_CADENCE_DEBUGFS

Use "#if IS_ENABLED(CONFIG_PCIE_CADENCE_DEBUGFS)" to resolve the 
compilation error when building as a module.

> +void cdns_pcie_debugfs_deinit(struct cdns_pcie *pci);
> +void cdns_pcie_debugfs_init(struct cdns_pcie *pci);
> +#else
> +static inline void cdns_pcie_debugfs_deinit(struct cdns_pcie *pci)
> +{
> +}
> +static inline void cdns_pcie_debugfs_init(struct cdns_pcie *pci)
> +{
> +}
> +#endif
> +
>   #endif /* _PCIE_CADENCE_H */


  parent reply	other threads:[~2026-05-20  7:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 12:36 [PATCH v6 0/3] PCI: cadence: Add LTSSM debugfs Hans Zhang
2026-05-19 12:36 ` [PATCH v6 1/3] PCI: cadence: Add HPA architecture flag Hans Zhang
2026-05-19 12:36 ` [PATCH v6 2/3] PCI: cadence: Add HPA IP debugfs for LTSSM status Hans Zhang
2026-05-19 13:20   ` sashiko-bot
2026-05-20  7:26   ` Aksh Garg [this message]
2026-05-20 14:54     ` Hans Zhang
2026-05-19 12:36 ` [PATCH v6 3/3] PCI: cadence: Add LGA " Hans Zhang
2026-05-20  2:34   ` Manikandan Karunakaran Pillai
2026-05-20  2:59     ` Hans Zhang
2026-05-20  4:36       ` Aksh Garg
2026-05-20  4:40         ` Hans Zhang
2026-05-20  5:27           ` Aksh Garg
2026-05-20  5:44             ` Hans Zhang

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=d9d4aa30-8d30-4025-abde-0325e102fd8d@ti.com \
    --to=a-garg7@ti.com \
    --cc=18255117159@163.com \
    --cc=bhelgaas@google.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mpillai@cadence.com \
    --cc=robh@kernel.org \
    --cc=s-vadapalli@ti.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).