arm64: Add a helper for parking CPUs in a loop
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 23 Feb 2016 10:31:39 +0000 (10:31 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 24 Feb 2016 17:17:44 +0000 (17:17 +0000)
Adds a routine which can be used to park CPUs (spinning in kernel)
when they can't be killed.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/smp.h
arch/arm64/kernel/cpufeature.c

index 2013a4dc5124a55c5c304306b41908f16a0e5d64..b93eb3303131582a0d93f1c0b73712e8d036c9be 100644 (file)
@@ -78,4 +78,12 @@ extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
 extern void cpu_die(void);
 
+static inline void cpu_park_loop(void)
+{
+       for (;;) {
+               wfe();
+               wfi();
+       }
+}
+
 #endif /* ifndef __ASM_SMP_H */
index 7566cad9fa1da5a882ada85b5801a8ae33f4da0c..99f0c5ce57589edea338a2f3c9541908611cab57 100644 (file)
@@ -890,10 +890,7 @@ static void fail_incapable_cpu(char *cap_type,
        /* Check if we can park ourselves */
        if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_die)
                cpu_ops[cpu]->cpu_die(cpu);
-       asm(
-       "1:     wfe\n"
-       "       wfi\n"
-       "       b       1b");
+       cpu_park_loop();
 }
 
 /*