From 32875a2d79a553c339f861190a4e9f21c97da88e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 28 Nov 2016 13:07:29 +0100 Subject: [PATCH] bcm53xx: use upstream accepted fix for ARM core aborts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...-back-handler-ignoring-external-impr.patch | 75 +++++++++++++++++++ ...-ARM-core-aborts-when-running-on-bcm.patch | 42 ----------- 2 files changed, 75 insertions(+), 42 deletions(-) create mode 100644 target/linux/bcm53xx/patches-4.4/045-ARM-BCM5301X-Add-back-handler-ignoring-external-impr.patch delete mode 100644 target/linux/bcm53xx/patches-4.4/800-PCI-iproc-Ignore-ARM-core-aborts-when-running-on-bcm.patch diff --git a/target/linux/bcm53xx/patches-4.4/045-ARM-BCM5301X-Add-back-handler-ignoring-external-impr.patch b/target/linux/bcm53xx/patches-4.4/045-ARM-BCM5301X-Add-back-handler-ignoring-external-impr.patch new file mode 100644 index 0000000000..a4f32f5c14 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/045-ARM-BCM5301X-Add-back-handler-ignoring-external-impr.patch @@ -0,0 +1,75 @@ +From 09f3510fb70a46c8921f2cf4a90dbcae460a6820 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sat, 29 Oct 2016 13:12:29 +0200 +Subject: [PATCH] ARM: BCM5301X: Add back handler ignoring external imprecise + aborts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since early BCM5301X days we got abort handler that was removed by +commit 937b12306ea79 ("ARM: BCM5301X: remove workaround imprecise abort +fault handler"). It assumed we need to deal only with pending aborts +left by the bootloader. Unfortunately this isn't true for BCM5301X. + +When probing PCI config space (device enumeration) it is expected to +have master aborts on the PCI bus. Most bridges don't forward (or they +allow disabling it) these errors onto the AXI/AMBA bus but not the +Northstar (BCM5301X) one. + +iProc PCIe controller on Northstar seems to be some older one, without +a control register for errors forwarding. It means we need to workaround +this at platform level. All newer platforms are not affected by this +issue. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Florian Fainelli +--- + arch/arm/mach-bcm/bcm_5301x.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +--- a/arch/arm/mach-bcm/bcm_5301x.c ++++ b/arch/arm/mach-bcm/bcm_5301x.c +@@ -9,14 +9,42 @@ + #include + + #include ++#include ++#include ++ ++#define FSR_EXTERNAL (1 << 12) ++#define FSR_READ (0 << 10) ++#define FSR_IMPRECISE 0x0406 + + static const char *const bcm5301x_dt_compat[] __initconst = { + "brcm,bcm4708", + NULL, + }; + ++static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr, ++ struct pt_regs *regs) ++{ ++ /* ++ * We want to ignore aborts forwarded from the PCIe bus that are ++ * expected and shouldn't really be passed by the PCIe controller. ++ * The biggest disadvantage is the same FSR code may be reported when ++ * reading non-existing APB register and we shouldn't ignore that. ++ */ ++ if (fsr == (FSR_EXTERNAL | FSR_READ | FSR_IMPRECISE)) ++ return 0; ++ ++ return 1; ++} ++ ++static void __init bcm5301x_init_early(void) ++{ ++ hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR, ++ "imprecise external abort"); ++} ++ + DT_MACHINE_START(BCM5301X, "BCM5301X") + .l2c_aux_val = 0, + .l2c_aux_mask = ~0, + .dt_compat = bcm5301x_dt_compat, ++ .init_early = bcm5301x_init_early, + MACHINE_END diff --git a/target/linux/bcm53xx/patches-4.4/800-PCI-iproc-Ignore-ARM-core-aborts-when-running-on-bcm.patch b/target/linux/bcm53xx/patches-4.4/800-PCI-iproc-Ignore-ARM-core-aborts-when-running-on-bcm.patch deleted file mode 100644 index af1ae6137b..0000000000 --- a/target/linux/bcm53xx/patches-4.4/800-PCI-iproc-Ignore-ARM-core-aborts-when-running-on-bcm.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] PCI: iproc: Ignore ARM core aborts when running on bcma bus -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Northstar devices have host bridges that forward errors to the ARM core. -These errors happen during PCI bus probing (device enumeration) and are -expected. There is no reason for them to cause a die() so this patch -adds a handler silencing them. - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/pci/host/pcie-iproc-bcma.c -+++ b/drivers/pci/host/pcie-iproc-bcma.c -@@ -40,6 +40,15 @@ static int iproc_pcie_bcma_map_irq(const - return bcma_core_irq(bdev, 5); - } - -+static int iproc_pcie_bcma_abort_handler(unsigned long addr, unsigned int fsr, -+ struct pt_regs *regs) -+{ -+ if (fsr == 0x1406) -+ return 0; -+ -+ return 1; -+} -+ - static int iproc_pcie_bcma_probe(struct bcma_device *bdev) - { - struct iproc_pcie *pcie; -@@ -65,6 +74,9 @@ static int iproc_pcie_bcma_probe(struct - - pcie->map_irq = iproc_pcie_bcma_map_irq; - -+ hook_fault_code(16 + 6, iproc_pcie_bcma_abort_handler, SIGBUS, BUS_OBJERR, -+ "imprecise external abort"); -+ - ret = iproc_pcie_setup(pcie, &res); - if (ret) - dev_err(pcie->dev, "PCIe controller setup failed\n"); -- 2.30.2