aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2011-02-09 06:06:59 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-02-10 10:30:51 -0500
commit917692f5f7ec63de3b093c825913d68e910db282 (patch)
treed4f2a59ca417c446450df0c1a84384fcef501c7f /arch/arm
parent774c096bf9e49eebf7b5d2d9fdddf632c29ccea0 (diff)
ARM: 6655/1: Correct WFE() in asm/spinlock.h for Thumb-2
The content for ALT_SMP() in the definition of WFE() expands to 6 bytes (IT cc ; WFEcc.W), which breaks the assumptions of the fixup code, leading to lockups when the affected code gets run. This patch works around the problem by explicitly using an IT + WFEcc.N pair. Signed-off-by: Dave Martin <dave.martin@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/include/asm/spinlock.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index da1af5240159..fdd3820edff8 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -18,7 +18,23 @@
18 18
19#ifdef CONFIG_THUMB2_KERNEL 19#ifdef CONFIG_THUMB2_KERNEL
20#define SEV ALT_SMP("sev.w", "nop.w") 20#define SEV ALT_SMP("sev.w", "nop.w")
21#define WFE(cond) ALT_SMP("wfe" cond ".w", "nop.w") 21/*
22 * For Thumb-2, special care is needed to ensure that the conditional WFE
23 * instruction really does assemble to exactly 4 bytes (as required by
24 * the SMP_ON_UP fixup code). By itself "wfene" might cause the
25 * assembler to insert a extra (16-bit) IT instruction, depending on the
26 * presence or absence of neighbouring conditional instructions.
27 *
28 * To avoid this unpredictableness, an approprite IT is inserted explicitly:
29 * the assembler won't change IT instructions which are explicitly present
30 * in the input.
31 */
32#define WFE(cond) ALT_SMP( \
33 "it " cond "\n\t" \
34 "wfe" cond ".n", \
35 \
36 "nop.w" \
37)
22#else 38#else
23#define SEV ALT_SMP("sev", "nop") 39#define SEV ALT_SMP("sev", "nop")
24#define WFE(cond) ALT_SMP("wfe" cond, "nop") 40#define WFE(cond) ALT_SMP("wfe" cond, "nop")