Skip to contentSkip to conversation

ARM: handle imprecise aborts from firmware in common code

PATCH New Lucas Stach 6 participants 16 messages Oct 15, 2015 – Nov 25, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: handle imprecise aborts from firmware in common code

This series implements the handling of a pending imprecise abort left behind by the bootloader/firmware running before Linux in the common ARM startup code.

It turns pending imprecise aborts that may signal during the first unmasking of such aborts on the boot CPU into a non-faulting event and warns the user that the firmware of the machine might be buggy.

Handling this in the common code makes sure that we only ignore already pending aborts and not those that may happen later during system boot/usage. It also allows to remove the custom fault handler from the 3 architectures that are known to have bad firmware/bootloaders.

V2 adapts patch 1 to suggestions from Russell and Hauke and drops former patch 3 (ARM: mvebu: remove the workaround imprecise abort fault handler) as it has already been applied.

Regards,
Lucas

Lucas Stach (3):
ARM: catch pending imprecise abort on unmask
ARM: OMAP2+: remove custom abort handler for t410
ARM: BCM5301X: remove workaround imprecise abort fault handler

 arch/arm/mach-bcm/bcm_5301x.c      | 35 -----------------------------------
 arch/arm/mach-omap2/pdata-quirks.c | 29 -----------------------------
 arch/arm/mm/fault.c                | 22 ++++++++++++++++++++++
 arch/arm/mm/fault.h                |  1 +
 arch/arm/mm/mmu.c                  |  3 ++-
 5 files changed, 25 insertions(+), 65 deletions(-)
Signature · 1 line
2.6.1
#1 lore raw

PATCH v2 1/3 ARM: catch pending imprecise abort on unmask

Install a non-faulting handler just before unmasking imprecise aborts and switch back to the regular one after unmasking is done.

This catches any pending imprecise abort that the firmware/bootloader may have left behind that would normally crash the kernel at that point. As there are apparently a lot of bootlaoders out there that do such a thing it makes sense to handle it in the common startup code.

---
v2:
- move temporary fault handler swapping into fault.c to hide it from other parts of the kernel
- print FSR, when warning user about bad firmware/bootloader

---
 arch/arm/mm/fault.c | 22 ++++++++++++++++++++++
 arch/arm/mm/fault.h |  1 +
 arch/arm/mm/mmu.c   |  3 ++-
 3 files changed, 25 insertions(+), 1 deletion(-)
arch/arm/mm/fault.c +22 -0
index 0d629b8f973f..daafcf121ce0 100644
@@ -593,6 +593,28 @@ do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs)
 	arm_notify_die("", regs, &info, ifsr, 0);
 }
 
+/*
+ * Abort handler to be used only during first unmasking of asynchronous aborts
+ * on the boot CPU. This makes sure that the machine will not die if the
+ * firmware/bootloader left an imprecise abort pending for us to trip over.
+ */
+static int __init early_abort_handler(unsigned long addr, unsigned int fsr,
+				      struct pt_regs *regs)
+{
+	pr_warn("Hit pending asynchronous external abort (FSR=0x%08x) during "
+		"first unmask, this is most likely caused by a "
+		"firmware/bootloader bug.\n", fsr);
+
+	return 0;
+}
+
+void __init early_abt_enable(void)
+{
+	fsr_info[22].fn = early_abort_handler;
+	local_abt_enable();
+	fsr_info[22].fn = do_bad;
+}
+
 #ifndef CONFIG_ARM_LPAE
 static int __init exceptions_init(void)
 {
arch/arm/mm/fault.h +1 -0
index cf08bdfbe0d6..05ec5e0df32d 100644
@@ -24,5 +24,6 @@ static inline int fsr_fs(unsigned int fsr)
 
 void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
 unsigned long search_exception_table(unsigned long addr);
+void early_abt_enable(void);
 
 #endif	/* __ARCH_ARM_FAULT_H */
arch/arm/mm/mmu.c +2 -1
index f65a6f344b6d..4867f5daf82c 100644
@@ -38,6 +38,7 @@
 #include <asm/mach/pci.h>
 #include <asm/fixmap.h>
 
+#include "fault.h"
 #include "mm.h"
 #include "tcm.h"
 
@@ -1365,7 +1366,7 @@ static void __init devicemaps_init(const struct machine_desc *mdesc)
 	flush_cache_all();
 
 	/* Enable asynchronous aborts */
-	local_abt_enable();
+	early_abt_enable();
 }
 
 static void __init kmap_init(void)
Signature · 1 line
2.6.1
#2 lore raw

PATCH v2 1/3 ARM: catch pending imprecise abort on unmask

Quoted 9 lines · Lucas Stach

Install a non-faulting handler just before unmasking imprecise aborts and switch back to the regular one after unmasking is done.

This catches any pending imprecise abort that the firmware/bootloader may have left behind that would normally crash the kernel at that point. As there are apparently a lot of bootlaoders out there that do such a thing it makes sense to handle it in the common startup code.

Much better. Please feel free to add it to the patch system, thanks.

I think, given that the original seems to be breaking platforms, this patch needs to go into -rc kernels, right?

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
maintainer
#3 lore raw

PATCH v2 1/3 ARM: catch pending imprecise abort on unmask

Quoted 9 lines · Russell King - ARM Linux
Quoted 8 lines · Lucas Stach

Install a non-faulting handler just before unmasking imprecise aborts and switch back to the regular one after unmasking is done.

This catches any pending imprecise abort that the firmware/bootloader may have left behind that would normally crash the kernel at that point. As there are apparently a lot of bootlaoders out there that do such a thing it makes sense to handle it in the common startup code.

Quoted 6 lines
Quoted 1 line

Much better. Please feel free to add it to the patch system, thanks.

I think, given that the original seems to be breaking platforms, this patch needs to go into -rc kernels, right?

Hmm do we still see a trace where the issue happened though with this one?

What I though wes something pending from the bootloader, turned out to be a bogus SRAM init code that I was able to easily fix with the trace.

Regards,

Tony

#4 lore raw

PATCH v2 1/3 ARM: catch pending imprecise abort on unmask

Quoted 12 lines · Tony Lindgren
Quoted 11 lines · Russell King - ARM Linux
Quoted 9 lines · Lucas Stach

Install a non-faulting handler just before unmasking imprecise aborts and switch back to the regular one after unmasking is done.

This catches any pending imprecise abort that the firmware/bootloader may have left behind that would normally crash the kernel at that point. As there are apparently a lot of bootlaoders out there that do such a thing it makes sense to handle it in the common startup code.

Quoted 7 lines
Quoted 4 lines

Much better. Please feel free to add it to the patch system, thanks.

I think, given that the original seems to be breaking platforms, this patch needs to go into -rc kernels, right?

Hmm do we still see a trace where the issue happened though with this one?

That's not the intention of this specific patch.

This is solely to detect the bootloader induced imprecise exception, nothing more. A backtrace for that won't be useful in any shape or form - in fact, the backtrace will be well known (it'll be from the site where the imprecise exceptions are unmasked.)

Any imprecise exception which happens after this will be handled in the normal way: it'll raise a kernel oops, and that will have all the details that a kernel oops normally has.

The difference is, rather than the boot loader provoking the kernel to oops at this point, we're able to report the event and continue on.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
maintainer
#5 lore raw

PATCH v2 1/3 ARM: catch pending imprecise abort on unmask

Quoted 23 lines · Russell King - ARM Linux
Quoted 12 lines · Tony Lindgren
Quoted 11 lines · Russell King - ARM Linux
Quoted 9 lines · Lucas Stach

Install a non-faulting handler just before unmasking imprecise aborts and switch back to the regular one after unmasking is done.

This catches any pending imprecise abort that the firmware/bootloader may have left behind that would normally crash the kernel at that point. As there are apparently a lot of bootlaoders out there that do such a thing it makes sense to handle it in the common startup code.

Quoted 7 lines
Quoted 4 lines

Much better. Please feel free to add it to the patch system, thanks.

I think, given that the original seems to be breaking platforms, this patch needs to go into -rc kernels, right?

Hmm do we still see a trace where the issue happened though with this one?

That's not the intention of this specific patch.

Quoted 8 lines

This is solely to detect the bootloader induced imprecise exception, nothing more. A backtrace for that won't be useful in any shape or form - in fact, the backtrace will be well known (it'll be from the site where the imprecise exceptions are unmasked.)

Any imprecise exception which happens after this will be handled in the normal way: it'll raise a kernel oops, and that will have all the details that a kernel oops normally has.

OK makes sense.

Quoted 2 lines

The difference is, rather than the boot loader provoking the kernel to oops at this point, we're able to report the event and continue on.

OK

Tony

#6 lore raw

PATCH v2 1/3 ARM: catch pending imprecise abort on unmask

In reply to Russell King - ARM Linux

Am Donnerstag, den 15.10.2015, 16:32 +0100 schrieb Russell King - ARM Linux:

Quoted 13 lines · Lucas Stach
Quoted 9 lines

Install a non-faulting handler just before unmasking imprecise aborts and switch back to the regular one after unmasking is done.

This catches any pending imprecise abort that the firmware/bootloader may have left behind that would normally crash the kernel at that point. As there are apparently a lot of bootlaoders out there that do such a thing it makes sense to handle it in the common startup code.

Much better. Please feel free to add it to the patch system, thanks.

Do you feel like taking patches 2 and 3 through your tree too, given that they are already acked by the platform maintainers, or should they pick them up themselves?

Quoted 3 lines

I think, given that the original seems to be breaking platforms, this patch needs to go into -rc kernels, right?

No, the original patch is only queued for 4.4, so the regression is only in -next. This patch only needs to make it into your 4.4 pull request.

Thanks,
Lucas

Signature · 2 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |
#7 lore raw

PATCH v2 1/3 ARM: catch pending imprecise abort on unmask

In reply to Russell King - ARM Linux

Am Donnerstag, den 15.10.2015, 16:32 +0100 schrieb Russell King - ARM Linux:

Quoted 9 lines · Lucas Stach
Quoted 8 lines

Install a non-faulting handler just before unmasking imprecise aborts and switch back to the regular one after unmasking is done.

This catches any pending imprecise abort that the firmware/bootloader may have left behind that would normally crash the kernel at that point. As there are apparently a lot of bootlaoders out there that do such a thing it makes sense to handle it in the common startup code.

Quoted 7 lines
Quoted 1 line

Much better. Please feel free to add it to the patch system, thanks.

I think, given that the original seems to be breaking platforms, this patch needs to go into -rc kernels, right?

Okay, this is in the patch system as patch 8447/1 now.

As Russell hasn't said whether he would like to pick up the platform patches I've omitted them for now and would ask the platform maintainers to pick them up themselves for kernel 4.4.

Regards,
Lucas

Signature · 2 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |
#8 lore raw

PATCH v2 2/3 ARM: OMAP2+: remove custom abort handler for t410

In reply to Lucas Stach

This is not needed anymore. Handling a potentially pending imprecise external abort left behind by the bootloader is now done in a slightly safer way inside the common ARM startup code.

---
 arch/arm/mach-omap2/pdata-quirks.c | 29 -----------------------------
 1 file changed, 29 deletions(-)
arch/arm/mach-omap2/pdata-quirks.c +0 -29
index ea56397599c2..3a2bc2a88db4 100644
@@ -24,9 +24,6 @@
 #include <linux/platform_data/iommu-omap.h>
 #include <linux/platform_data/wkup_m3.h>
 
-#include <asm/siginfo.h>
-#include <asm/signal.h>
-
 #include "common.h"
 #include "common-board-devices.h"
 #include "dss-common.h"
@@ -385,29 +382,6 @@ static void __init omap3_pandora_legacy_init(void)
 }
 #endif /* CONFIG_ARCH_OMAP3 */
 
-#ifdef CONFIG_SOC_TI81XX
-static int fault_fixed_up;
-
-static int t410_abort_handler(unsigned long addr, unsigned int fsr,
-			      struct pt_regs *regs)
-{
-	if ((fsr == 0x406 || fsr == 0xc06) && !fault_fixed_up) {
-		pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
-			addr, fsr);
-		fault_fixed_up = 1;
-		return 0;
-	}
-
-	return 1;
-}
-
-static void __init t410_abort_init(void)
-{
-	hook_fault_code(16 + 6, t410_abort_handler, SIGBUS, BUS_OBJERR,
-			"imprecise external abort");
-}
-#endif
-
 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
 static struct iommu_platform_data omap4_iommu_pdata = {
 	.reset_name = "mmu_cache",
@@ -536,9 +510,6 @@ static struct pdata_init pdata_quirks[] __initdata = {
 	{ "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
 	{ "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
 #endif
-#ifdef CONFIG_SOC_TI81XX
-	{ "hp,t410", t410_abort_init, },
-#endif
 #ifdef CONFIG_SOC_OMAP5
 	{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
 #endif
Signature · 1 line
2.6.1
#9 lore raw

PATCH v2 2/3 ARM: OMAP2+: remove custom abort handler for t410

Tony,

can you please take this patch through the OMAP tree for 4.4? The first patch in this series went in through Russells tree, so the below code now has the possibility to hide a real abort later during boot.

Regards,
Lucas

Am Donnerstag, den 15.10.2015, 12:32 +0200 schrieb Lucas Stach:

Quoted 64 lines

This is not needed anymore. Handling a potentially pending imprecise external abort left behind by the bootloader is now done in a slightly safer way inside the common ARM startup code.

---
 arch/arm/mach-omap2/pdata-quirks.c | 29 -----------------------------
 1 file changed, 29 deletions(-)
arch/arm/mach-omap2/pdata-quirks.c +0 -29
index ea56397599c2..3a2bc2a88db4 100644
@@ -24,9 +24,6 @@
 #include <linux/platform_data/iommu-omap.h>
 #include <linux/platform_data/wkup_m3.h>
 
-#include <asm/siginfo.h>
-#include <asm/signal.h>
-
 #include "common.h"
 #include "common-board-devices.h"
 #include "dss-common.h"
@@ -385,29 +382,6 @@ static void __init omap3_pandora_legacy_init(void)
 }
 #endif /* CONFIG_ARCH_OMAP3 */
 
-#ifdef CONFIG_SOC_TI81XX
-static int fault_fixed_up;
-
-static int t410_abort_handler(unsigned long addr, unsigned int fsr,
-			      struct pt_regs *regs)
-{
-	if ((fsr == 0x406 || fsr == 0xc06) && !fault_fixed_up) {
-		pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
-			addr, fsr);
-		fault_fixed_up = 1;
-		return 0;
-	}
-
-	return 1;
-}
-
-static void __init t410_abort_init(void)
-{
-	hook_fault_code(16 + 6, t410_abort_handler, SIGBUS, BUS_OBJERR,
-			"imprecise external abort");
-}
-#endif
-
 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
 static struct iommu_platform_data omap4_iommu_pdata = {
 	.reset_name = "mmu_cache",
@@ -536,9 +510,6 @@ static struct pdata_init pdata_quirks[] __initdata = {
 	{ "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
 	{ "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
 #endif
-#ifdef CONFIG_SOC_TI81XX
-	{ "hp,t410", t410_abort_init, },
-#endif
 #ifdef CONFIG_SOC_OMAP5
 	{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
 #endif
Signature · 2 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |
maintainer
#10 lore raw

PATCH v2 2/3 ARM: OMAP2+: remove custom abort handler for t410

Quoted 5 lines · Lucas Stach

Tony,

can you please take this patch through the OMAP tree for 4.4? The first patch in this series went in through Russells tree, so the below code now has the possibility to hide a real abort later during boot.

OK will do thanks. I've also verified that the abort handler is no longer needed. After seeing where it happens, fixing it was trivial :)

FYI, the fix was 57df53808534 ("ARM: OMAP2+: Fix imprecise external abort caused by bogus SRAM init"). Other platforms may have similar issues where it's not really anything left behind by the bootloader but a real kernel bug.

Regards,

Tony

Quoted 71 lines

Am Donnerstag, den 15.10.2015, 12:32 +0200 schrieb Lucas Stach:

Quoted 64 lines

This is not needed anymore. Handling a potentially pending imprecise external abort left behind by the bootloader is now done in a slightly safer way inside the common ARM startup code.

---
 arch/arm/mach-omap2/pdata-quirks.c | 29 -----------------------------
 1 file changed, 29 deletions(-)
arch/arm/mach-omap2/pdata-quirks.c +0 -29
index ea56397599c2..3a2bc2a88db4 100644
@@ -24,9 +24,6 @@
 #include <linux/platform_data/iommu-omap.h>
 #include <linux/platform_data/wkup_m3.h>
 
-#include <asm/siginfo.h>
-#include <asm/signal.h>
-
 #include "common.h"
 #include "common-board-devices.h"
 #include "dss-common.h"
@@ -385,29 +382,6 @@ static void __init omap3_pandora_legacy_init(void)
 }
 #endif /* CONFIG_ARCH_OMAP3 */
 
-#ifdef CONFIG_SOC_TI81XX
-static int fault_fixed_up;
-
-static int t410_abort_handler(unsigned long addr, unsigned int fsr,
-			      struct pt_regs *regs)
-{
-	if ((fsr == 0x406 || fsr == 0xc06) && !fault_fixed_up) {
-		pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
-			addr, fsr);
-		fault_fixed_up = 1;
-		return 0;
-	}
-
-	return 1;
-}
-
-static void __init t410_abort_init(void)
-{
-	hook_fault_code(16 + 6, t410_abort_handler, SIGBUS, BUS_OBJERR,
-			"imprecise external abort");
-}
-#endif
-
 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
 static struct iommu_platform_data omap4_iommu_pdata = {
 	.reset_name = "mmu_cache",
@@ -536,9 +510,6 @@ static struct pdata_init pdata_quirks[] __initdata = {
 	{ "openpandora,omap3-pandora-600mhz", omap3_pandora_legacy_init, },
 	{ "openpandora,omap3-pandora-1ghz", omap3_pandora_legacy_init, },
 #endif
-#ifdef CONFIG_SOC_TI81XX
-	{ "hp,t410", t410_abort_init, },
-#endif
 #ifdef CONFIG_SOC_OMAP5
 	{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
 #endif
Signature · 2 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |
#11 lore raw

PATCH v2 3/3 ARM: BCM5301X: remove workaround imprecise abort fault handler

In reply to Lucas Stach

This is not needed anymore. Handling a potentially pending imprecise external abort left behind by the bootloader is now done in a slightly safer way inside the common ARM startup code.

---
 arch/arm/mach-bcm/bcm_5301x.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)
arch/arm/mach-bcm/bcm_5301x.c +0 -35
index 5478fe6bcce6..c8830a2b0d60 100644
@@ -9,40 +9,6 @@
 #include <asm/hardware/cache-l2x0.h>
 
 #include <asm/mach/arch.h>
-#include <asm/siginfo.h>
-#include <asm/signal.h>
-
-
-static bool first_fault = true;
-
-static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr,
-				 struct pt_regs *regs)
-{
-	if ((fsr == 0x1406 || fsr == 0x1c06) && first_fault) {
-		first_fault = false;
-
-		/*
-		 * These faults with codes 0x1406 (BCM4709) or 0x1c06 happens
-		 * for no good reason, possibly left over from the CFE boot
-		 * loader.
-		 */
-		pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
-			addr, fsr);
-
-		/* Returning non-zero causes fault display and panic */
-		return 0;
-	}
-
-	/* Others should cause a fault */
-	return 1;
-}
-
-static void __init bcm5301x_init_early(void)
-{
-	/* Install our hook */
-	hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR,
-			"imprecise external abort");
-}
 
 static const char *const bcm5301x_dt_compat[] __initconst = {
 	"brcm,bcm4708",
@@ -52,6 +18,5 @@ static const char *const bcm5301x_dt_compat[] __initconst = {
 DT_MACHINE_START(BCM5301X, "BCM5301X")
 	.l2c_aux_val	= 0,
 	.l2c_aux_mask	= ~0,
-	.init_early	= bcm5301x_init_early,
 	.dt_compat	= bcm5301x_dt_compat,
 MACHINE_END
Signature · 1 line
2.6.1
#12 lore raw

PATCH v2 3/3 ARM: BCM5301X: remove workaround imprecise abort fault handler

Hauke,

can you please take this patch through your tree for 4.4? The first patch in this series went in through Russells tree, so the below code now has the possibility to hide a real abort later during boot.

Regards,
Lucas

Am Donnerstag, den 15.10.2015, 12:32 +0200 schrieb Lucas Stach:

Quoted 62 lines

This is not needed anymore. Handling a potentially pending imprecise external abort left behind by the bootloader is now done in a slightly safer way inside the common ARM startup code.

---
 arch/arm/mach-bcm/bcm_5301x.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)
arch/arm/mach-bcm/bcm_5301x.c +0 -35
index 5478fe6bcce6..c8830a2b0d60 100644
@@ -9,40 +9,6 @@
 #include <asm/hardware/cache-l2x0.h>
 
 #include <asm/mach/arch.h>
-#include <asm/siginfo.h>
-#include <asm/signal.h>
-
-
-static bool first_fault = true;
-
-static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr,
-				 struct pt_regs *regs)
-{
-	if ((fsr == 0x1406 || fsr == 0x1c06) && first_fault) {
-		first_fault = false;
-
-		/*
-		 * These faults with codes 0x1406 (BCM4709) or 0x1c06 happens
-		 * for no good reason, possibly left over from the CFE boot
-		 * loader.
-		 */
-		pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
-			addr, fsr);
-
-		/* Returning non-zero causes fault display and panic */
-		return 0;
-	}
-
-	/* Others should cause a fault */
-	return 1;
-}
-
-static void __init bcm5301x_init_early(void)
-{
-	/* Install our hook */
-	hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR,
-			"imprecise external abort");
-}
 
 static const char *const bcm5301x_dt_compat[] __initconst = {
 	"brcm,bcm4708",
@@ -52,6 +18,5 @@ static const char *const bcm5301x_dt_compat[] __initconst = {
 DT_MACHINE_START(BCM5301X, "BCM5301X")
 	.l2c_aux_val	= 0,
 	.l2c_aux_mask	= ~0,
-	.init_early	= bcm5301x_init_early,
 	.dt_compat	= bcm5301x_dt_compat,
 MACHINE_END
Signature · 2 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |
maintainer
#13 lore raw

PATCH v2 3/3 ARM: BCM5301X: remove workaround imprecise abort fault handler

Hi Florian,

can you please take this patch for 4.4.

I do not have an own tree, Florian takes the patches for BCM5301X

Hauke

Quoted 73 lines · Lucas Stach

Hauke,

can you please take this patch through your tree for 4.4? The first patch in this series went in through Russells tree, so the below code now has the possibility to hide a real abort later during boot.

Regards,
Lucas

Am Donnerstag, den 15.10.2015, 12:32 +0200 schrieb Lucas Stach:

Quoted 62 lines

This is not needed anymore. Handling a potentially pending imprecise external abort left behind by the bootloader is now done in a slightly safer way inside the common ARM startup code.

---
 arch/arm/mach-bcm/bcm_5301x.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)
arch/arm/mach-bcm/bcm_5301x.c +0 -35
index 5478fe6bcce6..c8830a2b0d60 100644
@@ -9,40 +9,6 @@
 #include <asm/hardware/cache-l2x0.h>
 
 #include <asm/mach/arch.h>
-#include <asm/siginfo.h>
-#include <asm/signal.h>
-
-
-static bool first_fault = true;
-
-static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr,
-				 struct pt_regs *regs)
-{
-	if ((fsr == 0x1406 || fsr == 0x1c06) && first_fault) {
-		first_fault = false;
-
-		/*
-		 * These faults with codes 0x1406 (BCM4709) or 0x1c06 happens
-		 * for no good reason, possibly left over from the CFE boot
-		 * loader.
-		 */
-		pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
-			addr, fsr);
-
-		/* Returning non-zero causes fault display and panic */
-		return 0;
-	}
-
-	/* Others should cause a fault */
-	return 1;
-}
-
-static void __init bcm5301x_init_early(void)
-{
-	/* Install our hook */
-	hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR,
-			"imprecise external abort");
-}
 
 static const char *const bcm5301x_dt_compat[] __initconst = {
 	"brcm,bcm4708",
@@ -52,6 +18,5 @@ static const char *const bcm5301x_dt_compat[] __initconst = {
 DT_MACHINE_START(BCM5301X, "BCM5301X")
 	.l2c_aux_val	= 0,
 	.l2c_aux_mask	= ~0,
-	.init_early	= bcm5301x_init_early,
 	.dt_compat	= bcm5301x_dt_compat,
 MACHINE_END
#14 lore raw

PATCH v2 3/3 ARM: BCM5301X: remove workaround imprecise abort fault handler

In reply to Lucas Stach
Quoted 6 lines · Lucas Stach

This is not needed anymore. Handling a potentially pending imprecise external abort left behind by the bootloader is now done in a slightly safer way inside the common ARM startup code.

Applied to soc/next, thanks!

Signature · 1 line
Florian
#15 lore raw

v2 cover ARM: handle imprecise aborts from firmware in common code

In reply to Lucas Stach

Hi Lucas,

Quoted 7 lines · Lucas Stach

This series implements the handling of a pending imprecise abort left behind by the bootloader/firmware running before Linux in the common ARM startup code.

It turns pending imprecise aborts that may signal during the first unmasking of such aborts on the boot CPU into a non-faulting event and warns the user that the firmware of the machine might be buggy.

Quoted 8 lines

Handling this in the common code makes sure that we only ignore already pending aborts and not those that may happen later during system boot/usage. It also allows to remove the custom fault handler from the 3 architectures that are known to have bad firmware/bootloaders.

V2 adapts patch 1 to suggestions from Russell and Hauke and drops former patch 3 (ARM: mvebu: remove the workaround imprecise abort fault handler) as it has already been applied.

I have build and boot tested the three patches in this series on top of next-20151016 with the kernelci.org system[1][2]. It found no new build/boot regressions and also I can confirm it fixes the issue reported here[3].

Cheers,

Tyler

[1] http://kernelci.org/boot/all/job/tbaker/kernel/v4.3-rc5-8587-g6890e51b69b2/
[2] http://kernelci.org/build/tbaker/kernel/v4.3-rc5-8587-g6890e51b69b2/
[3] http://www.spinics.net/lists/arm-kernel/msg451280.html