diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-09-04 05:47:48 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-04 15:23:36 -0400 |
commit | f00ec48fadf5e37e7889f14cff900aa70d18b644 (patch) | |
tree | 421cbce97167a78532aa825624f380caade3c0d2 /arch/arm/include/asm/assembler.h | |
parent | 067173526c3bbc2eaeefcf6b7b2a9d998b9e8042 (diff) |
ARM: Allow SMP kernels to boot on UP systems
UP systems do not implement all the instructions that SMP systems have,
so in order to boot a SMP kernel on a UP system, we need to rewrite
parts of the kernel.
Do this using an 'alternatives' scheme, where the kernel code and data
is modified prior to initialization to replace the SMP instructions,
thereby rendering the problematical code ineffectual. We use the linker
to generate a list of 32-bit word locations and their replacement values,
and run through these replacements when we detect a UP system.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include/asm/assembler.h')
-rw-r--r-- | arch/arm/include/asm/assembler.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 6e8f05c8a1c8..062b58c029ab 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h | |||
@@ -154,16 +154,39 @@ | |||
154 | .long 9999b,9001f; \ | 154 | .long 9999b,9001f; \ |
155 | .popsection | 155 | .popsection |
156 | 156 | ||
157 | #ifdef CONFIG_SMP | ||
158 | #define ALT_SMP(instr...) \ | ||
159 | 9998: instr | ||
160 | #define ALT_UP(instr...) \ | ||
161 | .pushsection ".alt.smp.init", "a" ;\ | ||
162 | .long 9998b ;\ | ||
163 | instr ;\ | ||
164 | .popsection | ||
165 | #define ALT_UP_B(label) \ | ||
166 | .equ up_b_offset, label - 9998b ;\ | ||
167 | .pushsection ".alt.smp.init", "a" ;\ | ||
168 | .long 9998b ;\ | ||
169 | b . + up_b_offset ;\ | ||
170 | .popsection | ||
171 | #else | ||
172 | #define ALT_SMP(instr...) | ||
173 | #define ALT_UP(instr...) instr | ||
174 | #define ALT_UP_B(label) b label | ||
175 | #endif | ||
176 | |||
157 | /* | 177 | /* |
158 | * SMP data memory barrier | 178 | * SMP data memory barrier |
159 | */ | 179 | */ |
160 | .macro smp_dmb | 180 | .macro smp_dmb |
161 | #ifdef CONFIG_SMP | 181 | #ifdef CONFIG_SMP |
162 | #if __LINUX_ARM_ARCH__ >= 7 | 182 | #if __LINUX_ARM_ARCH__ >= 7 |
163 | dmb | 183 | ALT_SMP(dmb) |
164 | #elif __LINUX_ARM_ARCH__ == 6 | 184 | #elif __LINUX_ARM_ARCH__ == 6 |
165 | mcr p15, 0, r0, c7, c10, 5 @ dmb | 185 | ALT_SMP(mcr p15, 0, r0, c7, c10, 5) @ dmb |
186 | #else | ||
187 | #error Incompatible SMP platform | ||
166 | #endif | 188 | #endif |
189 | ALT_UP(nop) | ||
167 | #endif | 190 | #endif |
168 | .endm | 191 | .endm |
169 | 192 | ||