]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: 8447/1: catch pending imprecise abort on unmask
authorLucas Stach <l.stach@pengutronix.de>
Mon, 19 Oct 2015 12:38:09 +0000 (13:38 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 19 Oct 2015 16:08:33 +0000 (17:08 +0100)
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.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Tyler Baker <tyler.baker@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/fault.c
arch/arm/mm/fault.h
arch/arm/mm/mmu.c

index 0d629b8f973fc2ca63aacb59e5baaf718b194543..daafcf121ce082aa0a0fbb43be3e3712b2942f3e 100644 (file)
@@ -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)
 {
index cf08bdfbe0d6b6168970e7962341dd407c2823fd..05ec5e0df32d7bad17f4564a74ad3fcbed88ee9c 100644 (file)
@@ -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 */
index f65a6f344b6dcdf6c3d23edf226b44ab8e2ee092..4867f5daf82c99bdf4ee64ebb6b61613cd792a3e 100644 (file)
@@ -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)