Skip to content

Commit 45a8334

Browse files
Suzuki K PouloseAKASHI Takahiro
authored andcommitted
arm64: Add a helper for parking CPUs in a loop
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>
1 parent 4cef048 commit 45a8334

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

arch/arm64/include/asm/smp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,12 @@ extern int __cpu_disable(void);
7878
extern void __cpu_die(unsigned int cpu);
7979
extern void cpu_die(void);
8080

81+
static inline void cpu_park_loop(void)
82+
{
83+
for (;;) {
84+
wfe();
85+
wfi();
86+
}
87+
}
88+
8189
#endif /* ifndef __ASM_SMP_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,7 @@ static void fail_incapable_cpu(char *cap_type,
909909
/* Check if we can park ourselves */
910910
if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_die)
911911
cpu_ops[cpu]->cpu_die(cpu);
912-
asm(
913-
"1: wfe\n"
914-
" wfi\n"
915-
" b 1b");
912+
cpu_park_loop();
916913
}
917914

918915
/*

0 commit comments

Comments
 (0)