linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI: Fixes in pci-keystone driver
@ 2021-03-24 12:18 Kishon Vijay Abraham I
  2021-03-24 12:19 ` [PATCH 1/2] PCI: keystone: Set mode as RootComplex for "ti,keystone-pcie" compatible Kishon Vijay Abraham I
  2021-03-24 12:19 ` [PATCH 2/2] PCI: keystone: Add link up check in ks_child_pcie_ops.map_bus() Kishon Vijay Abraham I
  0 siblings, 2 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-24 12:18 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas
  Cc: linux-pci, linux-arm-kernel, linux-kernel, Lokesh Vutla

Patch series includes a couple of fixes in pci-keystone driver
for issues seen when testing Root Complex mode in K2G driver.

Kishon Vijay Abraham I (2):
  PCI: keystone: Set mode as RootComplex for "ti,keystone-pcie"
    compatible
  PCI: keystone: Add link up check in ks_child_pcie_ops.map_bus()

 drivers/pci/controller/dwc/pci-keystone.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] PCI: keystone: Set mode as RootComplex for "ti,keystone-pcie" compatible
  2021-03-24 12:18 [PATCH 0/2] PCI: Fixes in pci-keystone driver Kishon Vijay Abraham I
@ 2021-03-24 12:19 ` Kishon Vijay Abraham I
  2021-03-24 12:19 ` [PATCH 2/2] PCI: keystone: Add link up check in ks_child_pcie_ops.map_bus() Kishon Vijay Abraham I
  1 sibling, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-24 12:19 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas
  Cc: linux-pci, linux-arm-kernel, linux-kernel, Lokesh Vutla

commit 23284ad677a9 ("PCI: keystone: Add support for PCIe EP in AM654x
Platforms") introduced configuring "enum dw_pcie_device_mode" as part of
device data ("struct ks_pcie_of_data"). However it failed to set mode
for "ti,keystone-pcie" compatible. Set mode as RootComplex for
"ti,keystone-pcie" compatible here.

Fixes: 23284ad677a9 ("PCI: keystone: Add support for PCIe EP in AM654x Platforms")
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Cc: <stable@vger.kernel.org> # v5.4+
---
 drivers/pci/controller/dwc/pci-keystone.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index a59ecbec601f..7171ea70da49 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -1047,6 +1047,7 @@ static int ks_pcie_am654_set_mode(struct device *dev,
 
 static const struct ks_pcie_of_data ks_pcie_rc_of_data = {
 	.host_ops = &ks_pcie_host_ops,
+	.mode = DW_PCIE_RC_TYPE,
 	.version = 0x365A,
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] PCI: keystone: Add link up check in ks_child_pcie_ops.map_bus()
  2021-03-24 12:18 [PATCH 0/2] PCI: Fixes in pci-keystone driver Kishon Vijay Abraham I
  2021-03-24 12:19 ` [PATCH 1/2] PCI: keystone: Set mode as RootComplex for "ti,keystone-pcie" compatible Kishon Vijay Abraham I
@ 2021-03-24 12:19 ` Kishon Vijay Abraham I
  1 sibling, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2021-03-24 12:19 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas
  Cc: linux-pci, linux-arm-kernel, linux-kernel, Lokesh Vutla

K2G forwardS the error triggered by a link-down state (e.g.,
no connected endpoint device) on the system bus for PCI configuration
transactions; these errors are reported as an SError at system level,
which is fatal and hangs the system. So fix it similar to how
it was done in designware core driver
commit 15b23906347c ("PCI: dwc: Add link up check in
dw_child_pcie_ops.map_bus()").

Fixes: 10a797c6e54a ("PCI: dwc: keystone: Use pci_ops for config space accessors")
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Cc: <stable@vger.kernel.org> # v5.10
---
 drivers/pci/controller/dwc/pci-keystone.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index 7171ea70da49..4de8c8e5e3f2 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -432,6 +432,17 @@ static void __iomem *ks_pcie_other_map_bus(struct pci_bus *bus,
 	struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
 	u32 reg;
 
+	/*
+	 * Checking whether the link is up here is a last line of defense
+	 * against platforms that forward errors on the system bus as
+	 * SError upon PCI configuration transactions issued when the link
+	 * is down. This check is racy by definition and does not stop
+	 * the system from triggering an SError if the link goes down
+	 * after this check is performed.
+	 */
+	if (!dw_pcie_link_up(pci))
+		return NULL;
+
 	reg = CFG_BUS(bus->number) | CFG_DEVICE(PCI_SLOT(devfn)) |
 		CFG_FUNC(PCI_FUNC(devfn));
 	if (!pci_is_root_bus(bus->parent))
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-24 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 12:18 [PATCH 0/2] PCI: Fixes in pci-keystone driver Kishon Vijay Abraham I
2021-03-24 12:19 ` [PATCH 1/2] PCI: keystone: Set mode as RootComplex for "ti,keystone-pcie" compatible Kishon Vijay Abraham I
2021-03-24 12:19 ` [PATCH 2/2] PCI: keystone: Add link up check in ks_child_pcie_ops.map_bus() Kishon Vijay Abraham I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).