RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-22 Thread Richard Zhu
> -Original Message-
> From: Z.q. Hou 
> Sent: Wednesday, October 21, 2020 4:48 PM
> To: Lorenzo Pieralisi ; Richard Zhu
> 
> Cc: Kishon Vijay Abraham I ; Bjorn Helgaas
> ; linux-kernel@vger.kernel.org; linux-...@vger.kernel.org;
> r...@kernel.org; bhelg...@google.com; gustavo.pimen...@synopsys.com
> Subject: RE: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> Hi Lorenzo and Richard,
> 
> > -Original Message-
> > From: Lorenzo Pieralisi 
> > Sent: 2020年10月20日 17:55
> > To: Z.q. Hou 
> > Cc: Kishon Vijay Abraham I ; Bjorn Helgaas
> > ; linux-kernel@vger.kernel.org;
> > linux-...@vger.kernel.org; r...@kernel.org; bhelg...@google.com;
> > gustavo.pimen...@synopsys.com
> > Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> > dw_child_pcie_ops
> >
> > On Tue, Oct 20, 2020 at 02:13:13AM +, Z.q. Hou wrote:
> >
> > [...]
> >
> > > > > For NXP Layerscape platforms (the ls1028a and ls2088a are also
> > > > > NXP
> > > > Layerscape platform), as the error response to AXI/AHB was
> > > > enabled, it will get UR error and trigger SError on AXI bus when
> > > > it accesses a non-existent BDF on a link down bus. I'm not clear
> > > > about how it happens on dra7xxx and imx6, since they doesn't
> > > > enable the error
> > response to AXI/AHB.
> > > >
> > > > That's exactly the case with DRA7xx as the error response is
> > > > enabled by default in the platform integration.
> > >
> > > Got feedback from the imx6 owner that imx6 like the dra7xx has the
> > > error response enabled by default.  Now it's clear that the problem
> > > on all these platforms is the same.
> >
> > On IMX6, enabled by default and read-only ? Or it can be changed ?
> 
> The AXI/AHB Bridge Slave Error Response Register is a common register of DWC 
> IP,
> so I think it should be writeable. Richard, can you help to confirm?
> 
This register is writable, but only some bits of this reg can be wrote.

Best Regards
Richard Zhu

> > What's the plan for layerscape on this matter ?
> 
> I trend to change it back to the default error response behavior so that won't
> cause any error on CFG access, and have sent out the patch.
> And for the link up check before CFG accesses, in the DWC databoot (4.40a), it
> requires link up check before generating CFG requests, so need Gustavo help to
> make sure the reason of this requirement, any potential impact without the 
> link
> up check.
> 
> Thanks,
> Zhiqiang
> >
> > Lorenzo


RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-21 Thread Z.q. Hou
Hi Lorenzo and Richard,

> -Original Message-
> From: Lorenzo Pieralisi 
> Sent: 2020年10月20日 17:55
> To: Z.q. Hou 
> Cc: Kishon Vijay Abraham I ; Bjorn Helgaas
> ; linux-kernel@vger.kernel.org;
> linux-...@vger.kernel.org; r...@kernel.org; bhelg...@google.com;
> gustavo.pimen...@synopsys.com
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> On Tue, Oct 20, 2020 at 02:13:13AM +, Z.q. Hou wrote:
> 
> [...]
> 
> > > > For NXP Layerscape platforms (the ls1028a and ls2088a are also NXP
> > > Layerscape platform), as the error response to AXI/AHB was enabled,
> > > it will get UR error and trigger SError on AXI bus when it accesses
> > > a non-existent BDF on a link down bus. I'm not clear about how it
> > > happens on dra7xxx and imx6, since they doesn't enable the error
> response to AXI/AHB.
> > >
> > > That's exactly the case with DRA7xx as the error response is enabled
> > > by default in the platform integration.
> >
> > Got feedback from the imx6 owner that imx6 like the dra7xx has the
> > error response enabled by default.  Now it's clear that the problem on
> > all these platforms is the same.
> 
> On IMX6, enabled by default and read-only ? Or it can be changed ? 

The AXI/AHB Bridge Slave Error Response Register is a common register of DWC 
IP, so I think it should be writeable. Richard, can you help to confirm?

> What's the plan for layerscape on this matter ?

I trend to change it back to the default error response behavior so that won't 
cause any error on CFG access, and have sent out the patch.
And for the link up check before CFG accesses, in the DWC databoot (4.40a), it 
requires link up check before generating CFG requests, so need Gustavo help to 
make sure the reason of this requirement, any potential impact without the link 
up check.

Thanks,
Zhiqiang
> 
> Lorenzo


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-20 Thread Lorenzo Pieralisi
On Thu, Oct 15, 2020 at 05:47:38PM -0500, Bjorn Helgaas wrote:
> On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> > 
> > 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.
> 
> Lorenzo already applied this, but a couple questions:
> 
> You call out NXP Layerscape specifically, but doesn't this affect
> other DWC-based platforms, too?  You later mentioned imx6, Kishon
> mentioned dra7xx, Michael mentioned ls1028a, Naresh mentioned ls2088
> (probably both the same as your "NXP Layerscape").
> 
> The backtrace below contains a bunch of irrelevant info.  The
> timestamps are pointless.  The backtrace past
> pci_scan_single_device+0x80/0x100 or so really doesn't add anything
> either.
> 
> It'd be nice to have a comment in the code because the code *looks*
> wrong and racy.  Without a hint, everybody who sees it will have to
> dig through the history to see why we tolerate the race.

I have updated the commit log the best I could with the information
I have, pci/dwc branch. Please all have a look and report any issue
you may find.

This link-up check is nonetheless broken and we should find a long
term solution that is not relying on these shaky fixes.

Lorenzo

> > [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> > [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807776] Hardware name: LS1046A RDB Board (DT)
> > [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> > [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> > [0.807778] lr : pci_generic_config_read+0x24/0xe0
> > [0.807779] sp : 80001003b7b0
> > [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> > [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> > [0.807784] x25: 80001003b874 x24: 80001003b924
> > [0.807786] x23: 0004 x22: 
> > [0.807788] x21:  x20: 80001003b874
> > [0.807790] x19: 0004 x18: 
> > [0.807791] x17: 00c0 x16: fe0025981840
> > [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> > [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> > [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> > [0.807799] x9 : 203d206e66766564 x8 : 0908
> > [0.807801] x7 : 0908 x6 : 80001090
> > [0.807802] x5 : 00096e77e080 x4 : 
> > [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> > [0.807806] x1 :  x0 : 800010034000
> > [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> > [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807810] Hardware name: LS1046A RDB Board (DT)
> > [0.807811] Call trace:
> > [0.807812]  dump_backtrace+0x0/0x1c0
> > [0.807813]  show_stack+0x18/0x28
> > [0.807814]  dump_stack+0xd8/0x134
> > [0.807814]  panic+0x180/0x398
> > [0.807815]  add_taint+0x0/0xb0
> > [0.807816]  arm64_serror_panic+0x78/0x88
> > [0.807817]  do_serror+0x68/0x180
> > [0.807818]  el1_error+0x84/0x100
> > [0.807818]  pci_generic_config_read+0x3c/0xe0
> > [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> > [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> > [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> > [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> > [0.807823]  pci_scan_single_device+0x80/0x100
> > [0.807824]  pci_scan_slot+0x38/0x130
> > [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> > [0.807826]  pci_scan_child_bus+0x14/0x20
> > [0.807827]  pci_scan_bridge_extend+0x230/0x570
> > [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> > [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> > [0.807829]  pci_host_probe+0x18/0xc8
> > [0.807830]  dw_pcie_host_init+0x220/0x378
> > [0.807831]  ls_pcie_probe+0x104/0x140
> > [0.807832]  platform_drv_probe+0x54/0xa8
> > [0.807833]  really_probe+0x118/0x3e0
> > [0.807834]  driver_probe_device+0x5c/0xc0
> > [0.807835]  device_driver_attach+0x74/0x80
> > [0.807835]  __driver_attach+0x8c/0xd8
> > [0.807836]  bus_for_each_dev+0x7c/0xd8
> > [0.807837]  driver_attach+0x24/0x30
> > [0.807838]  bus_add_driver+0x154/0x200
> > [0.807839]  driver_register+0x64/0x120
> > [0.807839]  __platform_driver_probe+0x7c/0x148
> > [0.807840]  ls_pcie_driver_init+0x24/0x30
> > [0.807841]  do_one_initcall+0x60/0x1d8
> > [0.807842]  kernel_init_freeable+0x1f4/0x24c
> > [0.807843]  

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-20 Thread Lorenzo Pieralisi
On Tue, Oct 20, 2020 at 02:13:13AM +, Z.q. Hou wrote:

[...]

> > > For NXP Layerscape platforms (the ls1028a and ls2088a are also NXP
> > Layerscape platform), as the error response to AXI/AHB was enabled, it will
> > get UR error and trigger SError on AXI bus when it accesses a non-existent
> > BDF on a link down bus. I'm not clear about how it happens on dra7xxx and
> > imx6, since they doesn't enable the error response to AXI/AHB.
> > 
> > That's exactly the case with DRA7xx as the error response is enabled by
> > default in the platform integration.
> 
> Got feedback from the imx6 owner that imx6 like the dra7xx has the
> error response enabled by default.  Now it's clear that the problem on
> all these platforms is the same.

On IMX6, enabled by default and read-only ? Or it can be changed ? What's
the plan for layerscape on this matter ?

Lorenzo


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-20 Thread Lorenzo Pieralisi
On Fri, Sep 18, 2020 at 09:27:40AM -0600, Rob Herring wrote:

[...]

> > > 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.

We don't need to fail probe - just skip enumeration. Is there an IRQ
event associated with link coming up ? Scanning the bus can be done
upon link-up IRQ.

For platforms that forward the link down as an SError this still does
not solve the problem (if the link goes down unexpectedly) but I
question their design in the first place, this patch does not fix their
behaviour regardless.

Lorenzo


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-20 Thread Lorenzo Pieralisi
On Tue, Oct 20, 2020 at 02:13:13AM +, Z.q. Hou wrote:

[...]

> > > For NXP Layerscape platforms (the ls1028a and ls2088a are also NXP
> > Layerscape platform), as the error response to AXI/AHB was enabled, it will
> > get UR error and trigger SError on AXI bus when it accesses a non-existent
> > BDF on a link down bus. I'm not clear about how it happens on dra7xxx and
> > imx6, since they doesn't enable the error response to AXI/AHB.
> > 
> > That's exactly the case with DRA7xx as the error response is enabled by
> > default in the platform integration.
> 
> Got feedback from the imx6 owner that imx6 like the dra7xx has the
> error response enabled by default.  Now it's clear that the problem on
> all these platforms is the same.

Ok. Now the question is: on these platforms we trigger an SError because
the link is down. If the link is down there is no point in enumerating
the PCI hierarchy, is there ? If I am right the link-up check should be
moved at probe time and skip enumeration if the link is down, map_bus()
is not really the place where it should be - having it there is
misleading and it is racy code whatever we do.

We may still merge this code as a temporary workaround but the DWC
drivers should be reworked to skip enumeration if the link is down.

Please let me know if my reading is correct.

Thanks,
Lorenzo

> Thanks,
> Zhiqiang
> 
> > 
> > Thanks
> > Kishon
> > 
> > >
> > >>
> > >> The backtrace below contains a bunch of irrelevant info.  The
> > >> timestamps are pointless.  The backtrace past
> > >> pci_scan_single_device+0x80/0x100 or so really doesn't add anything
> > either.
> > >>
> > >> It'd be nice to have a comment in the code because the code *looks*
> > >> wrong and racy.  Without a hint, everybody who sees it will have to
> > >> dig through the history to see why we tolerate the race.
> > >
> > > Yes, agree, but seems the cause of the SError on dra7xx and imx6 is
> > different from Layerscape platforms, we need to make it clear first.
> > >
> > > Thanks,
> > > Zhiqiang
> > >
> > >>
> > >>> [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> > >>> [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
> > >> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > >>> [0.807776] Hardware name: LS1046A RDB Board (DT)
> > >>> [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> > >>> [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> > >>> [0.807778] lr : pci_generic_config_read+0x24/0xe0
> > >>> [0.807779] sp : 80001003b7b0
> > >>> [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> > >>> [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> > >>> [0.807784] x25: 80001003b874 x24: 80001003b924
> > >>> [0.807786] x23: 0004 x22: 
> > >>> [0.807788] x21:  x20: 80001003b874
> > >>> [0.807790] x19: 0004 x18: 
> > >>> [0.807791] x17: 00c0 x16: fe0025981840
> > >>> [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> > >>> [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> > >>> [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> > >>> [0.807799] x9 : 203d206e66766564 x8 : 0908
> > >>> [0.807801] x7 : 0908 x6 : 80001090
> > >>> [0.807802] x5 : 00096e77e080 x4 : 
> > >>> [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> > >>> [0.807806] x1 :  x0 : 800010034000
> > >>> [0.807808] Kernel panic - not syncing: Asynchronous SError
> > Interrupt
> > >>> [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
> > >> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > >>> [0.807810] Hardware name: LS1046A RDB Board (DT)
> > >>> [0.807811] Call trace:
> > >>> [0.807812]  dump_backtrace+0x0/0x1c0
> > >>> [0.807813]  show_stack+0x18/0x28
> > >>> [0.807814]  dump_stack+0xd8/0x134
> > >>> [0.807814]  panic+0x180/0x398
> > >>> [0.807815]  add_taint+0x0/0xb0
> > >>> [0.807816]  arm64_serror_panic+0x78/0x88
> > >>> [0.807817]  do_serror+0x68/0x180
> > >>> [0.807818]  el1_error+0x84/0x100
> > >>> [0.807818]  pci_generic_config_read+0x3c/0xe0
> > >>> [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> > >>> [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> > >>> [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> > >>> [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> > >>> [0.807823]  pci_scan_single_device+0x80/0x100
> > >>> [0.807824]  pci_scan_slot+0x38/0x130
> > >>> [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> > >>> [0.807826]  pci_scan_child_bus+0x14/0x20
> > >>> [0.807827]  pci_scan_bridge_extend+0x230/0x570
> > >>> [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> > >>> [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> > >>> [0.807829]  pci_host_probe+0x18/0xc8
> > >>> [0.807830]  

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-20 Thread Kishon Vijay Abraham I
Hi Lorenzo,

On 19/10/20 9:43 pm, Lorenzo Pieralisi wrote:
> On Mon, Oct 12, 2020 at 04:41:11AM +, Z.q. Hou wrote:
> 
> [...]
> 
> Yeah, I don't see any registers in the DRA7x PCIe wrapper for
> disabling error forwarding.

 It's a DWC port logic register AFAICT, but perhaps not present in all
>>> versions.
>>>
>>> Okay. I see there's a register PCIECTRL_PL_AXIS_SLV_ERR_RESP which has a
>>> reset value of 0.
>>>
>>> It has four bit-fields, RESET_TIMEOUT_ERR_MAP, NO_VID_ERR_MAP,
>>> DBI_ERR_MAP and SLAVE_ERR_MAP. I'm not seeing any difference in
>>> behavior if I set all these bits. Maybe it requires platform support too. 
>>> I'll
>>> check this with our design team.
>>
>> In DWC v4.40a databook, there is a bit AMBA_ERROR_RESPONSE_GLOBAL
>> which controls if enable the error forwarding. The *MAP bits only
>> determine which error (SLVERR or DECERR) will be forwarded to AXI/AHB
>> bus.
> 
> I have not seen a follow-up to this but I would like to, still keen
> on avoiding this patch if possible - if this is port logic it should
> be common across controllers implementations I assume.
> 
> Gustavo, Kishon ?

Atleast in the TI DRA7 TRM, I could see only
PCIECTRL_PL_AXIS_SLV_ERR_RESP and PCIECTRL_PL_AXIS_SLV_TIMEOUT register
but no global error response bit. I'd have expected configuring
SLV_ERR_RESP would have disabled error forwarding, but I don't see any
change in behavior if I modify the value of PCIECTRL_PL_AXIS_SLV_ERR_RESP.

TI PCIe controller in DRA7 is not directly connected to AXI/AHB but
there is an intermediary bridge. So I suspect there is some issue on how
the controller is integrated in TI platform. Since the board hangs, I
couldn't get lot of visibility of controller state.

Thanks
Kishon


RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-19 Thread Z.q. Hou
Hi Bjorn, Lorenzo and Kishon,

> -Original Message-
> From: Kishon Vijay Abraham I 
> Sent: 2020年10月19日 13:41
> To: Z.q. Hou ; Bjorn Helgaas 
> Cc: linux-kernel@vger.kernel.org; linux-...@vger.kernel.org;
> r...@kernel.org; lorenzo.pieral...@arm.com; bhelg...@google.com;
> gustavo.pimen...@synopsys.com
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> Hi Hou,
> 
> On 19/10/20 10:54 am, Z.q. Hou wrote:
> > Hello Bjorn,
> >
> > Thanks a lot for your comments!
> >
> >> -Original Message-
> >> From: Bjorn Helgaas 
> >> Sent: 2020年10月16日 6:48
> >> To: Z.q. Hou 
> >> Cc: linux-kernel@vger.kernel.org; linux-...@vger.kernel.org;
> >> r...@kernel.org; lorenzo.pieral...@arm.com; bhelg...@google.com;
> >> gustavo.pimen...@synopsys.com
> >> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> >> dw_child_pcie_ops
> >>
> >> On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> >>> From: Hou Zhiqiang 
> >>>
> >>> 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.
> >>
> >> Lorenzo already applied this, but a couple questions:
> >>
> >> You call out NXP Layerscape specifically, but doesn't this affect
> >> other DWC-based platforms, too?  You later mentioned imx6, Kishon
> >> mentioned dra7xx, Michael mentioned ls1028a, Naresh mentioned ls2088
> >> (probably both the same as your "NXP Layerscape").
> >
> > For NXP Layerscape platforms (the ls1028a and ls2088a are also NXP
> Layerscape platform), as the error response to AXI/AHB was enabled, it will
> get UR error and trigger SError on AXI bus when it accesses a non-existent
> BDF on a link down bus. I'm not clear about how it happens on dra7xxx and
> imx6, since they doesn't enable the error response to AXI/AHB.
> 
> That's exactly the case with DRA7xx as the error response is enabled by
> default in the platform integration.

Got feedback from the imx6 owner that imx6 like the dra7xx has the error 
response enabled by default.
Now it's clear that the problem on all these platforms is the same.

Thanks,
Zhiqiang

> 
> Thanks
> Kishon
> 
> >
> >>
> >> The backtrace below contains a bunch of irrelevant info.  The
> >> timestamps are pointless.  The backtrace past
> >> pci_scan_single_device+0x80/0x100 or so really doesn't add anything
> either.
> >>
> >> It'd be nice to have a comment in the code because the code *looks*
> >> wrong and racy.  Without a hint, everybody who sees it will have to
> >> dig through the history to see why we tolerate the race.
> >
> > Yes, agree, but seems the cause of the SError on dra7xx and imx6 is
> different from Layerscape platforms, we need to make it clear first.
> >
> > Thanks,
> > Zhiqiang
> >
> >>
> >>> [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> >>> [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
> >> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> >>> [0.807776] Hardware name: LS1046A RDB Board (DT)
> >>> [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> >>> [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> >>> [0.807778] lr : pci_generic_config_read+0x24/0xe0
> >>> [0.807779] sp : 80001003b7b0
> >>> [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> >>> [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> >>> [0.807784] x25: 80001003b874 x24: 80001003b924
> >>> [0.807786] x23: 0004 x22: 
> >>> [0.807788] x21:  x20: 80001003b874
> >>> [0.807790] x19: 0004 x18: 
> >>> [0.807791] x17: 00c0 x16: fe0025981840
> >>> [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> >>> [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> >>> [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> >>> [0.807799] x9 : 203d206e66766564 x8 : 0908
> >>> [0.807801] x7 : 0908 x6 : 80001090
> >>&

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-19 Thread Lorenzo Pieralisi
On Thu, Oct 15, 2020 at 05:47:38PM -0500, Bjorn Helgaas wrote:
> On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> > 
> > 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.
> 
> Lorenzo already applied this, but a couple questions:
> 
> You call out NXP Layerscape specifically, but doesn't this affect
> other DWC-based platforms, too?  You later mentioned imx6, Kishon
> mentioned dra7xx, Michael mentioned ls1028a, Naresh mentioned ls2088
> (probably both the same as your "NXP Layerscape").
> 
> The backtrace below contains a bunch of irrelevant info.  The
> timestamps are pointless.  The backtrace past
> pci_scan_single_device+0x80/0x100 or so really doesn't add anything
> either.
> 
> It'd be nice to have a comment in the code because the code *looks*
> wrong and racy.  Without a hint, everybody who sees it will have to
> dig through the history to see why we tolerate the race.

I can add the comment myself, I improved the backtrace and I can
try to summarize why error forwarding can't be disabled even though
I would appreciate more help from DWC maintainers - as I don't have
access to DWC specs.

This patch is a workaround at best but I am not sure we went all the way
to prevent it - I am quite tempted to drop it and postpone it to -rc*.

Lorenzo

> 
> > [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> > [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807776] Hardware name: LS1046A RDB Board (DT)
> > [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> > [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> > [0.807778] lr : pci_generic_config_read+0x24/0xe0
> > [0.807779] sp : 80001003b7b0
> > [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> > [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> > [0.807784] x25: 80001003b874 x24: 80001003b924
> > [0.807786] x23: 0004 x22: 
> > [0.807788] x21:  x20: 80001003b874
> > [0.807790] x19: 0004 x18: 
> > [0.807791] x17: 00c0 x16: fe0025981840
> > [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> > [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> > [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> > [0.807799] x9 : 203d206e66766564 x8 : 0908
> > [0.807801] x7 : 0908 x6 : 80001090
> > [0.807802] x5 : 00096e77e080 x4 : 
> > [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> > [0.807806] x1 :  x0 : 800010034000
> > [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> > [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807810] Hardware name: LS1046A RDB Board (DT)
> > [0.807811] Call trace:
> > [0.807812]  dump_backtrace+0x0/0x1c0
> > [0.807813]  show_stack+0x18/0x28
> > [0.807814]  dump_stack+0xd8/0x134
> > [0.807814]  panic+0x180/0x398
> > [0.807815]  add_taint+0x0/0xb0
> > [0.807816]  arm64_serror_panic+0x78/0x88
> > [0.807817]  do_serror+0x68/0x180
> > [0.807818]  el1_error+0x84/0x100
> > [0.807818]  pci_generic_config_read+0x3c/0xe0
> > [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> > [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> > [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> > [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> > [0.807823]  pci_scan_single_device+0x80/0x100
> > [0.807824]  pci_scan_slot+0x38/0x130
> > [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> > [0.807826]  pci_scan_child_bus+0x14/0x20
> > [0.807827]  pci_scan_bridge_extend+0x230/0x570
> > [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> > [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> > [0.807829]  pci_host_probe+0x18/0xc8
> > [0.807830]  dw_pcie_host_init+0x220/0x378
> > [0.807831]  ls_pcie_probe+0x104/0x140
> > [0.807832]  platform_drv_probe+0x54/0xa8
> > [0.807833]  really_probe+0x118/0x3e0
> > [0.807834]  driver_probe_device+0x5c/0xc0
> > [0.807835]  device_driver_attach+0x74/0x80
> > [0.807835]  __driver_attach+0x8c/0xd8
> > [0.807836]  bus_for_each_dev+0x7c/0xd8
> > [0.807837]  driver_attach+0x24/0x30
> > [0.807838]  bus_add_driver+0x154/0x200
> > [0.807839]  driver_register+0x64/0x120
> > [0.807839]  __platform_driver_probe+0x7c/0x148
> > [0.807840]  ls_pcie_driver_init+0x24/0x30
> > [0.807841]  

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-19 Thread Lorenzo Pieralisi
On Mon, Oct 12, 2020 at 04:41:11AM +, Z.q. Hou wrote:

[...]

> > >> Yeah, I don't see any registers in the DRA7x PCIe wrapper for
> > >> disabling error forwarding.
> > >
> > > It's a DWC port logic register AFAICT, but perhaps not present in all
> > versions.
> > 
> > Okay. I see there's a register PCIECTRL_PL_AXIS_SLV_ERR_RESP which has a
> > reset value of 0.
> > 
> > It has four bit-fields, RESET_TIMEOUT_ERR_MAP, NO_VID_ERR_MAP,
> > DBI_ERR_MAP and SLAVE_ERR_MAP. I'm not seeing any difference in
> > behavior if I set all these bits. Maybe it requires platform support too. 
> > I'll
> > check this with our design team.
> 
> In DWC v4.40a databook, there is a bit AMBA_ERROR_RESPONSE_GLOBAL
> which controls if enable the error forwarding. The *MAP bits only
> determine which error (SLVERR or DECERR) will be forwarded to AXI/AHB
> bus.

I have not seen a follow-up to this but I would like to, still keen
on avoiding this patch if possible - if this is port logic it should
be common across controllers implementations I assume.

Gustavo, Kishon ?

Thanks,
Lorenzo

> Thanks,
> Zhiqiang
> 
> > 
> > Meanwhile would it be okay to add linkup check atleast for DRA7X so that
> > we could have it booting in linux-next?
> > 
> > Thanks
> > Kishon


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-18 Thread Kishon Vijay Abraham I
Hi Hou,

On 19/10/20 10:54 am, Z.q. Hou wrote:
> Hello Bjorn,
> 
> Thanks a lot for your comments!
> 
>> -Original Message-
>> From: Bjorn Helgaas 
>> Sent: 2020年10月16日 6:48
>> To: Z.q. Hou 
>> Cc: linux-kernel@vger.kernel.org; linux-...@vger.kernel.org;
>> r...@kernel.org; lorenzo.pieral...@arm.com; bhelg...@google.com;
>> gustavo.pimen...@synopsys.com
>> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
>> dw_child_pcie_ops
>>
>> On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
>>> From: Hou Zhiqiang 
>>>
>>> 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.
>>
>> Lorenzo already applied this, but a couple questions:
>>
>> You call out NXP Layerscape specifically, but doesn't this affect other
>> DWC-based platforms, too?  You later mentioned imx6, Kishon mentioned
>> dra7xx, Michael mentioned ls1028a, Naresh mentioned ls2088 (probably
>> both the same as your "NXP Layerscape").
> 
> For NXP Layerscape platforms (the ls1028a and ls2088a are also NXP Layerscape 
> platform), as the error response to AXI/AHB was enabled, it will get UR error 
> and trigger SError on AXI bus when it accesses a non-existent BDF on a link 
> down bus. I'm not clear about how it happens on dra7xxx and imx6, since they 
> doesn't enable the error response to AXI/AHB.

That's exactly the case with DRA7xx as the error response is enabled by
default in the platform integration.

Thanks
Kishon

> 
>>
>> The backtrace below contains a bunch of irrelevant info.  The timestamps
>> are pointless.  The backtrace past
>> pci_scan_single_device+0x80/0x100 or so really doesn't add anything either.
>>
>> It'd be nice to have a comment in the code because the code *looks* wrong
>> and racy.  Without a hint, everybody who sees it will have to dig through
>> the history to see why we tolerate the race.
> 
> Yes, agree, but seems the cause of the SError on dra7xx and imx6 is different 
> from Layerscape platforms, we need to make it clear first.
> 
> Thanks,
> Zhiqiang
>  
>>
>>> [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
>>> [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
>> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
>>> [0.807776] Hardware name: LS1046A RDB Board (DT)
>>> [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
>>> [0.807778] pc : pci_generic_config_read+0x3c/0xe0
>>> [0.807778] lr : pci_generic_config_read+0x24/0xe0
>>> [0.807779] sp : 80001003b7b0
>>> [0.807780] x29: 80001003b7b0 x28: 80001003ba74
>>> [0.807782] x27: 000971d96800 x26: 00096e77e0a8
>>> [0.807784] x25: 80001003b874 x24: 80001003b924
>>> [0.807786] x23: 0004 x22: 
>>> [0.807788] x21:  x20: 80001003b874
>>> [0.807790] x19: 0004 x18: 
>>> [0.807791] x17: 00c0 x16: fe0025981840
>>> [0.807793] x15: b94c75b69948 x14: 62203a383634203a
>>> [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
>>> [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
>>> [0.807799] x9 : 203d206e66766564 x8 : 0908
>>> [0.807801] x7 : 0908 x6 : 80001090
>>> [0.807802] x5 : 00096e77e080 x4 : 
>>> [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
>>> [0.807806] x1 :  x0 : 800010034000
>>> [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
>>> [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
>> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
>>> [0.807810] Hardware name: LS1046A RDB Board (DT)
>>> [0.807811] Call trace:
>>> [0.807812]  dump_backtrace+0x0/0x1c0
>>> [0.807813]  show_stack+0x18/0x28
>>> [0.807814]  dump_stack+0xd8/0x134
>>> [0.807814]  panic+0x180/0x398
>>> [0.807815]  add_taint+0x0/0xb0
>>> [0.807816]  arm64_serror_panic+0x78/0x88
>>> [0.807817]  do_serror+0x68/0x180
>>> [0.807818]  el1_error+0x84/0x100
>>> [0.807818]  pci_generic_config_read+0x3c/0xe0
>&g

RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-18 Thread Z.q. Hou
Hello Bjorn,

Thanks a lot for your comments!

> -Original Message-
> From: Bjorn Helgaas 
> Sent: 2020年10月16日 6:48
> To: Z.q. Hou 
> Cc: linux-kernel@vger.kernel.org; linux-...@vger.kernel.org;
> r...@kernel.org; lorenzo.pieral...@arm.com; bhelg...@google.com;
> gustavo.pimen...@synopsys.com
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> >
> > 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.
> 
> Lorenzo already applied this, but a couple questions:
> 
> You call out NXP Layerscape specifically, but doesn't this affect other
> DWC-based platforms, too?  You later mentioned imx6, Kishon mentioned
> dra7xx, Michael mentioned ls1028a, Naresh mentioned ls2088 (probably
> both the same as your "NXP Layerscape").

For NXP Layerscape platforms (the ls1028a and ls2088a are also NXP Layerscape 
platform), as the error response to AXI/AHB was enabled, it will get UR error 
and trigger SError on AXI bus when it accesses a non-existent BDF on a link 
down bus. I'm not clear about how it happens on dra7xxx and imx6, since they 
doesn't enable the error response to AXI/AHB.

> 
> The backtrace below contains a bunch of irrelevant info.  The timestamps
> are pointless.  The backtrace past
> pci_scan_single_device+0x80/0x100 or so really doesn't add anything either.
> 
> It'd be nice to have a comment in the code because the code *looks* wrong
> and racy.  Without a hint, everybody who sees it will have to dig through
> the history to see why we tolerate the race.

Yes, agree, but seems the cause of the SError on dra7xx and imx6 is different 
from Layerscape platforms, we need to make it clear first.

Thanks,
Zhiqiang
 
> 
> > [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> > [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807776] Hardware name: LS1046A RDB Board (DT)
> > [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> > [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> > [0.807778] lr : pci_generic_config_read+0x24/0xe0
> > [0.807779] sp : 80001003b7b0
> > [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> > [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> > [0.807784] x25: 80001003b874 x24: 80001003b924
> > [0.807786] x23: 0004 x22: 
> > [0.807788] x21:  x20: 80001003b874
> > [0.807790] x19: 0004 x18: 
> > [0.807791] x17: 00c0 x16: fe0025981840
> > [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> > [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> > [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> > [0.807799] x9 : 203d206e66766564 x8 : 0908
> > [0.807801] x7 : 0908 x6 : 80001090
> > [0.807802] x5 : 00096e77e080 x4 : 
> > [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> > [0.807806] x1 :  x0 : 800010034000
> > [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> > [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807810] Hardware name: LS1046A RDB Board (DT)
> > [0.807811] Call trace:
> > [0.807812]  dump_backtrace+0x0/0x1c0
> > [0.807813]  show_stack+0x18/0x28
> > [0.807814]  dump_stack+0xd8/0x134
> > [0.807814]  panic+0x180/0x398
> > [0.807815]  add_taint+0x0/0xb0
> > [0.807816]  arm64_serror_panic+0x78/0x88
> > [0.807817]  do_serror+0x68/0x180
> > [0.807818]  el1_error+0x84/0x100
> > [0.807818]  pci_generic_config_read+0x3c/0xe0
> > [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> > [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> > [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> > [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> > [0.807823]  pci_scan_single_device+0x80/0x100
> > [0.807824]  pci_scan_slot+0x38/0x130
> > [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> > [0.807826]  pci_scan_child_bus+0x14/0x20
> > [0.807827

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-16 Thread Lorenzo Pieralisi
On Thu, Oct 15, 2020 at 05:47:38PM -0500, Bjorn Helgaas wrote:
> On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> > 
> > 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.
> 
> Lorenzo already applied this, but a couple questions:

Happy to drop it - I merged it because it is a regression but
that's certainly not a proper fix either.

> You call out NXP Layerscape specifically, but doesn't this affect
> other DWC-based platforms, too?  You later mentioned imx6, Kishon
> mentioned dra7xx, Michael mentioned ls1028a, Naresh mentioned ls2088
> (probably both the same as your "NXP Layerscape").
> 
> The backtrace below contains a bunch of irrelevant info.  The
> timestamps are pointless.  The backtrace past
> pci_scan_single_device+0x80/0x100 or so really doesn't add anything
> either.

I can trim the log message easily but I certainly agree with you
the problem in this patch is the usual racy link check that still
nobody can explains and that we were trying to remove.

It would be very good if the respective platform maintainers went
the extra mile to help here, Rob and I don't have this HW.

Shall we drop this patch and investigate further (possibly hitting
-rc1 with a fix containing a decent explanation ?)

> 
> It'd be nice to have a comment in the code because the code *looks*
> wrong and racy.  Without a hint, everybody who sees it will have to
> dig through the history to see why we tolerate the race.

+1, see above, ready to drop it.

Lorenzo

> > [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> > [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807776] Hardware name: LS1046A RDB Board (DT)
> > [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> > [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> > [0.807778] lr : pci_generic_config_read+0x24/0xe0
> > [0.807779] sp : 80001003b7b0
> > [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> > [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> > [0.807784] x25: 80001003b874 x24: 80001003b924
> > [0.807786] x23: 0004 x22: 
> > [0.807788] x21:  x20: 80001003b874
> > [0.807790] x19: 0004 x18: 
> > [0.807791] x17: 00c0 x16: fe0025981840
> > [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> > [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> > [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> > [0.807799] x9 : 203d206e66766564 x8 : 0908
> > [0.807801] x7 : 0908 x6 : 80001090
> > [0.807802] x5 : 00096e77e080 x4 : 
> > [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> > [0.807806] x1 :  x0 : 800010034000
> > [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> > [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807810] Hardware name: LS1046A RDB Board (DT)
> > [0.807811] Call trace:
> > [0.807812]  dump_backtrace+0x0/0x1c0
> > [0.807813]  show_stack+0x18/0x28
> > [0.807814]  dump_stack+0xd8/0x134
> > [0.807814]  panic+0x180/0x398
> > [0.807815]  add_taint+0x0/0xb0
> > [0.807816]  arm64_serror_panic+0x78/0x88
> > [0.807817]  do_serror+0x68/0x180
> > [0.807818]  el1_error+0x84/0x100
> > [0.807818]  pci_generic_config_read+0x3c/0xe0
> > [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> > [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> > [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> > [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> > [0.807823]  pci_scan_single_device+0x80/0x100
> > [0.807824]  pci_scan_slot+0x38/0x130
> > [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> > [0.807826]  pci_scan_child_bus+0x14/0x20
> > [0.807827]  pci_scan_bridge_extend+0x230/0x570
> > [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> > [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> > [0.807829]  pci_host_probe+0x18/0xc8
> > [0.807830]  dw_pcie_host_init+0x220/0x378
> > [0.807831]  ls_pcie_probe+0x104/0x140
> > [0.807832]  platform_drv_probe+0x54/0xa8
> > [0.807833]  really_probe+0x118/0x3e0
> > [0.807834]  driver_probe_device+0x5c/0xc0
> > [0.807835]  device_driver_attach+0x74/0x80
> > [0.807835]  __driver_attach+0x8c/0xd8
> > [0.807836]  bus_for_each_dev+0x7c/0xd8
> > [0.807837]  driver_attach+0x24/0x30
> > [0.807838]  

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-15 Thread Bjorn Helgaas
On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> From: Hou Zhiqiang 
> 
> 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.

Lorenzo already applied this, but a couple questions:

You call out NXP Layerscape specifically, but doesn't this affect
other DWC-based platforms, too?  You later mentioned imx6, Kishon
mentioned dra7xx, Michael mentioned ls1028a, Naresh mentioned ls2088
(probably both the same as your "NXP Layerscape").

The backtrace below contains a bunch of irrelevant info.  The
timestamps are pointless.  The backtrace past
pci_scan_single_device+0x80/0x100 or so really doesn't add anything
either.

It'd be nice to have a comment in the code because the code *looks*
wrong and racy.  Without a hint, everybody who sees it will have to
dig through the history to see why we tolerate the race.

> [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807776] Hardware name: LS1046A RDB Board (DT)
> [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> [0.807778] lr : pci_generic_config_read+0x24/0xe0
> [0.807779] sp : 80001003b7b0
> [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> [0.807784] x25: 80001003b874 x24: 80001003b924
> [0.807786] x23: 0004 x22: 
> [0.807788] x21:  x20: 80001003b874
> [0.807790] x19: 0004 x18: 
> [0.807791] x17: 00c0 x16: fe0025981840
> [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> [0.807799] x9 : 203d206e66766564 x8 : 0908
> [0.807801] x7 : 0908 x6 : 80001090
> [0.807802] x5 : 00096e77e080 x4 : 
> [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> [0.807806] x1 :  x0 : 800010034000
> [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807810] Hardware name: LS1046A RDB Board (DT)
> [0.807811] Call trace:
> [0.807812]  dump_backtrace+0x0/0x1c0
> [0.807813]  show_stack+0x18/0x28
> [0.807814]  dump_stack+0xd8/0x134
> [0.807814]  panic+0x180/0x398
> [0.807815]  add_taint+0x0/0xb0
> [0.807816]  arm64_serror_panic+0x78/0x88
> [0.807817]  do_serror+0x68/0x180
> [0.807818]  el1_error+0x84/0x100
> [0.807818]  pci_generic_config_read+0x3c/0xe0
> [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> [0.807823]  pci_scan_single_device+0x80/0x100
> [0.807824]  pci_scan_slot+0x38/0x130
> [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> [0.807826]  pci_scan_child_bus+0x14/0x20
> [0.807827]  pci_scan_bridge_extend+0x230/0x570
> [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> [0.807829]  pci_host_probe+0x18/0xc8
> [0.807830]  dw_pcie_host_init+0x220/0x378
> [0.807831]  ls_pcie_probe+0x104/0x140
> [0.807832]  platform_drv_probe+0x54/0xa8
> [0.807833]  really_probe+0x118/0x3e0
> [0.807834]  driver_probe_device+0x5c/0xc0
> [0.807835]  device_driver_attach+0x74/0x80
> [0.807835]  __driver_attach+0x8c/0xd8
> [0.807836]  bus_for_each_dev+0x7c/0xd8
> [0.807837]  driver_attach+0x24/0x30
> [0.807838]  bus_add_driver+0x154/0x200
> [0.807839]  driver_register+0x64/0x120
> [0.807839]  __platform_driver_probe+0x7c/0x148
> [0.807840]  ls_pcie_driver_init+0x24/0x30
> [0.807841]  do_one_initcall+0x60/0x1d8
> [0.807842]  kernel_init_freeable+0x1f4/0x24c
> [0.807843]  kernel_init+0x14/0x118
> [0.807843]  ret_from_fork+0x10/0x34
> [0.807854] SMP: stopping secondary CPUs
> [0.807855] Kernel Offset: 0x394c6408 from 0x80001000
> [0.807856] PHYS_OFFSET: 0x8bfd4000
> [0.807856] CPU features: 0x0240022,21806000
> [0.807857] Memory Limit: none
> 
> Fixes: c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")
> Signed-off-by: Hou Zhiqiang 
> ---
>  drivers/pci/controller/dwc/pcie-designware-host.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git 

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-14 Thread Rob Herring
On Wed, Oct 14, 2020 at 6:13 AM Lorenzo Pieralisi
 wrote:
>
> On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> >
> > 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.
> >
> > [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> > [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807776] Hardware name: LS1046A RDB Board (DT)
> > [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> > [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> > [0.807778] lr : pci_generic_config_read+0x24/0xe0
> > [0.807779] sp : 80001003b7b0
> > [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> > [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> > [0.807784] x25: 80001003b874 x24: 80001003b924
> > [0.807786] x23: 0004 x22: 
> > [0.807788] x21:  x20: 80001003b874
> > [0.807790] x19: 0004 x18: 
> > [0.807791] x17: 00c0 x16: fe0025981840
> > [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> > [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> > [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> > [0.807799] x9 : 203d206e66766564 x8 : 0908
> > [0.807801] x7 : 0908 x6 : 80001090
> > [0.807802] x5 : 00096e77e080 x4 : 
> > [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> > [0.807806] x1 :  x0 : 800010034000
> > [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> > [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> > 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807810] Hardware name: LS1046A RDB Board (DT)
> > [0.807811] Call trace:
> > [0.807812]  dump_backtrace+0x0/0x1c0
> > [0.807813]  show_stack+0x18/0x28
> > [0.807814]  dump_stack+0xd8/0x134
> > [0.807814]  panic+0x180/0x398
> > [0.807815]  add_taint+0x0/0xb0
> > [0.807816]  arm64_serror_panic+0x78/0x88
> > [0.807817]  do_serror+0x68/0x180
> > [0.807818]  el1_error+0x84/0x100
> > [0.807818]  pci_generic_config_read+0x3c/0xe0
> > [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> > [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> > [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> > [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> > [0.807823]  pci_scan_single_device+0x80/0x100
> > [0.807824]  pci_scan_slot+0x38/0x130
> > [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> > [0.807826]  pci_scan_child_bus+0x14/0x20
> > [0.807827]  pci_scan_bridge_extend+0x230/0x570
> > [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> > [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> > [0.807829]  pci_host_probe+0x18/0xc8
> > [0.807830]  dw_pcie_host_init+0x220/0x378
> > [0.807831]  ls_pcie_probe+0x104/0x140
> > [0.807832]  platform_drv_probe+0x54/0xa8
> > [0.807833]  really_probe+0x118/0x3e0
> > [0.807834]  driver_probe_device+0x5c/0xc0
> > [0.807835]  device_driver_attach+0x74/0x80
> > [0.807835]  __driver_attach+0x8c/0xd8
> > [0.807836]  bus_for_each_dev+0x7c/0xd8
> > [0.807837]  driver_attach+0x24/0x30
> > [0.807838]  bus_add_driver+0x154/0x200
> > [0.807839]  driver_register+0x64/0x120
> > [0.807839]  __platform_driver_probe+0x7c/0x148
> > [0.807840]  ls_pcie_driver_init+0x24/0x30
> > [0.807841]  do_one_initcall+0x60/0x1d8
> > [0.807842]  kernel_init_freeable+0x1f4/0x24c
> > [0.807843]  kernel_init+0x14/0x118
> > [0.807843]  ret_from_fork+0x10/0x34
> > [0.807854] SMP: stopping secondary CPUs
> > [0.807855] Kernel Offset: 0x394c6408 from 0x80001000
> > [0.807856] PHYS_OFFSET: 0x8bfd4000
> > [0.807856] CPU features: 0x0240022,21806000
> > [0.807857] Memory Limit: none
> >
> > Fixes: c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")
>
> Hi Rob,
>
> can I squash this patch into the commit above ?

Okay on applying, but better to not squash it so we can see why it is needed.

Rob


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-14 Thread Lorenzo Pieralisi
On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> From: Hou Zhiqiang 
> 
> 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.
> 
> [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807776] Hardware name: LS1046A RDB Board (DT)
> [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> [0.807778] lr : pci_generic_config_read+0x24/0xe0
> [0.807779] sp : 80001003b7b0
> [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> [0.807784] x25: 80001003b874 x24: 80001003b924
> [0.807786] x23: 0004 x22: 
> [0.807788] x21:  x20: 80001003b874
> [0.807790] x19: 0004 x18: 
> [0.807791] x17: 00c0 x16: fe0025981840
> [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> [0.807799] x9 : 203d206e66766564 x8 : 0908
> [0.807801] x7 : 0908 x6 : 80001090
> [0.807802] x5 : 00096e77e080 x4 : 
> [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> [0.807806] x1 :  x0 : 800010034000
> [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807810] Hardware name: LS1046A RDB Board (DT)
> [0.807811] Call trace:
> [0.807812]  dump_backtrace+0x0/0x1c0
> [0.807813]  show_stack+0x18/0x28
> [0.807814]  dump_stack+0xd8/0x134
> [0.807814]  panic+0x180/0x398
> [0.807815]  add_taint+0x0/0xb0
> [0.807816]  arm64_serror_panic+0x78/0x88
> [0.807817]  do_serror+0x68/0x180
> [0.807818]  el1_error+0x84/0x100
> [0.807818]  pci_generic_config_read+0x3c/0xe0
> [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> [0.807823]  pci_scan_single_device+0x80/0x100
> [0.807824]  pci_scan_slot+0x38/0x130
> [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> [0.807826]  pci_scan_child_bus+0x14/0x20
> [0.807827]  pci_scan_bridge_extend+0x230/0x570
> [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> [0.807829]  pci_host_probe+0x18/0xc8
> [0.807830]  dw_pcie_host_init+0x220/0x378
> [0.807831]  ls_pcie_probe+0x104/0x140
> [0.807832]  platform_drv_probe+0x54/0xa8
> [0.807833]  really_probe+0x118/0x3e0
> [0.807834]  driver_probe_device+0x5c/0xc0
> [0.807835]  device_driver_attach+0x74/0x80
> [0.807835]  __driver_attach+0x8c/0xd8
> [0.807836]  bus_for_each_dev+0x7c/0xd8
> [0.807837]  driver_attach+0x24/0x30
> [0.807838]  bus_add_driver+0x154/0x200
> [0.807839]  driver_register+0x64/0x120
> [0.807839]  __platform_driver_probe+0x7c/0x148
> [0.807840]  ls_pcie_driver_init+0x24/0x30
> [0.807841]  do_one_initcall+0x60/0x1d8
> [0.807842]  kernel_init_freeable+0x1f4/0x24c
> [0.807843]  kernel_init+0x14/0x118
> [0.807843]  ret_from_fork+0x10/0x34
> [0.807854] SMP: stopping secondary CPUs
> [0.807855] Kernel Offset: 0x394c6408 from 0x80001000
> [0.807856] PHYS_OFFSET: 0x8bfd4000
> [0.807856] CPU features: 0x0240022,21806000
> [0.807857] Memory Limit: none
> 
> Fixes: c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")

Hi Rob,

can I squash this patch into the commit above ?

Thanks,
Lorenzo

> Signed-off-by: Hou Zhiqiang 
> ---
>  drivers/pci/controller/dwc/pcie-designware-host.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c 
> b/drivers/pci/controller/dwc/pcie-designware-host.c
> index c01c9d2fb3f9..e82b518430c5 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -442,6 +442,9 @@ static void __iomem *dw_pcie_other_conf_map_bus(struct 
> pci_bus *bus,
>   struct pcie_port *pp = bus->sysdata;
>   struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
>  
> + if (!dw_pcie_link_up(pci))
> + return NULL;
> +
>   busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) |
>  

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-13 Thread Lorenzo Pieralisi
On Wed, Sep 16, 2020 at 01:41:30PM +0800, Zhiqiang Hou wrote:
> From: Hou Zhiqiang 
> 
> 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.
> 
> [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807776] Hardware name: LS1046A RDB Board (DT)
> [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> [0.807778] lr : pci_generic_config_read+0x24/0xe0
> [0.807779] sp : 80001003b7b0
> [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> [0.807784] x25: 80001003b874 x24: 80001003b924
> [0.807786] x23: 0004 x22: 
> [0.807788] x21:  x20: 80001003b874
> [0.807790] x19: 0004 x18: 
> [0.807791] x17: 00c0 x16: fe0025981840
> [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> [0.807799] x9 : 203d206e66766564 x8 : 0908
> [0.807801] x7 : 0908 x6 : 80001090
> [0.807802] x5 : 00096e77e080 x4 : 
> [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> [0.807806] x1 :  x0 : 800010034000
> [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807810] Hardware name: LS1046A RDB Board (DT)
> [0.807811] Call trace:
> [0.807812]  dump_backtrace+0x0/0x1c0
> [0.807813]  show_stack+0x18/0x28
> [0.807814]  dump_stack+0xd8/0x134
> [0.807814]  panic+0x180/0x398
> [0.807815]  add_taint+0x0/0xb0
> [0.807816]  arm64_serror_panic+0x78/0x88
> [0.807817]  do_serror+0x68/0x180
> [0.807818]  el1_error+0x84/0x100
> [0.807818]  pci_generic_config_read+0x3c/0xe0
> [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> [0.807823]  pci_scan_single_device+0x80/0x100
> [0.807824]  pci_scan_slot+0x38/0x130
> [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> [0.807826]  pci_scan_child_bus+0x14/0x20
> [0.807827]  pci_scan_bridge_extend+0x230/0x570
> [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> [0.807829]  pci_host_probe+0x18/0xc8
> [0.807830]  dw_pcie_host_init+0x220/0x378
> [0.807831]  ls_pcie_probe+0x104/0x140
> [0.807832]  platform_drv_probe+0x54/0xa8
> [0.807833]  really_probe+0x118/0x3e0
> [0.807834]  driver_probe_device+0x5c/0xc0
> [0.807835]  device_driver_attach+0x74/0x80
> [0.807835]  __driver_attach+0x8c/0xd8
> [0.807836]  bus_for_each_dev+0x7c/0xd8
> [0.807837]  driver_attach+0x24/0x30
> [0.807838]  bus_add_driver+0x154/0x200
> [0.807839]  driver_register+0x64/0x120
> [0.807839]  __platform_driver_probe+0x7c/0x148
> [0.807840]  ls_pcie_driver_init+0x24/0x30
> [0.807841]  do_one_initcall+0x60/0x1d8
> [0.807842]  kernel_init_freeable+0x1f4/0x24c
> [0.807843]  kernel_init+0x14/0x118
> [0.807843]  ret_from_fork+0x10/0x34
> [0.807854] SMP: stopping secondary CPUs
> [0.807855] Kernel Offset: 0x394c6408 from 0x80001000
> [0.807856] PHYS_OFFSET: 0x8bfd4000
> [0.807856] CPU features: 0x0240022,21806000
> [0.807857] Memory Limit: none
> 
> Fixes: c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")
> Signed-off-by: Hou Zhiqiang 
> ---
>  drivers/pci/controller/dwc/pcie-designware-host.c | 6 ++
>  1 file changed, 6 insertions(+)

Rob,

do you mind if I squash this in with the commit it is fixing ?

Please let me know.

Thanks,
Lorenzo

> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c 
> b/drivers/pci/controller/dwc/pcie-designware-host.c
> index c01c9d2fb3f9..e82b518430c5 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -442,6 +442,9 @@ static void __iomem *dw_pcie_other_conf_map_bus(struct 
> pci_bus *bus,
>   struct pcie_port *pp = bus->sysdata;
>   struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
>  
> + if (!dw_pcie_link_up(pci))
> + return NULL;
> +
>   busdev = PCIE_ATU_BUS(bus->number) | 

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-12 Thread Kishon Vijay Abraham I
Hi Lorenzo,

On 08/10/20 8:38 pm, Lorenzo Pieralisi wrote:
> On Thu, Oct 01, 2020 at 07:02:04PM +0530, Kishon Vijay Abraham I wrote:
> 
> [...]
> 
 Yeah, I don't see any registers in the DRA7x PCIe wrapper for disabling
 error forwarding.
>>>
>>> It's a DWC port logic register AFAICT, but perhaps not present in all 
>>> versions.
>>
>> Okay. I see there's a register PCIECTRL_PL_AXIS_SLV_ERR_RESP which has a
>> reset value of 0.
>>
>> It has four bit-fields, RESET_TIMEOUT_ERR_MAP, NO_VID_ERR_MAP,
>> DBI_ERR_MAP and SLAVE_ERR_MAP. I'm not seeing any difference in behavior
>> if I set all these bits. Maybe it requires platform support too. I'll
>> check this with our design team.
>>
>> Meanwhile would it be okay to add linkup check atleast for DRA7X so that
>> we could have it booting in linux-next?
> 
> Do you mind sending a patch on top of my pci/dwc please ?

I just tried applying this on your pci/dwc branch and it applied without
any conflicts. Please let me know if you still want me or Hou to resend
the patch.

Thank you,
Kishon


RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-11 Thread Z.q. Hou
Hi Kishon,

> -Original Message-
> From: Kishon Vijay Abraham I 
> Sent: 2020年10月1日 21:32
> To: Rob Herring 
> Cc: Gustavo Pimentel ; Z.q. Hou
> ; Lorenzo Pieralisi ;
> linux-kernel@vger.kernel.org; PCI ; Bjorn
> Helgaas ; Michael Walle ; Ard
> Biesheuvel 
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> Hi Rob,
> 
> On 30/09/20 8:31 pm, Rob Herring wrote:
> > On Wed, Sep 30, 2020 at 8:22 AM Kishon Vijay Abraham I 
> wrote:
> >>
> >> Hi,
> >>
> >> On 29/09/20 10:41 pm, Rob Herring wrote:
> >>> On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel
> >>>  wrote:
> >>>>
> >>>> On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou 
> wrote:
> >>>>
> >>>>> Hi Lorenzo,
> >>>>>
> >>>>> Thanks a lot for your comments!
> >>>>>
> >>>>>> -Original Message-
> >>>>>> From: Lorenzo Pieralisi 
> >>>>>> Sent: 2020年9月28日 17:39
> >>>>>> To: Z.q. Hou 
> >>>>>> Cc: Rob Herring ; linux-kernel@vger.kernel.org;
> >>>>>> PCI ; Bjorn Helgaas
> >>>>>> ; Gustavo Pimentel
> >>>>>> ; Michael Walle
> >>>>>> ; Ard Biesheuvel 
> >>>>>> 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 +, Z.q. Hou wrote:
> >>>>>>> Hi Rob,
> >>>>>>>
> >>>>>>> Thanks a lot for your comments!
> >>>>>>>
> >>>>>>>> -Original Message-
> >>>>>>>> From: Rob Herring 
> >>>>>>>> Sent: 2020年9月18日 23:28
> >>>>>>>> To: Z.q. Hou 
> >>>>>>>> Cc: linux-kernel@vger.kernel.org; PCI
> >>>>>>>> ; Lorenzo Pieralisi
> >>>>>>>> ; Bjorn Helgaas
> >>>>>>>> ; Gustavo Pimentel
> >>>>>>>> ; Michael Walle
> >>>>>> ;
> >>>>>>>> Ard Biesheuvel 
> >>>>>>>> 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
> 
> >>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>> Hi Rob,
> >>>>>>>>>
> >>>>>>>>> Thanks a lot for your comments!
> >>>>>>>>>
> >>>>>>>>>> -Original Message-
> >>>>>>>>>> From: Rob Herring 
> >>>>>>>>>> Sent: 2020年9月17日 4:29
> >>>>>>>>>> To: Z.q. Hou 
> >>>>>>>>>> Cc: linux-kernel@vger.kernel.org; PCI
> >>>>>>>>>> ; Lorenzo Pieralisi
> >>>>>>>>>> ; Bjorn Helgaas
> >>>>>>>>>> ; Gustavo Pimentel
> >>>>>>>>>> ; Michael Walle
> >>>>>>>> ;
> >>>>>>>>>> Ard Biesheuvel 
> >>>>>>>>>> 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
> >>>>>>>> 
> >>>>>>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>> From: Hou Zhiqiang 
> >>>>>>>>>>>
> >>>>>>>>>>> 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.
> >&g

RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-11 Thread Z.q. Hou


> -Original Message-
> From: Rob Herring 
> Sent: 2020年9月30日 1:11
> To: Gustavo Pimentel 
> Cc: Z.q. Hou ; Lorenzo Pieralisi
> ; linux-kernel@vger.kernel.org; PCI
> ; Bjorn Helgaas ;
> Michael Walle ; Ard Biesheuvel 
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel
>  wrote:
> >
> > On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou  wrote:
> >
> > > Hi Lorenzo,
> > >
> > > Thanks a lot for your comments!
> > >
> > > > -Original Message-
> > > > From: Lorenzo Pieralisi 
> > > > Sent: 2020年9月28日 17:39
> > > > To: Z.q. Hou 
> > > > Cc: Rob Herring ; linux-kernel@vger.kernel.org;
> > > > PCI ; Bjorn Helgaas
> > > > ; Gustavo Pimentel
> > > > ; Michael Walle
> ;
> > > > Ard Biesheuvel 
> > > > 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 +, Z.q. Hou wrote:
> > > > > Hi Rob,
> > > > >
> > > > > Thanks a lot for your comments!
> > > > >
> > > > > > -Original Message-
> > > > > > From: Rob Herring 
> > > > > > Sent: 2020年9月18日 23:28
> > > > > > To: Z.q. Hou 
> > > > > > Cc: linux-kernel@vger.kernel.org; PCI
> > > > > > ; Lorenzo Pieralisi
> > > > > > ; Bjorn Helgaas
> > > > > > ; Gustavo Pimentel
> > > > > > ; Michael Walle
> > > > ;
> > > > > > Ard Biesheuvel 
> > > > > > 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
> > > > > > 
> > > > wrote:
> > > > > > >
> > > > > > > Hi Rob,
> > > > > > >
> > > > > > > Thanks a lot for your comments!
> > > > > > >
> > > > > > > > -Original Message-
> > > > > > > > From: Rob Herring 
> > > > > > > > Sent: 2020年9月17日 4:29
> > > > > > > > To: Z.q. Hou 
> > > > > > > > Cc: linux-kernel@vger.kernel.org; PCI
> > > > > > > > ; Lorenzo Pieralisi
> > > > > > > > ; Bjorn Helgaas
> > > > > > > > ; Gustavo Pimentel
> > > > > > > > ; Michael Walle
> > > > > > ;
> > > > > > > > Ard Biesheuvel 
> > > > > > > > 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
> > > > > > 
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > From: Hou Zhiqiang 
> > > > > > > > >
> > > > > > > > > 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.
> > > > >
> > &g

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-08 Thread Naresh Kamboju
On Thu, 8 Oct 2020 at 20:42, Rob Herring  wrote:
>
> On Thu, Oct 8, 2020 at 9:47 AM Naresh Kamboju  
> wrote:
> >
> > On Fri, 2 Oct 2020 at 14:59, Naresh Kamboju  
> > wrote:
> > >
> > > On Thu, 1 Oct 2020 at 22:16, Michael Walle  wrote:
> > > >
> > > > Am 2020-10-01 15:32, schrieb Kishon Vijay Abraham I:
> > > >
> > > > > Meanwhile would it be okay to add linkup check atleast for DRA7X so
> > > > > that
> > > > > we could have it booting in linux-next?
> > > >
> > > > Layerscape SoCs (at least the LS1028A) are also still broken in
> > > > linux-next,
> > > > did I miss something here?
> > >
> > > I have been monitoring linux next boot and functional testing on nxp 
> > > devices
> > > for more than two week and still the problem exists on nxp-ls2088.
> > >
> > > Do you mind checking the possibilities to revert bad patches on linux 
> > > next tree
> > > and continue to work on fixes please ?
> > >
> > > suspected bad commit: [ I have not bisected this problem ]
> > > c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")
> > >
> > > crash log snippet:
> > > [1.563008] SError Interrupt on CPU5, code 0xbf02 -- SError
> > > [1.563010] CPU: 5 PID: 1 Comm: swapper/0 Not tainted
> > > 5.9.0-rc7-next-20201001 #1
> > > [1.563011] Hardware name: Freescale Layerscape 2088A RDB Board (DT)
> > > [1.563013] pstate: 2085 (nzCv daIf -PAN -UAO -TCO BTYPE=--)
> > > [1.563014] pc : pci_generic_config_read+0x44/0xe8
> > > [1.563015] lr : pci_generic_config_read+0x2c/0xe8
> >
> >
> > This reported issue is gone now on Linux next master branch.

I am taking this verdict back.
I have seen the boot pass and the reported issue is gone but after checking
all 20 test jobs the 4 boot passes without the above reported error.
and later the 16 boot failed with the reported error.

> > I am not sure which is a fix commit.
>
> There isn't one, better double check that. We're still waiting on
> respinning of the revert patch.
>
> BTW, why is the kernelci NXP lab almost always down? I have a branch
> now to test things and I'm not done breaking the DWC driver. :)

Now the NXP LAVA lab is back online after upgrade.
LKFT running daily testing on device "nxp-ls2088" [1]

You can monitor and check results on Linaro Linux next project [2]

[1] https://lavalab.nxp.com/scheduler/device_type/nxp-ls2088
[2] 
https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20201008/?results_layout=table_only=false#!?details=995,999#test-results

- Naresh


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-08 Thread Rob Herring
On Thu, Oct 8, 2020 at 9:47 AM Naresh Kamboju  wrote:
>
> On Fri, 2 Oct 2020 at 14:59, Naresh Kamboju  wrote:
> >
> > On Thu, 1 Oct 2020 at 22:16, Michael Walle  wrote:
> > >
> > > Am 2020-10-01 15:32, schrieb Kishon Vijay Abraham I:
> > >
> > > > Meanwhile would it be okay to add linkup check atleast for DRA7X so
> > > > that
> > > > we could have it booting in linux-next?
> > >
> > > Layerscape SoCs (at least the LS1028A) are also still broken in
> > > linux-next,
> > > did I miss something here?
> >
> > I have been monitoring linux next boot and functional testing on nxp devices
> > for more than two week and still the problem exists on nxp-ls2088.
> >
> > Do you mind checking the possibilities to revert bad patches on linux next 
> > tree
> > and continue to work on fixes please ?
> >
> > suspected bad commit: [ I have not bisected this problem ]
> > c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")
> >
> > crash log snippet:
> > [1.563008] SError Interrupt on CPU5, code 0xbf02 -- SError
> > [1.563010] CPU: 5 PID: 1 Comm: swapper/0 Not tainted
> > 5.9.0-rc7-next-20201001 #1
> > [1.563011] Hardware name: Freescale Layerscape 2088A RDB Board (DT)
> > [1.563013] pstate: 2085 (nzCv daIf -PAN -UAO -TCO BTYPE=--)
> > [1.563014] pc : pci_generic_config_read+0x44/0xe8
> > [1.563015] lr : pci_generic_config_read+0x2c/0xe8
>
>
> This reported issue is gone now on Linux next master branch.
> I am not sure which is a fix commit.

There isn't one, better double check that. We're still waiting on
respinning of the revert patch.

BTW, why is the kernelci NXP lab almost always down? I have a branch
now to test things and I'm not done breaking the DWC driver. :)

Rob


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-08 Thread Lorenzo Pieralisi
On Thu, Oct 01, 2020 at 07:02:04PM +0530, Kishon Vijay Abraham I wrote:

[...]

> >> Yeah, I don't see any registers in the DRA7x PCIe wrapper for disabling
> >> error forwarding.
> > 
> > It's a DWC port logic register AFAICT, but perhaps not present in all 
> > versions.
> 
> Okay. I see there's a register PCIECTRL_PL_AXIS_SLV_ERR_RESP which has a
> reset value of 0.
> 
> It has four bit-fields, RESET_TIMEOUT_ERR_MAP, NO_VID_ERR_MAP,
> DBI_ERR_MAP and SLAVE_ERR_MAP. I'm not seeing any difference in behavior
> if I set all these bits. Maybe it requires platform support too. I'll
> check this with our design team.
> 
> Meanwhile would it be okay to add linkup check atleast for DRA7X so that
> we could have it booting in linux-next?

Do you mind sending a patch on top of my pci/dwc please ?

Thanks,
Lorenzo


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-08 Thread Naresh Kamboju
On Fri, 2 Oct 2020 at 14:59, Naresh Kamboju  wrote:
>
> On Thu, 1 Oct 2020 at 22:16, Michael Walle  wrote:
> >
> > Am 2020-10-01 15:32, schrieb Kishon Vijay Abraham I:
> >
> > > Meanwhile would it be okay to add linkup check atleast for DRA7X so
> > > that
> > > we could have it booting in linux-next?
> >
> > Layerscape SoCs (at least the LS1028A) are also still broken in
> > linux-next,
> > did I miss something here?
>
> I have been monitoring linux next boot and functional testing on nxp devices
> for more than two week and still the problem exists on nxp-ls2088.
>
> Do you mind checking the possibilities to revert bad patches on linux next 
> tree
> and continue to work on fixes please ?
>
> suspected bad commit: [ I have not bisected this problem ]
> c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")
>
> crash log snippet:
> [1.563008] SError Interrupt on CPU5, code 0xbf02 -- SError
> [1.563010] CPU: 5 PID: 1 Comm: swapper/0 Not tainted
> 5.9.0-rc7-next-20201001 #1
> [1.563011] Hardware name: Freescale Layerscape 2088A RDB Board (DT)
> [1.563013] pstate: 2085 (nzCv daIf -PAN -UAO -TCO BTYPE=--)
> [1.563014] pc : pci_generic_config_read+0x44/0xe8
> [1.563015] lr : pci_generic_config_read+0x2c/0xe8


This reported issue is gone now on Linux next master branch.
I am not sure which is a fix commit.

- Naresh


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-02 Thread Naresh Kamboju
On Thu, 1 Oct 2020 at 22:16, Michael Walle  wrote:
>
> Am 2020-10-01 15:32, schrieb Kishon Vijay Abraham I:
>
> > Meanwhile would it be okay to add linkup check atleast for DRA7X so
> > that
> > we could have it booting in linux-next?
>
> Layerscape SoCs (at least the LS1028A) are also still broken in
> linux-next,
> did I miss something here?

I have been monitoring linux next boot and functional testing on nxp devices
for more than two week and still the problem exists on nxp-ls2088.

Do you mind checking the possibilities to revert bad patches on linux next tree
and continue to work on fixes please ?

suspected bad commit: [ I have not bisected this problem ]
c2b0c098fbd1 ("PCI: dwc: Use generic config accessors")

crash log snippet:
[1.563008] SError Interrupt on CPU5, code 0xbf02 -- SError
[1.563010] CPU: 5 PID: 1 Comm: swapper/0 Not tainted
5.9.0-rc7-next-20201001 #1
[1.563011] Hardware name: Freescale Layerscape 2088A RDB Board (DT)
[1.563013] pstate: 2085 (nzCv daIf -PAN -UAO -TCO BTYPE=--)
[1.563014] pc : pci_generic_config_read+0x44/0xe8
[1.563015] lr : pci_generic_config_read+0x2c/0xe8


full boot log and its link,
--
[0.00] Booting Linux on physical CPU 0x00 [0x410fd082]
[0.00] Linux version 5.9.0-rc7-next-20201001
(TuxBuild@40858153859f) (aarch64-linux-gnu-gcc (Debian 9.3.0-8) 9.3.0,
GNU ld (GNU Binutils for Debian) 2.34) #1 SMP PREEMPT Thu Oct 1
14:14:17 UTC 2020
[0.00] Machine model: Freescale Layerscape 2088A RDB Board
[0.00] earlycon: uart8250 at MMIO 0x021c0600 (options '')
[0.00] printk: bootconsole [uart8250] enabled
[0.00] efi: UEFI not found.
[0.00] [Firmware Bug]: Kernel image misaligned at boot, please
fix your bootloader!
[0.00] cma: Reserved 32 MiB at 0xf9c0
[0.00] NUMA: No NUMA configuration found
[0.00] NUMA: Faking a node at [mem
0x8000-0x00837fff]
[0.00] NUMA: NODE_DATA [mem 0x837e3fb100-0x837e3fcfff]
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x8000-0xbfff]
[0.00]   DMA32[mem 0xc000-0x]
[0.00]   Normal   [mem 0x0001-0x00837fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x8000-0xfbdf]
[0.00]   node   0: [mem 0x00808000-0x00837fff]
[0.00] Initmem setup node 0 [mem 0x8000-0x00837fff]
[0.00] psci: probing for conduit method from DT.
[0.00] psci: PSCIv1.1 detected in firmware.
[0.00] psci: Using standard PSCI v0.2 function IDs
[0.00] psci: MIGRATE_INFO_TYPE not supported.
[0.00] psci: SMC Calling Convention v1.1
[0.00] percpu: Embedded 31 pages/cpu s89624 r8192 d29160 u126976
[0.00] Detected PIPT I-cache on CPU0
[0.00] CPU features: detected: GIC system register CPU interface
[0.00] CPU features: detected: EL2 vector hardening
[0.00] CPU features: kernel page table isolation forced ON by KASLR
[0.00] CPU features: detected: Kernel page table isolation (KPTI)
[0.00] CPU features: detected: Spectre-v2
[0.00] CPU features: detected: ARM errata 1165522, 1319367, or 1530923
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 3596040
[0.00] Policy zone: Normal
[0.00] Kernel command line: console=ttyS1,115200n8
root=/dev/nfs rw
nfsroot=59.144.98.45:/var/lib/lava/dispatcher/tmp/90794/extract-nfsrootfs-r9w7i8h0,tcp,hard,v3
earlycon=uart8250,mmio,0x21c0600 nousb default_hugepagesz=2m
hugepagesz=2m hugepages=256 arm-smmu-mod.disable_bypass=n
arm-smmu.disable_bypass=n  ip=dhcp
[0.00] Dentry cache hash table entries: 2097152 (order: 12,
16777216 bytes, linear)
[0.00] Inode-cache hash table entries: 1048576 (order: 11,
8388608 bytes, linear)
[0.00] mem auto-init: stack:off, heap alloc:off, heap free:off
[0.00] software IO TLB: mapped [mem
0xbbfff000-0xb000] (64MB)
[0.00] Memory: 14189284K/14612480K available (17468K kernel
code, 3990K rwdata, 9344K rodata, 9344K init, 566K bss, 390428K
reserved, 32768K cma-reserved)
[0.00] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[0.00] ftrace: allocating 59411 entries in 233 pages
[0.00] ftrace: allocated 233 pages with 5 groups
[0.00] rcu: Preemptible hierarchical RCU implementation.
[0.00] rcu: RCU event tracing is enabled.
[0.00] rcu: RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=8.
[0.00] Trampoline variant of Tasks RCU enabled.
[0.00] Rude variant of Tasks RCU enabled.
[0.00] rcu: RCU calculated value of scheduler-enlistment delay
is 25 jiffies.
[0.00] rcu: Adjusting geometry for rcu_fanout_leaf=16, 

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-01 Thread Michael Walle

Am 2020-10-01 15:32, schrieb Kishon Vijay Abraham I:

Meanwhile would it be okay to add linkup check atleast for DRA7X so 
that

we could have it booting in linux-next?


Layerscape SoCs (at least the LS1028A) are also still broken in 
linux-next,

did I miss something here?

-michael


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-10-01 Thread Kishon Vijay Abraham I
Hi Rob,

On 30/09/20 8:31 pm, Rob Herring wrote:
> On Wed, Sep 30, 2020 at 8:22 AM Kishon Vijay Abraham I  wrote:
>>
>> Hi,
>>
>> On 29/09/20 10:41 pm, Rob Herring wrote:
>>> On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel
>>>  wrote:
>>>>
>>>> On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou  wrote:
>>>>
>>>>> Hi Lorenzo,
>>>>>
>>>>> Thanks a lot for your comments!
>>>>>
>>>>>> -Original Message-
>>>>>> From: Lorenzo Pieralisi 
>>>>>> Sent: 2020年9月28日 17:39
>>>>>> To: Z.q. Hou 
>>>>>> Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
>>>>>> ; Bjorn Helgaas ;
>>>>>> Gustavo Pimentel ; Michael Walle
>>>>>> ; Ard Biesheuvel 
>>>>>> 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 +, Z.q. Hou wrote:
>>>>>>> Hi Rob,
>>>>>>>
>>>>>>> Thanks a lot for your comments!
>>>>>>>
>>>>>>>> -Original Message-
>>>>>>>> From: Rob Herring 
>>>>>>>> Sent: 2020年9月18日 23:28
>>>>>>>> To: Z.q. Hou 
>>>>>>>> Cc: linux-kernel@vger.kernel.org; PCI ;
>>>>>>>> Lorenzo Pieralisi ; Bjorn Helgaas
>>>>>>>> ; Gustavo Pimentel
>>>>>>>> ; Michael Walle
>>>>>> ;
>>>>>>>> Ard Biesheuvel 
>>>>>>>> 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 
>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi Rob,
>>>>>>>>>
>>>>>>>>> Thanks a lot for your comments!
>>>>>>>>>
>>>>>>>>>> -Original Message-
>>>>>>>>>> From: Rob Herring 
>>>>>>>>>> Sent: 2020年9月17日 4:29
>>>>>>>>>> To: Z.q. Hou 
>>>>>>>>>> Cc: linux-kernel@vger.kernel.org; PCI
>>>>>>>>>> ; Lorenzo Pieralisi
>>>>>>>>>> ; Bjorn Helgaas
>>>>>>>>>> ; Gustavo Pimentel
>>>>>>>>>> ; Michael Walle
>>>>>>>> ;
>>>>>>>>>> Ard Biesheuvel 
>>>>>>>>>> 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
>>>>>>>> 
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> From: Hou Zhiqiang 
>>>>>>>>>>>
>>>>>>>>>>> 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'

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-30 Thread Rob Herring
On Wed, Sep 30, 2020 at 8:22 AM Kishon Vijay Abraham I  wrote:
>
> Hi,
>
> On 29/09/20 10:41 pm, Rob Herring wrote:
> > On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel
> >  wrote:
> >>
> >> On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou  wrote:
> >>
> >>> Hi Lorenzo,
> >>>
> >>> Thanks a lot for your comments!
> >>>
> >>>> -Original Message-
> >>>> From: Lorenzo Pieralisi 
> >>>> Sent: 2020年9月28日 17:39
> >>>> To: Z.q. Hou 
> >>>> Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
> >>>> ; Bjorn Helgaas ;
> >>>> Gustavo Pimentel ; Michael Walle
> >>>> ; Ard Biesheuvel 
> >>>> 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 +, Z.q. Hou wrote:
> >>>>> Hi Rob,
> >>>>>
> >>>>> Thanks a lot for your comments!
> >>>>>
> >>>>>> -Original Message-
> >>>>>> From: Rob Herring 
> >>>>>> Sent: 2020年9月18日 23:28
> >>>>>> To: Z.q. Hou 
> >>>>>> Cc: linux-kernel@vger.kernel.org; PCI ;
> >>>>>> Lorenzo Pieralisi ; Bjorn Helgaas
> >>>>>> ; Gustavo Pimentel
> >>>>>> ; Michael Walle
> >>>> ;
> >>>>>> Ard Biesheuvel 
> >>>>>> 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 
> >>>> wrote:
> >>>>>>>
> >>>>>>> Hi Rob,
> >>>>>>>
> >>>>>>> Thanks a lot for your comments!
> >>>>>>>
> >>>>>>>> -Original Message-
> >>>>>>>> From: Rob Herring 
> >>>>>>>> Sent: 2020年9月17日 4:29
> >>>>>>>> To: Z.q. Hou 
> >>>>>>>> Cc: linux-kernel@vger.kernel.org; PCI
> >>>>>>>> ; Lorenzo Pieralisi
> >>>>>>>> ; Bjorn Helgaas
> >>>>>>>> ; Gustavo Pimentel
> >>>>>>>> ; Michael Walle
> >>>>>> ;
> >>>>>>>> Ard Biesheuvel 
> >>>>>>>> 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
> >>>>>> 
> >>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>> From: Hou Zhiqiang 
> >>>>>>>>>
> >>>>>>>>> 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
> >>&

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-30 Thread Kishon Vijay Abraham I
Hi,

On 29/09/20 10:41 pm, Rob Herring wrote:
> On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel
>  wrote:
>>
>> On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou  wrote:
>>
>>> Hi Lorenzo,
>>>
>>> Thanks a lot for your comments!
>>>
>>>> -Original Message-
>>>> From: Lorenzo Pieralisi 
>>>> Sent: 2020年9月28日 17:39
>>>> To: Z.q. Hou 
>>>> Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
>>>> ; Bjorn Helgaas ;
>>>> Gustavo Pimentel ; Michael Walle
>>>> ; Ard Biesheuvel 
>>>> 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 +, Z.q. Hou wrote:
>>>>> Hi Rob,
>>>>>
>>>>> Thanks a lot for your comments!
>>>>>
>>>>>> -Original Message-----
>>>>>> From: Rob Herring 
>>>>>> Sent: 2020年9月18日 23:28
>>>>>> To: Z.q. Hou 
>>>>>> Cc: linux-kernel@vger.kernel.org; PCI ;
>>>>>> Lorenzo Pieralisi ; Bjorn Helgaas
>>>>>> ; Gustavo Pimentel
>>>>>> ; Michael Walle
>>>> ;
>>>>>> Ard Biesheuvel 
>>>>>> 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 
>>>> wrote:
>>>>>>>
>>>>>>> Hi Rob,
>>>>>>>
>>>>>>> Thanks a lot for your comments!
>>>>>>>
>>>>>>>> -Original Message-
>>>>>>>> From: Rob Herring 
>>>>>>>> Sent: 2020年9月17日 4:29
>>>>>>>> To: Z.q. Hou 
>>>>>>>> Cc: linux-kernel@vger.kernel.org; PCI
>>>>>>>> ; Lorenzo Pieralisi
>>>>>>>> ; Bjorn Helgaas
>>>>>>>> ; Gustavo Pimentel
>>>>>>>> ; Michael Walle
>>>>>> ;
>>>>>>>> Ard Biesheuvel 
>>>>>>>> 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
>>>>>> 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> From: Hou Zhiqiang 
>>>>>>>>>
>>>>>>>>> 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
>>>>>&g

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-29 Thread Rob Herring
On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel
 wrote:
>
> On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou  wrote:
>
> > Hi Lorenzo,
> >
> > Thanks a lot for your comments!
> >
> > > -Original Message-
> > > From: Lorenzo Pieralisi 
> > > Sent: 2020年9月28日 17:39
> > > To: Z.q. Hou 
> > > Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
> > > ; Bjorn Helgaas ;
> > > Gustavo Pimentel ; Michael Walle
> > > ; Ard Biesheuvel 
> > > 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 +, Z.q. Hou wrote:
> > > > Hi Rob,
> > > >
> > > > Thanks a lot for your comments!
> > > >
> > > > > -Original Message-
> > > > > From: Rob Herring 
> > > > > Sent: 2020年9月18日 23:28
> > > > > To: Z.q. Hou 
> > > > > Cc: linux-kernel@vger.kernel.org; PCI ;
> > > > > Lorenzo Pieralisi ; Bjorn Helgaas
> > > > > ; Gustavo Pimentel
> > > > > ; Michael Walle
> > > ;
> > > > > Ard Biesheuvel 
> > > > > 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 
> > > wrote:
> > > > > >
> > > > > > Hi Rob,
> > > > > >
> > > > > > Thanks a lot for your comments!
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Rob Herring 
> > > > > > > Sent: 2020年9月17日 4:29
> > > > > > > To: Z.q. Hou 
> > > > > > > Cc: linux-kernel@vger.kernel.org; PCI
> > > > > > > ; Lorenzo Pieralisi
> > > > > > > ; Bjorn Helgaas
> > > > > > > ; Gustavo Pimentel
> > > > > > > ; Michael Walle
> > > > > ;
> > > > > > > Ard Biesheuvel 
> > > > > > > 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
> > > > > 
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > From: Hou Zhiqiang 
> > > > > > > >
> > > > > > > > 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
> > &g

RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-29 Thread Gustavo Pimentel
On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou  wrote:

> Hi Lorenzo,
> 
> Thanks a lot for your comments!
> 
> > -Original Message-
> > From: Lorenzo Pieralisi 
> > Sent: 2020年9月28日 17:39
> > To: Z.q. Hou 
> > Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
> > ; Bjorn Helgaas ;
> > Gustavo Pimentel ; Michael Walle
> > ; Ard Biesheuvel 
> > 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 +, Z.q. Hou wrote:
> > > Hi Rob,
> > >
> > > Thanks a lot for your comments!
> > >
> > > > -Original Message-
> > > > From: Rob Herring 
> > > > Sent: 2020年9月18日 23:28
> > > > To: Z.q. Hou 
> > > > Cc: linux-kernel@vger.kernel.org; PCI ;
> > > > Lorenzo Pieralisi ; Bjorn Helgaas
> > > > ; Gustavo Pimentel
> > > > ; Michael Walle
> > ;
> > > > Ard Biesheuvel 
> > > > 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 
> > wrote:
> > > > >
> > > > > Hi Rob,
> > > > >
> > > > > Thanks a lot for your comments!
> > > > >
> > > > > > -Original Message-
> > > > > > From: Rob Herring 
> > > > > > Sent: 2020年9月17日 4:29
> > > > > > To: Z.q. Hou 
> > > > > > Cc: linux-kernel@vger.kernel.org; PCI
> > > > > > ; Lorenzo Pieralisi
> > > > > > ; Bjorn Helgaas
> > > > > > ; Gustavo Pimentel
> > > > > > ; Michael Walle
> > > > ;
> > > > > > Ard Biesheuvel 
> > > > > > 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
> > > > 
> > > > > > wrote:
> > > > > > >
> > > > > > > From: Hou Zhiqiang 
> > > > > > >
> > > > > > > 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
> &g

RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-28 Thread Z.q. Hou
Hi Lorenzo,

Thanks a lot for your comments!

> -Original Message-
> From: Lorenzo Pieralisi 
> Sent: 2020年9月28日 17:39
> To: Z.q. Hou 
> Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
> ; Bjorn Helgaas ;
> Gustavo Pimentel ; Michael Walle
> ; Ard Biesheuvel 
> 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 +, Z.q. Hou wrote:
> > Hi Rob,
> >
> > Thanks a lot for your comments!
> >
> > > -Original Message-
> > > From: Rob Herring 
> > > Sent: 2020年9月18日 23:28
> > > To: Z.q. Hou 
> > > Cc: linux-kernel@vger.kernel.org; PCI ;
> > > Lorenzo Pieralisi ; Bjorn Helgaas
> > > ; Gustavo Pimentel
> > > ; Michael Walle
> ;
> > > Ard Biesheuvel 
> > > 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 
> wrote:
> > > >
> > > > Hi Rob,
> > > >
> > > > Thanks a lot for your comments!
> > > >
> > > > > -Original Message-
> > > > > From: Rob Herring 
> > > > > Sent: 2020年9月17日 4:29
> > > > > To: Z.q. Hou 
> > > > > Cc: linux-kernel@vger.kernel.org; PCI
> > > > > ; Lorenzo Pieralisi
> > > > > ; Bjorn Helgaas
> > > > > ; Gustavo Pimentel
> > > > > ; Michael Walle
> > > ;
> > > > > Ard Biesheuvel 
> > > > > 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
> > > 
> > > > > wrote:
> > > > > >
> > > > > > From: Hou Zhiqiang 
> > > > > >
> > > > > > 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 

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-28 Thread Lorenzo Pieralisi
On Thu, Sep 24, 2020 at 04:24:47AM +, Z.q. Hou wrote:
> Hi Rob,
> 
> Thanks a lot for your comments!
> 
> > -Original Message-
> > From: Rob Herring 
> > Sent: 2020年9月18日 23:28
> > To: Z.q. Hou 
> > Cc: linux-kernel@vger.kernel.org; PCI ; Lorenzo
> > Pieralisi ; Bjorn Helgaas
> > ; Gustavo Pimentel
> > ; Michael Walle ;
> > Ard Biesheuvel 
> > 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  wrote:
> > >
> > > Hi Rob,
> > >
> > > Thanks a lot for your comments!
> > >
> > > > -Original Message-
> > > > From: Rob Herring 
> > > > Sent: 2020年9月17日 4:29
> > > > To: Z.q. Hou 
> > > > Cc: linux-kernel@vger.kernel.org; PCI ;
> > > > Lorenzo Pieralisi ; Bjorn Helgaas
> > > > ; Gustavo Pimentel
> > > > ; Michael Walle
> > ;
> > > > Ard Biesheuvel 
> > > > 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
> > 
> > > > wrote:
> > > > >
> > > > > From: Hou Zhiqiang 
> > > > >
> > > > > 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,
> 

RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-23 Thread Z.q. Hou
Hi Rob,

Thanks a lot for your comments!

> -Original Message-
> From: Rob Herring 
> Sent: 2020年9月18日 23:28
> To: Z.q. Hou 
> Cc: linux-kernel@vger.kernel.org; PCI ; Lorenzo
> Pieralisi ; Bjorn Helgaas
> ; Gustavo Pimentel
> ; Michael Walle ;
> Ard Biesheuvel 
> 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  wrote:
> >
> > Hi Rob,
> >
> > Thanks a lot for your comments!
> >
> > > -Original Message-
> > > From: Rob Herring 
> > > Sent: 2020年9月17日 4:29
> > > To: Z.q. Hou 
> > > Cc: linux-kernel@vger.kernel.org; PCI ;
> > > Lorenzo Pieralisi ; Bjorn Helgaas
> > > ; Gustavo Pimentel
> > > ; Michael Walle
> ;
> > > Ard Biesheuvel 
> > > 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
> 
> > > wrote:
> > > >
> > > > From: Hou Zhiqiang 
> > > >
> > > > 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 0x 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.

Thanks,
Zhiqiang

> 
> Rob


RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-21 Thread Z.q. Hou
Hi Bjorn,

Thanks a lot for your comments!

> -Original Message-
> From: Bjorn Helgaas 
> Sent: 2020年9月18日 20:47
> To: Z.q. Hou 
> Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
> ; Lorenzo Pieralisi ;
> Bjorn Helgaas ; Gustavo Pimentel
> ; Michael Walle ;
> Ard Biesheuvel 
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> On Fri, Sep 18, 2020 at 11:02:07AM +, Z.q. Hou wrote:
> 
> > But now the SError is exactly caused by the first access of the
> > non-existent function, I dug into the kernel enumeration code and
> > found it will fire a 4Byte CFG read transaction to read the Vendor ID
> > and Device ID together, so I suspect the root cause is access the
> > Device ID of a non-existent function triggers SError.
> >
> > So the alternative solution seems to correct the PCIe enumeration, I
> > will submit a patch to let the first access only read the Vendor ID.
> 
> If it is incorrect for the first access to be a 32-bit read of both the Vendor
> and the Device ID, please cite the relevant section of the spec in your patch.
> 
> I don't like to make changes to generic code to accommodate specific pieces
> of hardware because then we restrict future changes based on some device
> that will soon be obsolete and forgotten.
> 
> I'm pretty sure the spec language about CRS handling is careful to talk about
> "reads that *include* Vendor ID", not just "reads of Vendor ID", so the
> implication is that it covers 32-bit reads as well as 16-bit reads.
> 

Yes, I agree with you that we must be carful with the generic code.
NXP Layerscape SError aside, it turns out to be more complex, limiting the 
first CFG access to 16-bit Vendor ID also causes SError, the hardware behavior 
seems not the same as the described of the register PCIE_ABSERR.

For the PCIe enumeration, I found the descriptions of Vendor ID and Device ID 
in the PCI Express Base Specification, Rev. 4.0 Version 1.0 (pasted below), it 
recommends to read Vendor ID to determine the presentence of a function and use 
the Device ID (with Vendor ID and Revision ID) to determine the driver needed. 
But in section 2.3.2 Completion Handling Rules, it seems, as you said, not 
limit to 16-bit Vendor ID, so I want to hear your and Rob's suggestion on this 
change. 

7.5.1.1.1 Vendor ID Register (Offset 00h)
The Vendor ID register is HwInit and the value in this register identifies the 
manufacturer of the
Function. In keeping with PCI-SIG procedures, valid vendor identifiers must be 
allocated by the
PCI-SIG to ensure uniqueness. Each vendor must have at least one Vendor ID. It 
is recommended
that software read the Vendor ID register to determine if a Function is 
present, where a value of
h indicates that no Function is present.
7.5.1.1.2 Device ID Register (Offset 02h)
The Device ID register is HwInit and the value in this register identifies the 
particular Function.
The Device ID must be allocated by the vendor. The Device ID, in conjunction 
with the Vendor ID
and Revision ID, are used as one mechanism for software to determine which 
driver should be
loaded. The vendor must ensure that the chosen values do not result in the use 
of an incompatible
device driver.

Regards,
Zhiqiang

> Bjorn


RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-21 Thread Z.q. Hou
Hi Michael,

Thanks a lot for your comments!

> -Original Message-
> From: Michael Walle 
> Sent: 2020年9月18日 19:14
> To: Z.q. Hou 
> Cc: Rob Herring ; linux-kernel@vger.kernel.org; PCI
> ; Lorenzo Pieralisi ;
> Bjorn Helgaas ; Gustavo Pimentel
> ; Ard Biesheuvel 
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> Hi Zhiqiang,
> 
> > So the alternative solution seems to correct the PCIe enumeration, I
> > will submit a patch to let the first access only read the Vendor ID.
> 
> Please put me on CC of that patch.

Saw more comments on this, I'll discuss more with Rob and Bjorn, and must act 
prudently.

Regards,
Zhiqiang

> 
> Thanks,
> -michael


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-18 Thread Rob Herring
On Fri, Sep 18, 2020 at 5:02 AM Z.q. Hou  wrote:
>
> Hi Rob,
>
> Thanks a lot for your comments!
>
> > -Original Message-
> > From: Rob Herring 
> > Sent: 2020年9月17日 4:29
> > To: Z.q. Hou 
> > Cc: linux-kernel@vger.kernel.org; PCI ; Lorenzo
> > Pieralisi ; Bjorn Helgaas
> > ; Gustavo Pimentel
> > ; Michael Walle ;
> > Ard Biesheuvel 
> > 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 
> > wrote:
> > >
> > > From: Hou Zhiqiang 
> > >
> > > 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.

> > 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.

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.

Rob


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-18 Thread Bjorn Helgaas
On Fri, Sep 18, 2020 at 11:02:07AM +, Z.q. Hou wrote:

> But now the SError is exactly caused by the first access of the
> non-existent function, I dug into the kernel enumeration code and
> found it will fire a 4Byte CFG read transaction to read the Vendor
> ID and Device ID together, so I suspect the root cause is access the
> Device ID of a non-existent function triggers SError.
> 
> So the alternative solution seems to correct the PCIe enumeration, I
> will submit a patch to let the first access only read the Vendor ID.

If it is incorrect for the first access to be a 32-bit read of both
the Vendor and the Device ID, please cite the relevant section of the
spec in your patch.

I don't like to make changes to generic code to accommodate specific
pieces of hardware because then we restrict future changes based on
some device that will soon be obsolete and forgotten.

I'm pretty sure the spec language about CRS handling is careful to
talk about "reads that *include* Vendor ID", not just "reads of Vendor
ID", so the implication is that it covers 32-bit reads as well as
16-bit reads.

Bjorn


Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-18 Thread Michael Walle

Hi Zhiqiang,

So the alternative solution seems to correct the PCIe enumeration, I 
will submit

a patch to let the first access only read the Vendor ID.


Please put me on CC of that patch.

Thanks,
-michael


RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-18 Thread Z.q. Hou
Hi Rob,

Thanks a lot for your comments!

> -Original Message-
> From: Rob Herring 
> Sent: 2020年9月17日 4:29
> To: Z.q. Hou 
> Cc: linux-kernel@vger.kernel.org; PCI ; Lorenzo
> Pieralisi ; Bjorn Helgaas
> ; Gustavo Pimentel
> ; Michael Walle ;
> Ard Biesheuvel 
> 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 
> wrote:
> >
> > From: Hou Zhiqiang 
> >
> > 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.

> 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.

> 
> 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.

But now the SError is exactly caused by the first access of the non-existent
function, I dug into the kernel enumeration code and found it will fire a 4Byte
CFG read transaction to read the Vendor ID and Device ID together, so I suspect
the root cause is access the Device ID of a non-existent function triggers 
SError.

So the alternative solution seems to correct the PCIe enumeration, I will submit
a patch to let the first access only read the Vendor ID.

Thanks,
Zhiqiang

> 
> This appears to be a standard DWC register as the tegra driver defines this
> address as PORT_LOGIC_AMBA_ERROR_RESPONSE_DEFAULT. Perhaps
> someone can shed some light on what this register contains.
> 
> Rob
> 
> [1]
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.lin
> aro.org%2Fleg%2Fnoupstream%2Fedk2-platforms.git%2Ftree%2FSilicon%2F
> NXP%2FLibrary%2FPciHostBridgeLib%2FPciHostBridgeLib.c%3Fh%3Ddevelop
> er-box%23n756data=02%7C01%7CZhiqiang.Hou%40nxp.com%7Cfa38
> f3e83d0c49983e0c08d85a7f2d5e%7C686ea1d3bc2b4c6fa92cd99c5c301635
> %7C0%7C0%7C637358849549791506sdata=bJ3uDUm%2FT%2FzC6qz
> GX7NNHQZdDxNFZ%2BBtcEQ3sLQIE4M%3Dreserved=0
> 
> 
> >
> > [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> > [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> > [0.807776] Hardware name: LS1046A RDB Board (DT)
> > [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> > [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> > [0.807778] lr : pci_generic_config_read+0x24/0xe0
> > [0.807779] sp : 80001003b7b0
> > [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> > [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> > [0.807784] x25: 80001003b874 x24: 80001003b924
> > [0.807786] x23: 0004 x22: 
> > [0.807788] x21:  x20: 80001003b874
> > [0.807790] x19: 0004 x18: 
> > [0.807791] x17: 00c0 x

Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops

2020-09-16 Thread Rob Herring
On Tue, Sep 15, 2020 at 11:49 PM Zhiqiang Hou  wrote:
>
> From: Hou Zhiqiang 
>
> 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?
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.

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?

This appears to be a standard DWC register as the tegra driver defines
this address as PORT_LOGIC_AMBA_ERROR_RESPONSE_DEFAULT. Perhaps
someone can shed some light on what this register contains.

Rob

[1] 
https://git.linaro.org/leg/noupstream/edk2-platforms.git/tree/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c?h=developer-box#n756


>
> [0.807773] SError Interrupt on CPU2, code 0xbf02 -- SError
> [0.807775] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807776] Hardware name: LS1046A RDB Board (DT)
> [0.80] pstate: 2085 (nzCv daIf -PAN -UAO BTYPE=--)
> [0.807778] pc : pci_generic_config_read+0x3c/0xe0
> [0.807778] lr : pci_generic_config_read+0x24/0xe0
> [0.807779] sp : 80001003b7b0
> [0.807780] x29: 80001003b7b0 x28: 80001003ba74
> [0.807782] x27: 000971d96800 x26: 00096e77e0a8
> [0.807784] x25: 80001003b874 x24: 80001003b924
> [0.807786] x23: 0004 x22: 
> [0.807788] x21:  x20: 80001003b874
> [0.807790] x19: 0004 x18: 
> [0.807791] x17: 00c0 x16: fe0025981840
> [0.807793] x15: b94c75b69948 x14: 62203a383634203a
> [0.807795] x13: 666e6f635f726568 x12: 202c31203d207265
> [0.807797] x11: 626d756e3e2d7375 x10: 656877202c307830
> [0.807799] x9 : 203d206e66766564 x8 : 0908
> [0.807801] x7 : 0908 x6 : 80001090
> [0.807802] x5 : 00096e77e080 x4 : 
> [0.807804] x3 : 0003 x2 : 84fa3440ff7e7000
> [0.807806] x1 :  x0 : 800010034000
> [0.807808] Kernel panic - not syncing: Asynchronous SError Interrupt
> [0.807809] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 
> 5.9.0-rc5-next-20200914-1-gf965d3ec86fa #67
> [0.807810] Hardware name: LS1046A RDB Board (DT)
> [0.807811] Call trace:
> [0.807812]  dump_backtrace+0x0/0x1c0
> [0.807813]  show_stack+0x18/0x28
> [0.807814]  dump_stack+0xd8/0x134
> [0.807814]  panic+0x180/0x398
> [0.807815]  add_taint+0x0/0xb0
> [0.807816]  arm64_serror_panic+0x78/0x88
> [0.807817]  do_serror+0x68/0x180
> [0.807818]  el1_error+0x84/0x100
> [0.807818]  pci_generic_config_read+0x3c/0xe0
> [0.807819]  dw_pcie_rd_other_conf+0x78/0x110
> [0.807820]  pci_bus_read_config_dword+0x88/0xe8
> [0.807821]  pci_bus_generic_read_dev_vendor_id+0x30/0x1b0
> [0.807822]  pci_bus_read_dev_vendor_id+0x4c/0x78
> [0.807823]  pci_scan_single_device+0x80/0x100
> [0.807824]  pci_scan_slot+0x38/0x130
> [0.807825]  pci_scan_child_bus_extend+0x54/0x2a0
> [0.807826]  pci_scan_child_bus+0x14/0x20
> [0.807827]  pci_scan_bridge_extend+0x230/0x570
> [0.807828]  pci_scan_child_bus_extend+0x134/0x2a0
> [0.807829]  pci_scan_root_bus_bridge+0x64/0xf0
> [0.807829]  pci_host_probe+0x18/0xc8
> [0.807830]  dw_pcie_host_init+0x220/0x378
> [0.807831]  ls_pcie_probe+0x104/0x140
> [0.807832]  platform_drv_probe+0x54/0xa8
> [0.807833]  really_probe+0x118/0x3e0
> [0.807834]  driver_probe_device+0x5c/0xc0
> [0.807835]  device_driver_attach+0x74/0x80
> [0.807835]  __driver_attach+0x8c/0xd8
> [0.807836]  bus_for_each_dev+0x7c/0xd8
> [0.807837]  driver_attach+0x24/0x30
> [0.807838]  bus_add_driver+0x154/0x200
> [0.807839]  driver_register+0x64/0x120
> [0.807839]  __platform_driver_probe+0x7c/0x148
> [0.807840]  ls_pcie_driver_init+0x24/0x30
> [0.807841]  do_one_initcall+0x60/0x1d8
> [0.807842]  kernel_init_freeable+0x1f4/0x24c
> [0.807843]  kernel_init+0x14/0x118
> [0.807843]  ret_from_fork+0x10/0x34