Skip to content

Commit

Permalink
RISC-V: Move the entire hart selection via lottery to SMP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Atish Patra authored and Palmer Dabbelt committed Jan 20, 2022
1 parent c78f94f commit 0b39eb3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions arch/riscv/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ pmp_done:
blt a0, t0, .Lgood_cores
tail .Lsecondary_park
.Lgood_cores:
#endif

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

#endif /* CONFIG_XIP */
#endif /* CONFIG_SMP */

#ifdef CONFIG_XIP_KERNEL
la sp, _end + THREAD_SIZE
XIP_FIXUP_OFFSET sp
mv s0, a0
Expand Down Expand Up @@ -340,8 +344,8 @@ clear_bss_done:
call soc_early_init
tail start_kernel

.Lsecondary_start:
#ifdef CONFIG_SMP
.Lsecondary_start:
/* Set trap vector to spin forever to help debug */
la a3, .Lsecondary_park
csrw CSR_TVEC, a3
Expand Down

0 comments on commit 0b39eb3

Please sign in to comment.