Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Jianjun Wang <jianjun.wang@mediatek.com>
To: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, jieyy.yang@mediatek.com,
	chuanjia.liu@mediatek.com, qizhong.cheng@mediatek.com,
	jian.yang@mediatek.com
Subject: Re: [PATCH] PCI: mediatek-gen3: Print LTSSM state when PCIe link down
Date: Tue, 29 Mar 2022 10:00:49 +0800	[thread overview]
Message-ID: <c074fc33a64bd09b583b0aae58e950b0d826d82e.camel@mediatek.com> (raw)
In-Reply-To: <cd9c7d5c-4ab6-2795-2bba-9deedb8198e3@collabora.com>

On Mon, 2022-03-28 at 16:39 +0200, AngeloGioacchino Del Regno wrote:
> Il 24/03/22 08:25, Jianjun Wang ha scritto:
> > Print current LTSSM state when PCIe link down instead of the
> > register
> > value, make it easier to get the link status.
> > 
> > Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com>
> 
> Hello Jianjun,
> this patch is really helpful when comes to understand the source of
> an issue,
> so I agree with it - and thank you for that.
> 
> Though, I think that you should still print the hex number along with
> the
> meaning of it, check below:
> 
> > ---
> >   drivers/pci/controller/pcie-mediatek-gen3.c | 40
> > ++++++++++++++++++++-
> >   1 file changed, 39 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c
> > b/drivers/pci/controller/pcie-mediatek-gen3.c
> > index 7705d61fba4c..54663f025e27 100644
> > --- a/drivers/pci/controller/pcie-mediatek-gen3.c
> > +++ b/drivers/pci/controller/pcie-mediatek-gen3.c
> 
> ..snip..
> 
> > @@ -327,8 +358,15 @@ static int mtk_pcie_startup_port(struct
> > mtk_gen3_pcie *pcie)
> >   				 !!(val & PCIE_PORT_LINKUP), 20,
> >   				 PCI_PM_D3COLD_WAIT * USEC_PER_MSEC);
> >   	if (err) {
> > +		const char *ltssm_state;
> > +		int ltssm_index;
> > +
> >   		val = readl_relaxed(pcie->base +
> > PCIE_LTSSM_STATUS_REG);
> > -		dev_err(pcie->dev, "PCIe link down, ltssm reg val:
> > %#x\n", val);
> > +		ltssm_index = PCIE_LTSSM_STATE(val);
> > +		ltssm_state = ltssm_index >= ARRAY_SIZE(ltssm_str) ?
> > +			      "Unknown state" : ltssm_str[ltssm_index];
> > +		dev_err(pcie->dev, "PCIe link down, current ltssm
> > state: %s\n",
> 
> There, I think that you should do:
> 
> dev_err(pcie->dev, "PCIe link down, current LTSSM state: %s (%#x)\n",
> 	ltssm_state, val);
> 
> this will be extremely useful in the "Unknown state" case.
> 
> After fixing that,
> 
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>

Thanks!

> 
> Regards,
> Angelo


      reply	other threads:[~2022-03-29  2:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24  7:25 [PATCH] PCI: mediatek-gen3: Print LTSSM state when PCIe link down Jianjun Wang
2022-03-28 14:39 ` AngeloGioacchino Del Regno
2022-03-29  2:00   ` Jianjun Wang [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=c074fc33a64bd09b583b0aae58e950b0d826d82e.camel@mediatek.com \
    --to=jianjun.wang@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bhelgaas@google.com \
    --cc=chuanjia.liu@mediatek.com \
    --cc=jian.yang@mediatek.com \
    --cc=jieyy.yang@mediatek.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=qizhong.cheng@mediatek.com \
    --cc=robh@kernel.org \
    --cc=ryder.lee@mediatek.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