From: "Pali Rohár" <pali@kernel.org>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Lukas Wunner <lukas@wunner.de>,
Jim Quinlan <jim2101024@gmail.com>,
Nicolas Saenz Julienne <nsaenz@kernel.org>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Krzysztof Wilczynski <kw@linux.com>,
Rob Herring <robh@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org,
Philipp Rosenberger <p.rosenberger@kunbus.com>,
Cyril Brulebois <kibi@debian.org>
Subject: Re: [PATCH] PCI: brcmstb: Avoid downstream access during link training
Date: Mon, 7 Aug 2023 09:28:48 +0200 [thread overview]
Message-ID: <20230807072848.6o5vevzwcba5xr6e@pali> (raw)
In-Reply-To: <20230807071358.gaghhtoppj2w6ynx@pali>
On Monday 07 August 2023 09:13:58 Pali Rohár wrote:
> On Sunday 06 August 2023 19:48:59 Florian Fainelli wrote:
> > On 8/6/2023 2:43 PM, Pali Rohár wrote:
> > > On Sunday 06 August 2023 06:44:50 Lukas Wunner wrote:
> > > > The Broadcom Set Top Box PCIe controller signals an Asynchronous SError
> > > > Interrupt
> > >
> > > This is little incorrect wording. PCIe controller cannot send Async
> > > SError, this is ARMv8 specific thing. In this case PCIe controller is
> > > connected to ARM core via AXI bus and on PCIe transaction timeout it
> > > sends AXI Slave Error, which then ARMv8 core reports to kernel as Async
> > > SError interrupt.
> >
> > That is indeed a better way to explain the issue. FWIW, on BCM2711 the PCIe
> > core connects via SCB and then AXI towards the ARMv8 CPU, does not change a
> > thing about your paragraph.
>
> Ok, it is better describe the issue correctly.
>
> > >
> > > The proper fix is to configure PCIe controller to never send AXI Slave
> > > Error and neither AXI Decode Error (to prevent SErrors at all). For
> > > example Synopsys PCIe controllers have proprietary hidden configuration
> > > bits for enabling/disabling this AXI error reporting behavior.
> >
> > That does not exist with the version of the block present in BCM2711
> > unfortunately.
>
> I was expecting such answer. I think that we have been discussing this
> issue privately more months ago.
>
> > >
> > > Or second option is to access affected memory from the ARMv8 core via
> > > synchronous operations and map memory as nGnRnE. Then ARMv8 core reports
> > > AXI Slave Error as Synchronous Abort Exception which you can catch,
> > > examine that was caused on PCIe memory region and fabricate all-ones
> > > response. But the second option is not available for some licensed ARMv8
> > > Cortex cores (e.g. A53) as they do not implement nE (non Early Write
> > > Acknowledgement) memory mapping correctly.
> >
> > BCM2711 uses Cortex-A72 do these cores still not implement nE correctly? Do
> > you have a reference backing up that claim (not disputing it, just curious).
>
> I remember that I read this in Cortex-A53 documentation. Let me find it.
>
> It is here:
> ARM Cortex-A53 MPCore Processor Technical Reference Manual r0p3 - Support for v8 memory types:
> https://developer.arm.com/documentation/ddi0500/e/level-1-memory-system/support-for-v8-memory-types
>
> "nGnRnE - Treated the same as nGnRE inside a Cortex-A53 processor"
>
> So really, disabling Early-acknowledge has no effect on A53.
>
> > >
> > > The patch below does not fix the issue at all, instead it opens a new
> > > race condition that if link state is changed _after_ the check and
> > > _before_ accessing config space.
> >
> > Fair enough, but in the situation you describe there is not much that can be
> > done anyway so we might as well deal with a narrowed window?
>
> Unless there is hidden/proprietary/undocumented bits for PCIe controller
> to disable generating AXI errors, or ability to use only synchronous
> access to affected memory from ARM core (e.g. by nE) there is really not
> much what can be done here. I can just say that this is badly designed HW.
>
> One more thing, if I remember correctly, ARMv8 specifies that Syndrome
> register which delivers SError has some bits reserved for optional
> feature - target AXI slave id which sent AXI Error. A53 does not
> implement it and I highly doubt that other licensed ARM cores have them.
> But maybe you could check A72. But even with that I'm really not sure if
> it could be possible to catch SError, detect that it was sent by AXI
> slave corresponding to PCIe controller and ignore it.
>
> > Thanks for reviewing.
> > --
> > Florian
One more idea. Does platform have some DMA controller? If yes, maybe it
could be possible to completely avoid access to that affected memory
from ARM core and instead access its content via DMA controller? DMA
controller could be better and does not signal slave errors as SError to
ARM core.
next prev parent reply other threads:[~2023-08-07 7:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-06 4:44 [PATCH] PCI: brcmstb: Avoid downstream access during link training Lukas Wunner
2023-08-06 15:15 ` Florian Fainelli
2023-08-14 19:55 ` Jim Quinlan
2023-08-06 21:43 ` Pali Rohár
2023-08-07 2:48 ` Florian Fainelli
2023-08-07 7:13 ` Pali Rohár
2023-08-07 7:28 ` Pali Rohár [this message]
2023-10-24 1:13 ` Florian Fainelli
2023-10-24 0:51 ` Bjorn Helgaas
2023-12-08 19:53 ` Bjorn Helgaas
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=20230807072848.6o5vevzwcba5xr6e@pali \
--to=pali@kernel.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhelgaas@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=jim2101024@gmail.com \
--cc=kibi@debian.org \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=lukas@wunner.de \
--cc=nsaenz@kernel.org \
--cc=p.rosenberger@kunbus.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).