Skip to content

Commit bf02454

Browse files
committed
ARC: smp-boot: Decouple Non masters waiting API from jump to entry point
For run-on-reset SMP configs, non master cores call a routine which waits until Master gives it a "go" signal (currently using a shared mem flag). The same routine then jumps off the well known entry point of all non Master cores i.e. @first_lines_of_secondary This patch moves out the last part into one single place in early boot code. This is better in terms of absraction (the wait API only waits) and returns, leaving out the "jump off to" part. In actual implementation this requires some restructuring of the early boot code as well as Master now jumps to BSS setup explicitly, vs. falling thru into it before. Technically this patch doesn't cause any functional change, it just moves the ugly #ifdef'ry from assembly code to "C" Signed-off-by: Vineet Gupta <[email protected]>
1 parent 517e761 commit bf02454

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

arch/arc/kernel/head.S

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ ENTRY(stext)
7171
GET_CPU_ID r5
7272
cmp r5, 0
7373
mov.nz r0, r5
74-
#ifdef CONFIG_ARC_SMP_HALT_ON_RESET
75-
; Non-Master can proceed as system would be booted sufficiently
76-
jnz first_lines_of_secondary
77-
#else
74+
bz .Lmaster_proceed
75+
7876
; Non-Masters wait for Master to boot enough and bring them up
79-
jnz arc_platform_smp_wait_to_boot
80-
#endif
81-
; Master falls thru
77+
; when they resume, tail-call to entry point
78+
mov blink, @first_lines_of_secondary
79+
j arc_platform_smp_wait_to_boot
80+
81+
.Lmaster_proceed:
8282
#endif
8383

8484
; Clear BSS before updating any globals

arch/arc/kernel/smp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,16 @@ static void arc_default_smp_cpu_kick(int cpu, unsigned long pc)
9898

9999
void arc_platform_smp_wait_to_boot(int cpu)
100100
{
101+
/* for halt-on-reset, we've waited already */
102+
if (IS_ENABLED(CONFIG_ARC_SMP_HALT_ON_RESET))
103+
return;
104+
101105
while (wake_flag != cpu)
102106
;
103107

104108
wake_flag = 0;
105-
__asm__ __volatile__("j @first_lines_of_secondary \n");
106109
}
107110

108-
109111
const char *arc_platform_smp_cpuinfo(void)
110112
{
111113
return plat_smp_ops.info ? : "";

0 commit comments

Comments
 (0)