From: "Jianjun Wang (王建军)" <Jianjun.Wang@mediatek.com>
To: "helgaas@kernel.org" <helgaas@kernel.org>
Cc: "linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"Xavier Chang (張獻文)" <Xavier.Chang@mediatek.com>,
"manivannan.sadhasivam@linaro.org"
<manivannan.sadhasivam@linaro.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"kw@linux.com" <kw@linux.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Ryder Lee" <Ryder.Lee@mediatek.com>
Subject: Re: [PATCH 4/5] PCI: mediatek-gen3: Don't reply AXI slave error
Date: Mon, 6 Jan 2025 09:31:40 +0000 [thread overview]
Message-ID: <ad4ecda30ac5ad59edfbe95b5c09edc6ccf11db0.camel@mediatek.com> (raw)
In-Reply-To: <20250103191948.GA4190995@bhelgaas>
On Fri, 2025-01-03 at 13:19 -0600, Bjorn Helgaas wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On Fri, Jan 03, 2025 at 02:00:14PM +0800, Jianjun Wang wrote:
> > There are some circumstances where the EP device will not respond
> > to
> > non-posted access from the root port (e.g., MMIO read). In such
> > cases,
> > the root port will reply with an AXI slave error, which will be
> > treated
> > as a System Error (SError), causing a kernel panic and preventing
> > us
> > from obtaining any useful information for further debugging.
> >
> > We have added a new bit in the PCIE_AXI_IF_CTRL_REG register to
> > prevent
> > PCIe AXI0 from replying with a slave error. Setting this bit on an
> > older
> > platform that does not support this feature will have no effect.
> >
> > By preventing AXI0 from replying with a slave error, we can keep
> > the
> > kernel alive and debug using the information from AER.
> >
> > Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com>
> > ---
> > drivers/pci/controller/pcie-mediatek-gen3.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c
> > b/drivers/pci/controller/pcie-mediatek-gen3.c
> > index 4bd3b39eebe2..48f83c2d91f7 100644
> > --- a/drivers/pci/controller/pcie-mediatek-gen3.c
> > +++ b/drivers/pci/controller/pcie-mediatek-gen3.c
> > @@ -87,6 +87,9 @@
> > #define PCIE_LOW_POWER_CTRL_REG 0x194
> > #define PCIE_FORCE_DIS_L0S BIT(8)
> >
> > +#define PCIE_AXI_IF_CTRL_REG 0x1a8
> > +#define PCIE_AXI0_SLV_RESP_MASK BIT(12)
> > +
> > #define PCIE_PIPE4_PIE8_REG 0x338
> > #define PCIE_K_FINETUNE_MAX GENMASK(5, 0)
> > #define PCIE_K_FINETUNE_ERR GENMASK(7, 6)
> > @@ -469,6 +472,15 @@ static int mtk_pcie_startup_port(struct
> > mtk_gen3_pcie *pcie)
> > val |= PCIE_FORCE_DIS_L0S;
> > writel_relaxed(val, pcie->base + PCIE_LOW_POWER_CTRL_REG);
> >
> > + /*
> > + * Prevent PCIe AXI0 from replying a slave error, as it will
> > cause kernel panic
> > + * and prevent us from getting useful information.
> > + * Keep the kernel alive and debug using the information from
> > AER.
>
> Wrap to fit in 80 columns like the rest of the file
>
> Add blank lines between paragraphs.
>
> AER is an asynchronous mechanism, so if you disable the SError,
> whoever issued the MMIO read to the PCIe device will receive some
> kind
> of data.
>
> I hope/assume that data is ~0 as on other platforms? If so, please
> confirm this in the comment and commit log. Otherwise, the caller
> will received corrupted data with no way to know that it's corrupted.
Yes, with this bit set, the caller will receive ~0 data if the EP does
not respond. I'll add this to the comment and commit log.
Thanks.
>
> > + */
> > + val = readl_relaxed(pcie->base + PCIE_AXI_IF_CTRL_REG);
> > + val |= PCIE_AXI0_SLV_RESP_MASK;
> > + writel_relaxed(val, pcie->base + PCIE_AXI_IF_CTRL_REG);
> > +
> > /* Disable DVFSRC voltage request */
> > val = readl_relaxed(pcie->base + PCIE_MISC_CTRL_REG);
> > val |= PCIE_DISABLE_DVFSRC_VLT_REQ;
> > --
> > 2.46.0
> >
next prev parent reply other threads:[~2025-01-06 9:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 6:00 [PATCH 0/5] PCI: mediatek-gen3: Add MT8196 support Jianjun Wang
2025-01-03 6:00 ` [PATCH 1/5] dt-bindings: " Jianjun Wang
2025-01-03 9:10 ` Krzysztof Kozlowski
2025-01-06 9:26 ` Jianjun Wang (王建军)
2025-01-06 12:27 ` Krzysztof Kozlowski
2025-01-07 8:43 ` Jianjun Wang (王建军)
2025-01-07 9:02 ` Chen-Yu Tsai
2025-01-08 6:53 ` Jianjun Wang (王建军)
2025-01-08 7:16 ` Krzysztof Kozlowski
2025-01-08 7:30 ` Jianjun Wang (王建军)
2025-01-03 9:26 ` AngeloGioacchino Del Regno
2025-01-06 9:19 ` Jianjun Wang (王建军)
2025-01-07 13:04 ` AngeloGioacchino Del Regno
2025-01-08 7:24 ` Jianjun Wang (王建军)
2025-01-03 6:00 ` [PATCH 2/5] " Jianjun Wang
2025-01-03 19:02 ` Bjorn Helgaas
2025-01-07 1:51 ` Jianjun Wang (王建军)
2025-01-03 6:00 ` [PATCH 3/5] PCI: mediatek-gen3: Disable ASPM L0s Jianjun Wang
2025-01-03 9:16 ` AngeloGioacchino Del Regno
2025-01-07 2:18 ` Jianjun Wang (王建军)
2025-01-07 11:44 ` AngeloGioacchino Del Regno
2025-01-07 23:07 ` Bjorn Helgaas
2025-01-03 19:15 ` Bjorn Helgaas
2025-01-07 2:44 ` Jianjun Wang (王建军)
2025-01-07 23:06 ` Bjorn Helgaas
2025-01-06 16:09 ` Manivannan Sadhasivam
2025-01-03 6:00 ` [PATCH 4/5] PCI: mediatek-gen3: Don't reply AXI slave error Jianjun Wang
2025-01-03 9:29 ` AngeloGioacchino Del Regno
2025-01-06 9:27 ` Jianjun Wang (王建军)
2025-01-03 19:19 ` Bjorn Helgaas
2025-01-06 9:31 ` Jianjun Wang (王建军) [this message]
2025-01-06 16:16 ` Manivannan Sadhasivam
2025-01-07 3:21 ` Jianjun Wang (王建军)
2025-01-03 6:00 ` [PATCH 5/5] PCI: mediatek-gen3: Keep PCIe power and clocks if suspend-to-idle Jianjun Wang
2025-01-03 9:14 ` AngeloGioacchino Del Regno
2025-01-03 19:13 ` Bjorn Helgaas
2025-01-06 16:23 ` Manivannan Sadhasivam
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=ad4ecda30ac5ad59edfbe95b5c09edc6ccf11db0.camel@mediatek.com \
--to=jianjun.wang@mediatek.com \
--cc=Ryder.Lee@mediatek.com \
--cc=Xavier.Chang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=helgaas@kernel.org \
--cc=krzk+dt@kernel.org \
--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=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=matthias.bgg@gmail.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