Skip to content

Commit 0b39eb3

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Move the entire hart selection via lottery to SMP
The booting hart selection via lottery is only useful for SMP systems. Moreover, the lottery selection is only necessary for systems using spinwait booting method. It is better to keep the entire lottery selection together so that it can be disabled in future. Move the lottery selection code to under CONFIG_SMP. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent c78f94f commit 0b39eb3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/riscv/kernel/head.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ pmp_done:
264264
blt a0, t0, .Lgood_cores
265265
tail .Lsecondary_park
266266
.Lgood_cores:
267-
#endif
268267

268+
/* The lottery system is only required for spinwait booting method */
269269
#ifndef CONFIG_XIP_KERNEL
270270
/* Pick one hart to run the main boot sequence */
271271
la a3, hart_lottery
@@ -284,6 +284,10 @@ pmp_done:
284284
/* first time here if hart_lottery in RAM is not set */
285285
beq t0, t1, .Lsecondary_start
286286

287+
#endif /* CONFIG_XIP */
288+
#endif /* CONFIG_SMP */
289+
290+
#ifdef CONFIG_XIP_KERNEL
287291
la sp, _end + THREAD_SIZE
288292
XIP_FIXUP_OFFSET sp
289293
mv s0, a0
@@ -340,8 +344,8 @@ clear_bss_done:
340344
call soc_early_init
341345
tail start_kernel
342346

343-
.Lsecondary_start:
344347
#ifdef CONFIG_SMP
348+
.Lsecondary_start:
345349
/* Set trap vector to spin forever to help debug */
346350
la a3, .Lsecondary_park
347351
csrw CSR_TVEC, a3

0 commit comments

Comments
 (0)