Commit 5085f3ff458521045f7e43da62b8c30ea7df2e82

Authored by Russell King
1 parent 37b05b6375

ARM: hotplug cpu: Keep processor information, startup code & __lookup_processor_type

When hotplug CPU is enabled, we need to keep the list of supported CPUs,
their setup functions, and __lookup_processor_type in place so that we
can find and initialize secondary CPUs.  Move these into the __CPUINIT
section.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Showing 26 changed files with 94 additions and 67 deletions Side-by-side Diff

arch/arm/kernel/head-common.S
... ... @@ -145,45 +145,14 @@
145 145  
146 146  
147 147 /*
148   - * Read processor ID register (CP#15, CR0), and look up in the linker-built
149   - * supported processor list. Note that we can't use the absolute addresses
150   - * for the __proc_info lists since we aren't running with the MMU on
151   - * (and therefore, we are not in the correct address space). We have to
152   - * calculate the offset.
153   - *
154   - * r9 = cpuid
155   - * Returns:
156   - * r3, r4, r6 corrupted
157   - * r5 = proc_info pointer in physical address space
158   - * r9 = cpuid (preserved)
  148 + * This provides a C-API version of __lookup_processor_type
159 149 */
160   -__lookup_processor_type:
161   - adr r3, 3f
162   - ldmia r3, {r5 - r7}
163   - add r3, r3, #8
164   - sub r3, r3, r7 @ get offset between virt&phys
165   - add r5, r5, r3 @ convert virt addresses to
166   - add r6, r6, r3 @ physical address space
167   -1: ldmia r5, {r3, r4} @ value, mask
168   - and r4, r4, r9 @ mask wanted bits
169   - teq r3, r4
170   - beq 2f
171   - add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)
172   - cmp r5, r6
173   - blo 1b
174   - mov r5, #0 @ unknown processor
175   -2: mov pc, lr
176   -ENDPROC(__lookup_processor_type)
177   -
178   -/*
179   - * This provides a C-API version of the above function.
180   - */
181 150 ENTRY(lookup_processor_type)
182   - stmfd sp!, {r4 - r7, r9, lr}
  151 + stmfd sp!, {r4 - r6, r9, lr}
183 152 mov r9, r0
184 153 bl __lookup_processor_type
185 154 mov r0, r5
186   - ldmfd sp!, {r4 - r7, r9, pc}
  155 + ldmfd sp!, {r4 - r6, r9, pc}
187 156 ENDPROC(lookup_processor_type)
188 157  
189 158 /*
... ... @@ -191,8 +160,6 @@
191 160 * more information about the __proc_info and __arch_info structures.
192 161 */
193 162 .align 2
194   -3: .long __proc_info_begin
195   - .long __proc_info_end
196 163 4: .long .
197 164 .long __arch_info_begin
198 165 .long __arch_info_end
... ... @@ -265,4 +232,46 @@
265 232 1: mov r2, #0
266 233 mov pc, lr
267 234 ENDPROC(__vet_atags)
  235 +
  236 +/*
  237 + * Read processor ID register (CP#15, CR0), and look up in the linker-built
  238 + * supported processor list. Note that we can't use the absolute addresses
  239 + * for the __proc_info lists since we aren't running with the MMU on
  240 + * (and therefore, we are not in the correct address space). We have to
  241 + * calculate the offset.
  242 + *
  243 + * r9 = cpuid
  244 + * Returns:
  245 + * r3, r4, r6 corrupted
  246 + * r5 = proc_info pointer in physical address space
  247 + * r9 = cpuid (preserved)
  248 + */
  249 + __CPUINIT
  250 +__lookup_processor_type:
  251 + adr r3, __lookup_processor_type_data
  252 + ldmia r3, {r4 - r6}
  253 + sub r3, r3, r4 @ get offset between virt&phys
  254 + add r5, r5, r3 @ convert virt addresses to
  255 + add r6, r6, r3 @ physical address space
  256 +1: ldmia r5, {r3, r4} @ value, mask
  257 + and r4, r4, r9 @ mask wanted bits
  258 + teq r3, r4
  259 + beq 2f
  260 + add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)
  261 + cmp r5, r6
  262 + blo 1b
  263 + mov r5, #0 @ unknown processor
  264 +2: mov pc, lr
  265 +ENDPROC(__lookup_processor_type)
  266 +
  267 +/*
  268 + * Look in <asm/procinfo.h> for information about the __proc_info structure.
  269 + */
  270 + .align 2
  271 + .type __lookup_processor_type_data, %object
  272 +__lookup_processor_type_data:
  273 + .long .
  274 + .long __proc_info_begin
  275 + .long __proc_info_end
  276 + .size __lookup_processor_type_data, . - __lookup_processor_type_data
arch/arm/kernel/vmlinux.lds.S
... ... @@ -8,6 +8,19 @@
8 8 #include <asm/memory.h>
9 9 #include <asm/page.h>
10 10  
  11 +#define PROC_INFO \
  12 + VMLINUX_SYMBOL(__proc_info_begin) = .; \
  13 + *(.proc.info.init) \
  14 + VMLINUX_SYMBOL(__proc_info_end) = .;
  15 +
  16 +#ifdef CONFIG_HOTPLUG_CPU
  17 +#define ARM_CPU_DISCARD(x)
  18 +#define ARM_CPU_KEEP(x) x
  19 +#else
  20 +#define ARM_CPU_DISCARD(x) x
  21 +#define ARM_CPU_KEEP(x)
  22 +#endif
  23 +
11 24 OUTPUT_ARCH(arm)
12 25 ENTRY(stext)
13 26  
... ... @@ -31,9 +44,7 @@
31 44 HEAD_TEXT
32 45 INIT_TEXT
33 46 _einittext = .;
34   - __proc_info_begin = .;
35   - *(.proc.info.init)
36   - __proc_info_end = .;
  47 + ARM_CPU_DISCARD(PROC_INFO)
37 48 __arch_info_begin = .;
38 49 *(.arch.info.init)
39 50 __arch_info_end = .;
... ... @@ -68,10 +79,8 @@
68 79 /DISCARD/ : {
69 80 *(.ARM.exidx.exit.text)
70 81 *(.ARM.extab.exit.text)
71   -#ifndef CONFIG_HOTPLUG_CPU
72   - *(.ARM.exidx.cpuexit.text)
73   - *(.ARM.extab.cpuexit.text)
74   -#endif
  82 + ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
  83 + ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
75 84 #ifndef CONFIG_HOTPLUG
76 85 *(.ARM.exidx.devexit.text)
77 86 *(.ARM.extab.devexit.text)
... ... @@ -100,6 +109,7 @@
100 109 *(.glue_7)
101 110 *(.glue_7t)
102 111 *(.got) /* Global offset table */
  112 + ARM_CPU_KEEP(PROC_INFO)
103 113 }
104 114  
105 115 RO_DATA(PAGE_SIZE)
arch/arm/mm/proc-arm1020.S
... ... @@ -430,7 +430,7 @@
430 430 #endif /* CONFIG_MMU */
431 431 mov pc, lr
432 432  
433   - __INIT
  433 + __CPUINIT
434 434  
435 435 .type __arm1020_setup, #function
436 436 __arm1020_setup:
arch/arm/mm/proc-arm1020e.S
... ... @@ -412,7 +412,7 @@
412 412 #endif /* CONFIG_MMU */
413 413 mov pc, lr
414 414  
415   - __INIT
  415 + __CPUINIT
416 416  
417 417 .type __arm1020e_setup, #function
418 418 __arm1020e_setup:
arch/arm/mm/proc-arm1022.S
... ... @@ -394,7 +394,7 @@
394 394 #endif /* CONFIG_MMU */
395 395 mov pc, lr
396 396  
397   - __INIT
  397 + __CPUINIT
398 398  
399 399 .type __arm1022_setup, #function
400 400 __arm1022_setup:
arch/arm/mm/proc-arm1026.S
... ... @@ -384,7 +384,7 @@
384 384 mov pc, lr
385 385  
386 386  
387   - __INIT
  387 + __CPUINIT
388 388  
389 389 .type __arm1026_setup, #function
390 390 __arm1026_setup:
arch/arm/mm/proc-arm6_7.S
... ... @@ -238,7 +238,7 @@
238 238 mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc
239 239 mov pc, r0
240 240  
241   - __INIT
  241 + __CPUINIT
242 242  
243 243 .type __arm6_setup, #function
244 244 __arm6_setup: mov r0, #0
arch/arm/mm/proc-arm720.S
... ... @@ -113,7 +113,7 @@
113 113 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
114 114 mov pc, r0
115 115  
116   - __INIT
  116 + __CPUINIT
117 117  
118 118 .type __arm710_setup, #function
119 119 __arm710_setup:
arch/arm/mm/proc-arm740.S
... ... @@ -55,7 +55,7 @@
55 55 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
56 56 mov pc, r0
57 57  
58   - __INIT
  58 + __CPUINIT
59 59  
60 60 .type __arm740_setup, #function
61 61 __arm740_setup:
arch/arm/mm/proc-arm7tdmi.S
... ... @@ -46,7 +46,7 @@
46 46 ENTRY(cpu_arm7tdmi_reset)
47 47 mov pc, r0
48 48  
49   - __INIT
  49 + __CPUINIT
50 50  
51 51 .type __arm7tdmi_setup, #function
52 52 __arm7tdmi_setup:
arch/arm/mm/proc-arm920.S
... ... @@ -375,7 +375,7 @@
375 375 #endif
376 376 mov pc, lr
377 377  
378   - __INIT
  378 + __CPUINIT
379 379  
380 380 .type __arm920_setup, #function
381 381 __arm920_setup:
arch/arm/mm/proc-arm922.S
... ... @@ -379,7 +379,7 @@
379 379 #endif /* CONFIG_MMU */
380 380 mov pc, lr
381 381  
382   - __INIT
  382 + __CPUINIT
383 383  
384 384 .type __arm922_setup, #function
385 385 __arm922_setup:
arch/arm/mm/proc-arm925.S
... ... @@ -428,7 +428,7 @@
428 428 #endif /* CONFIG_MMU */
429 429 mov pc, lr
430 430  
431   - __INIT
  431 + __CPUINIT
432 432  
433 433 .type __arm925_setup, #function
434 434 __arm925_setup:
arch/arm/mm/proc-arm926.S
... ... @@ -389,7 +389,7 @@
389 389 #endif
390 390 mov pc, lr
391 391  
392   - __INIT
  392 + __CPUINIT
393 393  
394 394 .type __arm926_setup, #function
395 395 __arm926_setup:
arch/arm/mm/proc-arm940.S
... ... @@ -264,7 +264,7 @@
264 264 .long arm940_dma_unmap_area
265 265 .long arm940_dma_flush_range
266 266  
267   - __INIT
  267 + __CPUINIT
268 268  
269 269 .type __arm940_setup, #function
270 270 __arm940_setup:
arch/arm/mm/proc-arm946.S
... ... @@ -317,7 +317,7 @@
317 317 mcr p15, 0, r0, c7, c10, 4 @ drain WB
318 318 mov pc, lr
319 319  
320   - __INIT
  320 + __CPUINIT
321 321  
322 322 .type __arm946_setup, #function
323 323 __arm946_setup:
arch/arm/mm/proc-arm9tdmi.S
... ... @@ -46,7 +46,7 @@
46 46 ENTRY(cpu_arm9tdmi_reset)
47 47 mov pc, r0
48 48  
49   - __INIT
  49 + __CPUINIT
50 50  
51 51 .type __arm9tdmi_setup, #function
52 52 __arm9tdmi_setup:
arch/arm/mm/proc-fa526.S
... ... @@ -134,7 +134,7 @@
134 134 #endif
135 135 mov pc, lr
136 136  
137   - __INIT
  137 + __CPUINIT
138 138  
139 139 .type __fa526_setup, #function
140 140 __fa526_setup:
arch/arm/mm/proc-feroceon.S
... ... @@ -494,7 +494,7 @@
494 494 #endif
495 495 mov pc, lr
496 496  
497   - __INIT
  497 + __CPUINIT
498 498  
499 499 .type __feroceon_setup, #function
500 500 __feroceon_setup:
arch/arm/mm/proc-mohawk.S
... ... @@ -338,7 +338,7 @@
338 338 mcr p15, 0, r0, c7, c10, 4 @ drain WB
339 339 mov pc, lr
340 340  
341   - __INIT
  341 + __CPUINIT
342 342  
343 343 .type __mohawk_setup, #function
344 344 __mohawk_setup:
arch/arm/mm/proc-sa110.S
... ... @@ -156,7 +156,7 @@
156 156 #endif
157 157 mov pc, lr
158 158  
159   - __INIT
  159 + __CPUINIT
160 160  
161 161 .type __sa110_setup, #function
162 162 __sa110_setup:
arch/arm/mm/proc-sa1100.S
... ... @@ -169,7 +169,7 @@
169 169 #endif
170 170 mov pc, lr
171 171  
172   - __INIT
  172 + __CPUINIT
173 173  
174 174 .type __sa1100_setup, #function
175 175 __sa1100_setup:
arch/arm/mm/proc-v6.S
... ... @@ -137,7 +137,7 @@
137 137  
138 138 .align
139 139  
140   - __INIT
  140 + __CPUINIT
141 141  
142 142 /*
143 143 * __v6_setup
... ... @@ -192,6 +192,8 @@
192 192 v6_crval:
193 193 crval clear=0x01e0fb7f, mmuset=0x00c0387d, ucset=0x00c0187c
194 194  
  195 + __INITDATA
  196 +
195 197 .type v6_processor_functions, #object
196 198 ENTRY(v6_processor_functions)
197 199 .word v6_early_abort
... ... @@ -204,6 +206,8 @@
204 206 .word cpu_v6_switch_mm
205 207 .word cpu_v6_set_pte_ext
206 208 .size v6_processor_functions, . - v6_processor_functions
  209 +
  210 + .section ".rodata"
207 211  
208 212 .type cpu_arch_name, #object
209 213 cpu_arch_name:
arch/arm/mm/proc-v7.S
... ... @@ -169,7 +169,7 @@
169 169 .ascii "ARMv7 Processor"
170 170 .align
171 171  
172   - __INIT
  172 + __CPUINIT
173 173  
174 174 /*
175 175 * __v7_setup
... ... @@ -297,6 +297,8 @@
297 297 __v7_setup_stack:
298 298 .space 4 * 11 @ 11 registers
299 299  
  300 + __INITDATA
  301 +
300 302 .type v7_processor_functions, #object
301 303 ENTRY(v7_processor_functions)
302 304 .word v7_early_abort
... ... @@ -309,6 +311,8 @@
309 311 .word cpu_v7_switch_mm
310 312 .word cpu_v7_set_pte_ext
311 313 .size v7_processor_functions, . - v7_processor_functions
  314 +
  315 + .section ".rodata"
312 316  
313 317 .type cpu_arch_name, #object
314 318 cpu_arch_name:
arch/arm/mm/proc-xsc3.S
... ... @@ -404,7 +404,7 @@
404 404  
405 405 .align
406 406  
407   - __INIT
  407 + __CPUINIT
408 408  
409 409 .type __xsc3_setup, #function
410 410 __xsc3_setup:
arch/arm/mm/proc-xscale.S
... ... @@ -506,7 +506,7 @@
506 506  
507 507 .align
508 508  
509   - __INIT
  509 + __CPUINIT
510 510  
511 511 .type __xscale_setup, #function
512 512 __xscale_setup: