[PATCH] bsp/riscv: block unused cores in OS non-smp configurations

lucian-raul.silistru at intel.com lucian-raul.silistru at intel.com
Tue Oct 18 13:33:29 UTC 2022


From: Lucian-Raul Silistru <lucian-raul.silistru at intel.com>

When running on a multicore device with SMP disabled it is possible
for unused harts to still be pulled out of reset. This change parks
them in a wfi loop.

Updates #4735
---
 bsps/riscv/shared/start/start.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S
index a8ff1b079f..da5cd2be67 100644
--- a/bsps/riscv/shared/start/start.S
+++ b/bsps/riscv/shared/start/start.S
@@ -71,6 +71,8 @@ SYM(_start):
 	bnez	s0, .Lstart_on_secondary_processor
 	add	sp, sp, t2
 #else
+	csrr	s0, mhartid
+	bnez	s0, .Lblock_on_unused_processor
 	LADDR	sp, _ISR_Stack_area_end
 #endif
 
@@ -144,4 +146,8 @@ SYM(_start):
 	.word	0x00100073
 #endif
 
+#else /* RTEMS_SMP */
+.Lblock_on_unused_processor:
+	wfi
+	bnez	s0, .Lblock_on_unused_processor
 #endif /* RTEMS_SMP */
-- 
2.25.1



More information about the devel mailing list