linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] PCI: iproc: Support DT property for ignoring aborts when probing
@ 2016-04-09 21:50 Rafał Miłecki
  2016-04-09 21:50 ` [PATCH 2/2] PCI: iproc: Enable hooking abort handler on devices with bcma Rafał Miłecki
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Rafał Miłecki @ 2016-04-09 21:50 UTC (permalink / raw)
  To: Bjorn Helgaas, Ray Jui, Scott Branden, Jon Mason
  Cc: linux-pci, Hauke Mehrtens, linux-arm-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki

Some devices (e.g. Northstar ones) may have bridges that forward
harmless errors to the ARM core. In such case we need an option to
add a handler ignoring them.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 .../devicetree/bindings/pci/brcm,iproc-pcie.txt         |  6 ++++++
 drivers/pci/host/pcie-iproc-platform.c                  |  2 ++
 drivers/pci/host/pcie-iproc.c                           | 17 +++++++++++++++++
 drivers/pci/host/pcie-iproc.h                           |  1 +
 4 files changed, 26 insertions(+)

diff --git a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
index 01b88f4..c91b20a 100644
--- a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
@@ -22,6 +22,12 @@ Optional properties:
 
 - brcm,pcie-ob: Some iProc SoCs do not have the outbound address mapping done
 by the ASIC after power on reset. In this case, SW needs to configure it
+- brcm,pcie-hook-abort-handler: During PCI bus probing (device enumeration)
+  there can be errors that are expected and harmless. Unfortunately some bridges
+  can't be configured to ignore them and they forward them to the ARM core
+  triggering die().
+  This property should be set in such case, it will make driver add its own
+  handler ignoring such errors.
 
 If the brcm,pcie-ob property is present, the following properties become
 effective:
diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c
index 1738c52..7a6eb09 100644
--- a/drivers/pci/host/pcie-iproc-platform.c
+++ b/drivers/pci/host/pcie-iproc-platform.c
@@ -100,6 +100,8 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
 		pcie->need_ob_cfg = true;
 	}
 
+	pcie->hook_abort_handler = of_property_read_bool(np, "brcm,pcie-hook-abort-handler");
+
 	/* PHY use is optional */
 	pcie->phy = devm_phy_get(&pdev->dev, "pcie-phy");
 	if (IS_ERR(pcie->phy)) {
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index a576aee..a5b3816 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -433,6 +433,17 @@ static int iproc_pcie_map_ranges(struct iproc_pcie *pcie,
 	return 0;
 }
 
+#ifdef CONFIG_ARM
+static int iproc_pcie_abort_handler(unsigned long addr, unsigned int fsr,
+				    struct pt_regs *regs)
+{
+	if (fsr == 0x1406)
+		return 0;
+
+	return 1;
+}
+#endif
+
 static int iproc_pcie_msi_enable(struct iproc_pcie *pcie)
 {
 	struct device_node *msi_node;
@@ -498,6 +509,12 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
 	}
 
 #ifdef CONFIG_ARM
+	if (pcie->hook_abort_handler)
+		hook_fault_code(16 + 6, iproc_pcie_abort_handler, SIGBUS,
+				BUS_OBJERR, "imprecise external abort");
+#endif
+
+#ifdef CONFIG_ARM
 	pcie->sysdata.private_data = pcie;
 	sysdata = &pcie->sysdata;
 #else
diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h
index e84d93c..9a0b58d 100644
--- a/drivers/pci/host/pcie-iproc.h
+++ b/drivers/pci/host/pcie-iproc.h
@@ -72,6 +72,7 @@ struct iproc_pcie {
 	struct phy *phy;
 	int (*map_irq)(const struct pci_dev *, u8, u8);
 	bool need_ob_cfg;
+	bool hook_abort_handler;
 	struct iproc_pcie_ob ob;
 	struct iproc_msi *msi;
 };
-- 
1.8.4.5


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

end of thread, other threads:[~2016-10-29  6:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-09 21:50 [PATCH 1/2] PCI: iproc: Support DT property for ignoring aborts when probing Rafał Miłecki
2016-04-09 21:50 ` [PATCH 2/2] PCI: iproc: Enable hooking abort handler on devices with bcma Rafał Miłecki
2016-04-10  2:59 ` [PATCH 1/2] PCI: iproc: Support DT property for ignoring aborts when probing kbuild test robot
2016-04-10 10:54   ` Rafał Miłecki
2016-04-11  1:43 ` Florian Fainelli
     [not found]   ` <4768648c-841b-490d-a752-f31cba545f74@broadcom.com>
2016-04-11 21:55     ` Florian Fainelli
     [not found]       ` <ccabf53c-c035-be4b-a016-389bb7531557@broadcom.com>
     [not found]         ` <570C24B3.4080104@broadcom.com>
     [not found]           ` <18045be8-9ee3-7644-6fbb-d352e107d111@broadcom.com>
2016-04-11 22:41             ` Florian Fainelli
     [not found]               ` <0464ed02-5d41-f111-b8c1-aa9aa638c872@broadcom.com>
2016-04-11 22:51                 ` Florian Fainelli
2016-04-17 15:54                   ` Rafał Miłecki
2016-04-17 14:02   ` Arnd Bergmann
     [not found]     ` <ae624772-9306-50ee-3dc1-df8156eaa16d@broadcom.com>
     [not found]       ` <acccb06d-14b9-33bd-466b-47dd3689e537@broadcom.com>
2016-10-28 15:31         ` Rafał Miłecki
     [not found]           ` <1b58db80-c9ff-d4d6-0df1-d80d1c03bc45@broadcom.com>
2016-10-28 17:04             ` Florian Fainelli
2016-10-29  6:14             ` Rafał Miłecki
2016-04-11  8:57 ` Mark Rutland
2016-04-17 15:43   ` Rafał Miłecki

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