diff options
-rw-r--r-- | arch/arm/include/asm/spinlock.h | 18 |
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") |