From: Kishon Vijay Abraham I <kishon@ti.com>
To: Rob Herring <robh@kernel.org>,
Gustavo Pimentel <Gustavo.Pimentel@synopsys.com>
Cc: "Z.q. Hou" <zhiqiang.hou@nxp.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
PCI <linux-pci@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Michael Walle <michael@walle.cc>,
Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops
Date: Wed, 30 Sep 2020 18:52:28 +0530 [thread overview]
Message-ID: <9ac53f04-f2e8-c5f9-e1f7-e54270ec55a0@ti.com> (raw)
In-Reply-To: <CAL_JsqJJxq2jZzbzZffsrPxnoLJdWLLS-7bG-vaqyqs5NkQhHQ@mail.gmail.com>
Hi,
On 29/09/20 10:41 pm, Rob Herring wrote:
> On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel
> <Gustavo.Pimentel@synopsys.com> wrote:
>>
>> On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou <zhiqiang.hou@nxp.com> wrote:
>>
>>> Hi Lorenzo,
>>>
>>> Thanks a lot for your comments!
>>>
>>>> -----Original Message-----
>>>> From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>>> Sent: 2020年9月28日 17:39
>>>> To: Z.q. Hou <zhiqiang.hou@nxp.com>
>>>> Cc: Rob Herring <robh@kernel.org>; linux-kernel@vger.kernel.org; PCI
>>>> <linux-pci@vger.kernel.org>; Bjorn Helgaas <bhelgaas@google.com>;
>>>> Gustavo Pimentel <gustavo.pimentel@synopsys.com>; Michael Walle
>>>> <michael@walle.cc>; Ard Biesheuvel <ardb@kernel.org>
>>>> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
>>>> dw_child_pcie_ops
>>>>
>>>> On Thu, Sep 24, 2020 at 04:24:47AM +0000, Z.q. Hou wrote:
>>>>> Hi Rob,
>>>>>
>>>>> Thanks a lot for your comments!
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Rob Herring <robh@kernel.org>
>>>>>> Sent: 2020年9月18日 23:28
>>>>>> To: Z.q. Hou <zhiqiang.hou@nxp.com>
>>>>>> Cc: linux-kernel@vger.kernel.org; PCI <linux-pci@vger.kernel.org>;
>>>>>> Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>; Bjorn Helgaas
>>>>>> <bhelgaas@google.com>; Gustavo Pimentel
>>>>>> <gustavo.pimentel@synopsys.com>; Michael Walle
>>>> <michael@walle.cc>;
>>>>>> Ard Biesheuvel <ardb@kernel.org>
>>>>>> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
>>>>>> dw_child_pcie_ops
>>>>>>
>>>>>> On Fri, Sep 18, 2020 at 5:02 AM Z.q. Hou <zhiqiang.hou@nxp.com>
>>>> wrote:
>>>>>>>
>>>>>>> Hi Rob,
>>>>>>>
>>>>>>> Thanks a lot for your comments!
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Rob Herring <robh@kernel.org>
>>>>>>>> Sent: 2020年9月17日 4:29
>>>>>>>> To: Z.q. Hou <zhiqiang.hou@nxp.com>
>>>>>>>> Cc: linux-kernel@vger.kernel.org; PCI
>>>>>>>> <linux-pci@vger.kernel.org>; Lorenzo Pieralisi
>>>>>>>> <lorenzo.pieralisi@arm.com>; Bjorn Helgaas
>>>>>>>> <bhelgaas@google.com>; Gustavo Pimentel
>>>>>>>> <gustavo.pimentel@synopsys.com>; Michael Walle
>>>>>> <michael@walle.cc>;
>>>>>>>> Ard Biesheuvel <ardb@kernel.org>
>>>>>>>> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
>>>>>>>> dw_child_pcie_ops
>>>>>>>>
>>>>>>>> On Tue, Sep 15, 2020 at 11:49 PM Zhiqiang Hou
>>>>>> <Zhiqiang.Hou@nxp.com>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>>>>>>>>>
>>>>>>>>> On NXP Layerscape platforms, it results in SError in the
>>>>>>>>> enumeration of the PCIe controller, which is not connecting
>>>>>>>>> with an Endpoint device. And it doesn't make sense to
>>>>>>>>> enumerate the Endpoints when the PCIe link is down. So this
>>>>>>>>> patch added the link up check to avoid to fire configuration
>>>> transactions on link down bus.
>>>>>>>>
>>>>>>>> Michael reported the same issue as well.
>>>>>>>>
>>>>>>>> What happens if the link goes down between the check and the
>>>> access?
>>>>>>>
>>>>>>> This patch cannot cover this case, and will get the SError.
>>>>>>> But I think it makes sense to avoid firing transactions on link down bus.
>>>>>>
>>>>>> That's impossible to do without a race even in h/w.
>>>>>
>>>>> Agree.
>>>>>
>>>>>>
>>>>>>>> It's a racy check. I'd like to find an alternative solution.
>>>>>>>> It's even worse if Layerscape is used in ECAM mode. I looked at
>>>>>>>> the EDK2 setup for layerscape[1] and it looks like root ports
>>>>>>>> are just skipped if link
>>>>>> is down.
>>>>>>>> Maybe a link down just never happens once up, but if so, then we
>>>>>>>> only need to check it once and fail probe.
>>>>>>>
>>>>>>> Many customers connect the FPGA Endpoint, which may establish PCIe
>>>>>>> link after the PCIe enumeration and then rescan the PCIe bus, so I
>>>>>>> think it should not exit the probe of root port even if there is
>>>>>>> not link up
>>>>>> during enumeration.
>>>>>>
>>>>>> That's a good reason. I want to unify the behavior here as it varies
>>>>>> per platform currently and wasn't sure which way to go.
>>>>>>
>>>>>>
>>>>>>>> I've dug into this a bit more and am curious about the
>>>>>>>> PCIE_ABSERR register setting which is set to:
>>>>>>>>
>>>>>>>> #define PCIE_ABSERR_SETTING 0x9401 /* Forward error of
>>>>>>>> non-posted request */
>>>>>>>>
>>>>>>>> It seems to me this is not what we want at least for config
>>>>>>>> accesses, but commit 84d897d6993 where this was added seems to
>>>>>>>> say otherwise. Is it not possible to configure the response per access
>>>> type?
>>>>>>>
>>>>>>> Thanks a lot for your investigation!
>>>>>>> The story is like this: Some customers worry about these silent
>>>>>>> error (DWC PCIe IP won't forward the error of outbound non-post
>>>>>>> request by default), so we were pushed to enable the error
>>>>>>> forwarding to AXI in the commit
>>>>>>> 84d897d6993 as you saw. But it cannot differentiate the config
>>>>>>> transactions from the MEM_rd, except the Vendor ID access, which
>>>>>>> is controlled by a separate bit and it was set to not forward
>>>>>>> error of access
>>>>>> of Vendor ID.
>>>>>>> So we think it's okay to enable the error forwarding, the SError
>>>>>>> should not occur, because after the enumeration it won't access
>>>>>>> the
>>>>>> non-existent functions.
>>>>>>
>>>>>> We've rejected upstream support for platforms aborting on config
>>>>>> accesses[1]. I think there's clear consensus that aborting is the
>>>>>> wrong behavior.
>>>>>>
>>>>>> Do MEM_wr errors get forwarded? Seems like that would be enough.
>>>>>> Also, wouldn't page faults catch most OOB accesses anyways? You need
>>>>>> things page aligned anyways with an IOMMU and doing userspace access
>>>>>> or guest assignment.
>>>>>
>>>>> Yes, errors of MEM_wr can be forwarded.
>>>>>
>>>>>>
>>>>>> Here's another idea, how about only enabling forwarding errors if
>>>>>> the link is up? If really would need to be configured any time the
>>>>>> link state changes rather than just at probe. I'm not sure if you
>>>>>> have a way to disable it on link down though.
>>>>>
>>>>> Dug deeper into this issue and found the setting of not forwarding
>>>>> error of non-existent Vender ID access counts on the link partner: 1.
>>>>> When there is a link partner (namely link up), it will return 0xffff
>>>>> when read non-existent function Vendor ID and won't forward error to
>>>>> AXI. 2. When no link partner (link down), it will forward the error
>>>>> of reading non-existent function Vendor ID to AXI and result in
>>>>> SError.
>>>>>
>>>>> I think this is a DWC PCIe IP specific issue but not get feedback from
>>>>> design team. I'm thinking to disable this error forwarding just like
>>>>> other platforms, since when these errors (UR, CA and CT) are detected,
>>>>> AER driver can also report the error and try to recover.
>>>>
>>>> I take this as you shall send a patch to fix this issue shortly, is this correct ?
>>>
>>> The issue becomes complex:
>>> I reviewed the DWC PCIe databook of verion 4.40a which is used on Layerscape platforms, and it said that " Your RC application should not generate CFG requests until it has confirmed that the link is up by sampling the smlh_link_up and rmlh_link_up outputs".
>>> So, the link up checking should not be remove before each outbound CFG access.
>>> Gustavo, can you share more details on the link up checking? Does it only exist in the 4.40a?
>>
>> Hi Zhiqiang,
>>
>> According to the information that I got from the IP team you are correct,
>> the same requirement still exists on the newer IP versions.
>
> How is that possible in a race free way?
>
> Testing on meson and layerscape (with the forwarding of errors
> disabled) shows a link check is not needed. But then dra7xx seems to
> need one (or has some f/w setup).
Yeah, I don't see any registers in the DRA7x PCIe wrapper for disabling
error forwarding.
Thanks
Kishon
next prev parent reply other threads:[~2020-09-30 13:22 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 5:41 [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops Zhiqiang Hou
2020-09-16 20:28 ` Rob Herring
2020-09-18 11:02 ` Z.q. Hou
2020-09-18 11:14 ` Michael Walle
2020-09-21 14:48 ` Z.q. Hou
2020-09-18 12:47 ` Bjorn Helgaas
2020-09-21 16:31 ` Z.q. Hou
2020-09-18 15:27 ` Rob Herring
2020-09-24 4:24 ` Z.q. Hou
2020-09-28 9:39 ` Lorenzo Pieralisi
2020-09-29 4:05 ` Z.q. Hou
2020-09-29 15:24 ` Gustavo Pimentel
2020-09-29 17:11 ` Rob Herring
2020-09-30 13:22 ` Kishon Vijay Abraham I [this message]
2020-09-30 15:01 ` Rob Herring
2020-10-01 13:32 ` Kishon Vijay Abraham I
2020-10-01 16:46 ` Michael Walle
2020-10-02 9:29 ` Naresh Kamboju
2020-10-08 14:46 ` Naresh Kamboju
2020-10-08 15:12 ` Rob Herring
2020-10-08 16:51 ` Naresh Kamboju
2020-10-08 15:08 ` Lorenzo Pieralisi
2020-10-12 16:31 ` Kishon Vijay Abraham I
2020-10-12 4:41 ` Z.q. Hou
2020-10-19 16:13 ` Lorenzo Pieralisi
2020-10-20 8:07 ` Kishon Vijay Abraham I
2020-10-12 4:22 ` Z.q. Hou
2020-10-20 9:48 ` Lorenzo Pieralisi
2020-10-13 9:15 ` Lorenzo Pieralisi
2020-10-14 11:13 ` Lorenzo Pieralisi
2020-10-14 12:37 ` Rob Herring
2020-10-15 22:47 ` Bjorn Helgaas
2020-10-16 11:59 ` Lorenzo Pieralisi
2020-10-19 5:24 ` Z.q. Hou
2020-10-19 5:41 ` Kishon Vijay Abraham I
2020-10-20 2:13 ` Z.q. Hou
2020-10-20 9:12 ` Lorenzo Pieralisi
2020-10-20 9:55 ` Lorenzo Pieralisi
2020-10-21 8:47 ` Z.q. Hou
2020-10-22 6:20 ` Richard Zhu
2020-10-19 16:26 ` Lorenzo Pieralisi
2020-10-20 10:19 ` Lorenzo Pieralisi
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=9ac53f04-f2e8-c5f9-e1f7-e54270ec55a0@ti.com \
--to=kishon@ti.com \
--cc=Gustavo.Pimentel@synopsys.com \
--cc=ardb@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=michael@walle.cc \
--cc=robh@kernel.org \
--cc=zhiqiang.hou@nxp.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 NNTP newsgroup(s).