arm64: Move the async/fiq helpers to explicitly set process context flags
authorJames Morse <james.morse@arm.com>
Thu, 2 Nov 2017 12:12:36 +0000 (12:12 +0000)
committerWill Deacon <will.deacon@arm.com>
Thu, 2 Nov 2017 15:55:41 +0000 (15:55 +0000)
Remove the local_{async,fiq}_{en,dis}able macros as they don't respect
our newly defined order and are only used to set the flags for process
context when we bring CPUs online.

Add a helper to do this. The IRQ flag varies as we want it masked on
the boot CPU until we are ready to handle interrupts.
The boot CPU unmasks SError during early boot once it can print an error
message. If we can print an error message about SError, we can do the
same for FIQ. Debug exceptions are already enabled by __cpu_setup(),
which has also configured MDSCR_EL1 to disable MDE and KDE.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Julien Thierry <julien.thierry@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/daifflags.h
arch/arm64/include/asm/irqflags.h
arch/arm64/kernel/setup.c
arch/arm64/kernel/smp.c

index 55e2598a8c4c8e00d7d06353e81c52683ce3ca95..22e4c83de5a5c34b8c9dcfcaee723edcd740fc4a 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <linux/irqflags.h>
 
+#define DAIF_PROCCTX           0
+#define DAIF_PROCCTX_NOIRQ     PSR_I_BIT
+
 /* mask/save/unmask/restore all exceptions, including interrupts. */
 static inline void local_daif_mask(void)
 {
index 9ecdca7011f0098d7a3440d1554597beab3be8df..24692edf1a691a95d623208dc9b8641b404c2248 100644 (file)
@@ -66,12 +66,6 @@ static inline void arch_local_irq_disable(void)
                : "memory");
 }
 
-#define local_fiq_enable()     asm("msr        daifclr, #1" : : : "memory")
-#define local_fiq_disable()    asm("msr        daifset, #1" : : : "memory")
-
-#define local_async_enable()   asm("msr        daifclr, #4" : : : "memory")
-#define local_async_disable()  asm("msr        daifset, #4" : : : "memory")
-
 /*
  * Save the current interrupt enable state.
  */
index 4bab73e80e33719aea343e1a09ccae016eaae32d..30ad2f085d1f027cb11f34c3efa37cf1ddc67c77 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/fixmap.h>
 #include <asm/cpu.h>
 #include <asm/cputype.h>
+#include <asm/daifflags.h>
 #include <asm/elf.h>
 #include <asm/cpufeature.h>
 #include <asm/cpu_ops.h>
@@ -259,10 +260,11 @@ void __init setup_arch(char **cmdline_p)
        parse_early_param();
 
        /*
-        *  Unmask asynchronous aborts after bringing up possible earlycon.
-        * (Report possible System Errors once we can report this occurred)
+        * Unmask asynchronous aborts and fiq after bringing up possible
+        * earlycon. (Report possible System Errors once we can report this
+        * occurred).
         */
-       local_async_enable();
+       local_daif_restore(DAIF_PROCCTX_NOIRQ);
 
        /*
         * TTBR0 is only used for the identity mapping at this stage. Make it
index c94f4a6515c406d65616e8427ea481dd23aa6b52..551eb07c53b6c76c5c76cf002152dc772148a8c2 100644 (file)
@@ -274,8 +274,7 @@ asmlinkage void secondary_start_kernel(void)
        set_cpu_online(cpu, true);
        complete(&cpu_running);
 
-       local_irq_enable();
-       local_async_enable();
+       local_daif_restore(DAIF_PROCCTX);
 
        /*
         * OK, it's off to the idle thread for us