Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1340515

[PATCH v5 1/7] arm64: Add a helper for parking CPUs in a loop

From Suzuki K Poulose <suzuki.poulose@arm.com>
Newsgroups linux.kernel
Subject [PATCH v5 1/7] arm64: Add a helper for parking CPUs in a loop
Date 2016-02-23 11:40 +0100
Message-ID <r5ixR-3Z2-39@gated-at.bofh.it> (permalink)
References <r5ixP-3Z2-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Adds a routine which can be used to park CPUs (spinning in kernel)
when they can't be killed.

Cc: Catalin Marinas <catalin.marinas@arm.com>
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>
---
 arch/arm64/include/asm/smp.h   |    8 ++++++++
 arch/arm64/kernel/cpufeature.c |    5 +----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index d9c3d6a..53b53a9 100644
--- a/arch/arm64/include/asm/smp.h
+++ b/arch/arm64/include/asm/smp.h
@@ -69,4 +69,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 */
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 5c90aa4..cc4a089 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -842,10 +842,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();
 }
 
 /*
-- 
1.7.9.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/7] Verify early CPU features Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-02-23 11:40 +0100
  [PATCH v5 4/7] arm64: Handle early CPU boot failures Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-02-23 11:40 +0100
  [PATCH v5 3/7] arm64: Move cpu_die_early to smp.c Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-02-23 11:40 +0100
  [PATCH v5 1/7] arm64: Add a helper for parking CPUs in a loop Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-02-23 11:40 +0100
  [PATCH v5 5/7] arm64: Enable CPU capability verification unconditionally Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-02-23 11:40 +0100
  [PATCH v5 2/7] arm64: Introduce cpu_die_early Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-02-23 11:40 +0100

csiph-web