Skip to content

Commit b47613d

Browse files
wxjstzpaul-walmsley-sifive
authored andcommitted
arch/riscv: disable excess harts before picking main boot hart
Harts with id greater than or equal to CONFIG_NR_CPUS need to be disabled. But the kernel can pick any hart as the main hart. So, before picking the main hart, the kernel must disable harts with ids greater than or equal to CONFIG_NR_CPUS. Signed-off-by: Xiang Wang <merle@hardenedlinux.org> Reviewed-by: Palmer Dabbelt <palmer@sifive.com> Reviewed-by: Anup Patel <anup.patel@wdc.com> [paul.walmsley@sifive.com: updated to apply; cleaned up patch description] Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
1 parent 1cec0ce commit b47613d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎arch/riscv/kernel/head.S‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ _start_kernel:
6363
li t0, SR_FS
6464
csrc CSR_SSTATUS, t0
6565

66+
#ifdef CONFIG_SMP
67+
li t0, CONFIG_NR_CPUS
68+
bgeu a0, t0, .Lsecondary_park
69+
#endif
70+
6671
/* Pick one hart to run the main boot sequence */
6772
la a3, hart_lottery
6873
li a2, 1
@@ -154,9 +159,6 @@ relocate:
154159

155160
.Lsecondary_start:
156161
#ifdef CONFIG_SMP
157-
li a1, CONFIG_NR_CPUS
158-
bgeu a0, a1, .Lsecondary_park
159-
160162
/* Set trap vector to spin forever to help debug */
161163
la a3, .Lsecondary_park
162164
csrw CSR_STVEC, a3

0 commit comments

Comments
 (0)