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 <vgupta@synopsys.com>

+11 -9
+7 -7
arch/arc/kernel/head.S
··· 71 GET_CPU_ID r5 72 cmp r5, 0 73 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 78 ; 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 82 #endif 83 84 ; Clear BSS before updating any globals
··· 71 GET_CPU_ID r5 72 cmp r5, 0 73 mov.nz r0, r5 74 + bz .Lmaster_proceed 75 + 76 ; Non-Masters wait for Master to boot enough and bring them up 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: 82 #endif 83 84 ; Clear BSS before updating any globals
+4 -2
arch/arc/kernel/smp.c
··· 98 99 void arc_platform_smp_wait_to_boot(int cpu) 100 { 101 while (wake_flag != cpu) 102 ; 103 104 wake_flag = 0; 105 - __asm__ __volatile__("j @first_lines_of_secondary \n"); 106 } 107 - 108 109 const char *arc_platform_smp_cpuinfo(void) 110 {
··· 98 99 void arc_platform_smp_wait_to_boot(int cpu) 100 { 101 + /* for halt-on-reset, we've waited already */ 102 + if (IS_ENABLED(CONFIG_ARC_SMP_HALT_ON_RESET)) 103 + return; 104 + 105 while (wake_flag != cpu) 106 ; 107 108 wake_flag = 0; 109 } 110 111 const char *arc_platform_smp_cpuinfo(void) 112 {