Skip to content

Commit 5085f3f

Browse files
author
Russell King
committed
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>
1 parent 37b05b6 commit 5085f3f

26 files changed

Lines changed: 94 additions & 67 deletions

‎arch/arm/kernel/head-common.S‎

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -145,54 +145,21 @@ ENDPROC(__error)
145145

146146

147147
/*
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)
159-
*/
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.
148+
* This provides a C-API version of __lookup_processor_type
180149
*/
181150
ENTRY(lookup_processor_type)
182-
stmfd sp!, {r4 - r7, r9, lr}
151+
stmfd sp!, {r4 - r6, r9, lr}
183152
mov r9, r0
184153
bl __lookup_processor_type
185154
mov r0, r5
186-
ldmfd sp!, {r4 - r7, r9, pc}
155+
ldmfd sp!, {r4 - r6, r9, pc}
187156
ENDPROC(lookup_processor_type)
188157

189158
/*
190159
* Look in <asm/procinfo.h> and arch/arm/kernel/arch.[ch] for
191160
* more information about the __proc_info and __arch_info structures.
192161
*/
193162
.align 2
194-
3: .long __proc_info_begin
195-
.long __proc_info_end
196163
4: .long .
197164
.long __arch_info_begin
198165
.long __arch_info_end
@@ -265,3 +232,45 @@ __vet_atags:
265232
1: mov r2, #0
266233
mov pc, lr
267234
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‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
#include <asm/memory.h>
99
#include <asm/page.h>
1010

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+
1124
OUTPUT_ARCH(arm)
1225
ENTRY(stext)
1326

@@ -31,9 +44,7 @@ SECTIONS
3144
HEAD_TEXT
3245
INIT_TEXT
3346
_einittext = .;
34-
__proc_info_begin = .;
35-
*(.proc.info.init)
36-
__proc_info_end = .;
47+
ARM_CPU_DISCARD(PROC_INFO)
3748
__arch_info_begin = .;
3849
*(.arch.info.init)
3950
__arch_info_end = .;
@@ -68,10 +79,8 @@ SECTIONS
6879
/DISCARD/ : {
6980
*(.ARM.exidx.exit.text)
7081
*(.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))
7584
#ifndef CONFIG_HOTPLUG
7685
*(.ARM.exidx.devexit.text)
7786
*(.ARM.extab.devexit.text)
@@ -100,6 +109,7 @@ SECTIONS
100109
*(.glue_7)
101110
*(.glue_7t)
102111
*(.got) /* Global offset table */
112+
ARM_CPU_KEEP(PROC_INFO)
103113
}
104114

105115
RO_DATA(PAGE_SIZE)

‎arch/arm/mm/proc-arm1020.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ ENTRY(cpu_arm1020_set_pte_ext)
430430
#endif /* CONFIG_MMU */
431431
mov pc, lr
432432

433-
__INIT
433+
__CPUINIT
434434

435435
.type __arm1020_setup, #function
436436
__arm1020_setup:

‎arch/arm/mm/proc-arm1020e.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ ENTRY(cpu_arm1020e_set_pte_ext)
412412
#endif /* CONFIG_MMU */
413413
mov pc, lr
414414

415-
__INIT
415+
__CPUINIT
416416

417417
.type __arm1020e_setup, #function
418418
__arm1020e_setup:

‎arch/arm/mm/proc-arm1022.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ ENTRY(cpu_arm1022_set_pte_ext)
394394
#endif /* CONFIG_MMU */
395395
mov pc, lr
396396

397-
__INIT
397+
__CPUINIT
398398

399399
.type __arm1022_setup, #function
400400
__arm1022_setup:

‎arch/arm/mm/proc-arm1026.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ ENTRY(cpu_arm1026_set_pte_ext)
384384
mov pc, lr
385385

386386

387-
__INIT
387+
__CPUINIT
388388

389389
.type __arm1026_setup, #function
390390
__arm1026_setup:

‎arch/arm/mm/proc-arm6_7.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ ENTRY(cpu_arm7_reset)
238238
mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc
239239
mov pc, r0
240240

241-
__INIT
241+
__CPUINIT
242242

243243
.type __arm6_setup, #function
244244
__arm6_setup: mov r0, #0

‎arch/arm/mm/proc-arm720.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ ENTRY(cpu_arm720_reset)
113113
mcr p15, 0, ip, c1, c0, 0 @ ctrl register
114114
mov pc, r0
115115

116-
__INIT
116+
__CPUINIT
117117

118118
.type __arm710_setup, #function
119119
__arm710_setup:

‎arch/arm/mm/proc-arm740.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ENTRY(cpu_arm740_reset)
5555
mcr p15, 0, ip, c1, c0, 0 @ ctrl register
5656
mov pc, r0
5757

58-
__INIT
58+
__CPUINIT
5959

6060
.type __arm740_setup, #function
6161
__arm740_setup:

‎arch/arm/mm/proc-arm7tdmi.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ENTRY(cpu_arm7tdmi_proc_fin)
4646
ENTRY(cpu_arm7tdmi_reset)
4747
mov pc, r0
4848

49-
__INIT
49+
__CPUINIT
5050

5151
.type __arm7tdmi_setup, #function
5252
__arm7tdmi_setup:

0 commit comments

Comments
 (0)