From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Sricharan Ramabadhran <quic_srichara@quicinc.com>
Cc: andersson@kernel.org, lpieralisi@kernel.org, kw@linux.com,
krzysztof.kozlowski+dt@linaro.org, robh@kernel.org,
konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 19/19] PCI: qcom: Expose link transition counts via debugfs for v2.4.0
Date: Tue, 14 Mar 2023 16:34:31 +0530 [thread overview]
Message-ID: <20230314110431.GA137001@thinkpad> (raw)
In-Reply-To: <a55f652c-aa78-1df5-1587-a12920d7a2f1@quicinc.com>
On Tue, Mar 14, 2023 at 04:25:29PM +0530, Sricharan Ramabadhran wrote:
>
>
> On 3/14/2023 4:06 PM, Sricharan Ramabadhran wrote:
> >
> >
> > On 3/10/2023 9:38 AM, Manivannan Sadhasivam wrote:
> > > Qualcomm PCIe controllers of version v2.4.0 have debug registers in the
> > > PARF region that count PCIe link transitions. Expose them over debugfs to
> > > userspace to help debug the low power issues.
> > >
> > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > ---
> > > drivers/pci/controller/dwc/pcie-qcom.c | 33 ++++++++++++++++++++++++++
> > > 1 file changed, 33 insertions(+)
> > >
> > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c
> > > b/drivers/pci/controller/dwc/pcie-qcom.c
> > > index f99b7e7f3f73..0b41f007fa90 100644
> > > --- a/drivers/pci/controller/dwc/pcie-qcom.c
> > > +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> > > @@ -37,6 +37,7 @@
> > > /* PARF registers */
> > > #define PARF_SYS_CTRL 0x00
> > > #define PARF_PM_CTRL 0x20
> > > +#define PARF_PM_STTS 0x24
> > > #define PARF_PCS_DEEMPH 0x34
> > > #define PARF_PCS_SWING 0x38
> > > #define PARF_PHY_CTRL 0x40
> > > @@ -84,6 +85,12 @@
> > > /* PARF_PM_CTRL register fields */
> > > #define REQ_NOT_ENTR_L1 BIT(5)
> > > +/* PARF_PM_STTS register fields */
> > > +#define PM_LINKST_IN_L1SUB BIT(8)
> > > +#define PM_LINKST_IN_L0S BIT(7)
> > > +#define PM_LINKST_IN_L2 BIT(5)
> > > +#define PM_LINKST_IN_L1 BIT(4)
> > > +
> > > /* PARF_PCS_DEEMPH register fields */
> > > #define PCS_DEEMPH_TX_DEEMPH_GEN1(x) FIELD_PREP(GENMASK(21,
> > > 16), x)
> > > #define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x)
> > > FIELD_PREP(GENMASK(13, 8), x)
> > > @@ -737,6 +744,31 @@ static int qcom_pcie_post_init_2_4_0(struct
> > > qcom_pcie *pcie)
> > > return 0;
> > > }
> > > +static int qcom_pcie_debugfs_func_2_4_0(struct seq_file *s, void *data)
> > > +{
> > > + struct qcom_pcie *pcie = (struct qcom_pcie *)
> > > dev_get_drvdata(s->private);
> > > +
> > > + seq_printf(s, "L0s transition count: %u\n",
> > > + readl_relaxed(pcie->parf + PM_LINKST_IN_L0S));
> > > +
> > > + seq_printf(s, "L1 transition count: %u\n",
> > > + readl_relaxed(pcie->parf + PM_LINKST_IN_L1));
> > > +
> > > + seq_printf(s, "L1.1 transition count: %u\n",
> > > + readl_relaxed(pcie->parf + PM_LINKST_IN_L1SUB));
> > > +
> > > + seq_printf(s, "L2 transition count: %u\n",
> > > + readl_relaxed(pcie->parf + PM_LINKST_IN_L2));
> > > +
> >
> > Using bitmask as register offset ? instead use PM_STTS and bitmask it ?
>
> Also, since its 1 bit, all are status and not count.
> Not sure, if you want it to limit this debug based on 'mhi' property
> being populated ?
>
Err... Look like I blindly copied the debugfs function from 2.7.0 :/ Sry, since
these are all just 1 bit, we cannot use it for getting the count. So I'll drop
this patch in next revision.
Thanks,
Mani
> Regards,
> Sricharan
--
மணிவண்ணன் சதாசிவம்
prev parent reply other threads:[~2023-03-14 11:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 4:07 [PATCH v3 00/19] Qcom PCIe cleanups and improvements Manivannan Sadhasivam
2023-03-10 4:07 ` [PATCH v3 01/19] PCI: qcom: Remove PCIE20_ prefix from register definitions Manivannan Sadhasivam
2023-03-10 4:07 ` [PATCH v3 02/19] PCI: qcom: Sort and group registers and bitfield definitions Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 03/19] PCI: qcom: Use bitfield definitions for register fields Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 04/19] PCI: qcom: Add missing macros " Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 05/19] PCI: qcom: Use lower case for hex Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 06/19] PCI: qcom: Use bulk reset APIs for handling resets for IP rev 2.1.0 Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 07/19] PCI: qcom: Use bulk clock APIs for handling clocks for IP rev 1.0.0 Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 08/19] PCI: qcom: Use bulk clock APIs for handling clocks for IP rev 2.3.2 Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 09/19] PCI: qcom: Use bulk clock APIs for handling clocks for IP rev 2.3.3 Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 10/19] PCI: qcom: Use bulk reset APIs for handling resets " Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 11/19] PCI: qcom: Use bulk reset APIs for handling resets for IP rev 2.4.0 Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 12/19] PCI: qcom: Use macros for defining total no. of clocks & supplies Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 13/19] PCI: qcom: Rename qcom_pcie_config_sid_sm8250() to reflect IP version Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 14/19] dt-bindings: PCI: qcom: Add "mhi" register region to supported SoCs Manivannan Sadhasivam
2023-03-10 9:21 ` Krzysztof Kozlowski
2023-03-10 4:08 ` [PATCH v3 15/19] arm64: dts: qcom: sdm845: Add "mhi" region to the PCIe nodes Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 16/19] arm64: dts: qcom: sm8250: " Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 17/19] arm64: dts: qcom: sc8280xp: " Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 18/19] PCI: qcom: Expose link transition counts via debugfs for v1.9.0 & v2.7.0 Manivannan Sadhasivam
2023-03-10 4:08 ` [PATCH v3 19/19] PCI: qcom: Expose link transition counts via debugfs for v2.4.0 Manivannan Sadhasivam
2023-03-14 10:36 ` Sricharan Ramabadhran
2023-03-14 10:55 ` Sricharan Ramabadhran
2023-03-14 11:04 ` Manivannan Sadhasivam [this message]
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=20230314110431.GA137001@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=andersson@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=quic_srichara@quicinc.com \
--cc=robh@kernel.org \
/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 NNTP newsgroup(s).