[PATCH] arch/riscv: disable too many harts before pick main boot h=

From: Xiang Wang
Date: Thu Sep 05 2019 - 23:56:09 EST


These harts with id greater than or equal to CONFIG_NR_CPUS need to be disa=
bled.
But pick the main Hart can choose any one. So, before pick the main hart, y=
ou
need to disable the hart with id greater than or equal to CONFIG_NR_CPUS.

Signed-off-by: Xiang Wang <merle@xxxxxxxxxxxxxxxxx>
---
arch/riscv/kernel/head.S | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 0f1ba17e476f..cfffea38eb17 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -63,6 +63,11 @@ _start_kernel:
=09li t0, SR_FS
=09csrc sstatus, t0

+#ifdef CONFIG_SMP
+=09li t0, CONFIG_NR_CPUS
+=09bgeu a0, t0, .Lsecondary_park
+#endif
+
=09/* Pick one hart to run the main boot sequence */
=09la a3, hart_lottery
=09li a2, 1
@@ -154,9 +159,6 @@ relocate:

.Lsecondary_start:
#ifdef CONFIG_SMP
-=09li a1, CONFIG_NR_CPUS
-=09bgeu a0, a1, .Lsecondary_park
-
=09/* Set trap vector to spin forever to help debug */
=09la a3, .Lsecondary_park
=09csrw CSR_STVEC, a3
--
2.20.1