Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b47613da authored by Xiang Wang's avatar Xiang Wang Committed by Paul Walmsley
Browse files

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: default avatarXiang Wang <merle@hardenedlinux.org>
Reviewed-by: default avatarPalmer Dabbelt <palmer@sifive.com>
Reviewed-by: default avatarAnup Patel <anup.patel@wdc.com>
[paul.walmsley@sifive.com: updated to apply; cleaned up patch
 description]
Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
parent 1cec0ce2
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -63,6 +63,11 @@ _start_kernel:
	li t0, SR_FS
	csrc CSR_SSTATUS, t0

#ifdef CONFIG_SMP
	li t0, CONFIG_NR_CPUS
	bgeu a0, t0, .Lsecondary_park
#endif

	/* Pick one hart to run the main boot sequence */
	la a3, hart_lottery
	li a2, 1
@@ -154,9 +159,6 @@ relocate:

.Lsecondary_start:
#ifdef CONFIG_SMP
	li a1, CONFIG_NR_CPUS
	bgeu a0, a1, .Lsecondary_park

	/* Set trap vector to spin forever to help debug */
	la a3, .Lsecondary_park
	csrw CSR_STVEC, a3