<div dir="ltr">Hi Sebastian,<div>I applied these three patches after my patches and ran them on my K210 board and simulator. I have a set of 12 tests including benchmarks, SMP01, SMP08, ticker, etc. Everything ran OK.</div><div>Is there anything in particular I can try to test them like setting the maximum CPUs to 1? (K210 is a dual core)</div><div>Alan</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 16, 2023 at 4:59 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In SMP configurations, check that we run on a configured processor. If not,<br>
then there is not much what can be done since we do not have a stack available<br>
for this processor. Just loop forever in this case. Do this in assemlby to<br>
ensure that no stack memory is used.<br>
---<br>
bsps/riscv/riscv/start/bspsmp.c | 5 +----<br>
bsps/riscv/shared/start/start.S | 16 ++++++++++++++--<br>
2 files changed, 15 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/bsps/riscv/riscv/start/bspsmp.c b/bsps/riscv/riscv/start/bspsmp.c<br>
index 91f4f7b96a..ce5792f5b8 100644<br>
--- a/bsps/riscv/riscv/start/bspsmp.c<br>
+++ b/bsps/riscv/riscv/start/bspsmp.c<br>
@@ -36,10 +36,7 @@ void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)<br>
<br>
cpu_index_self = _Per_CPU_Get_index(cpu_self);<br>
<br>
- if (<br>
- cpu_index_self < rtems_configuration_get_maximum_processors()<br>
- && _SMP_Should_start_processor(cpu_index_self)<br>
- ) {<br>
+ if (_SMP_Should_start_processor(cpu_index_self)) {<br>
set_csr(mie, MIP_MSIP | MIP_MEIP);<br>
_SMP_Start_multitasking_on_secondary_processor(cpu_self);<br>
} else {<br>
diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S<br>
index 34e1839ca1..42e4348cd0 100644<br>
--- a/bsps/riscv/shared/start/start.S<br>
+++ b/bsps/riscv/shared/start/start.S<br>
@@ -66,8 +66,17 @@ SYM(_start):<br>
LADDR sp, _ISR_Stack_area_begin<br>
LADDR t2, _ISR_Stack_size<br>
csrr s0, mhartid<br>
- li t3, RISCV_BOOT_HARTID<br>
- sub s0, s0, t3<br>
+ li t3, RISCV_BOOT_HARTID<br>
+ sub s0, s0, t3<br>
+<br>
+ /*<br>
+ * Check that this is a configured processor. If not, then there is<br>
+ * not much what can be done since we do not have a stack available for<br>
+ * this processor. Just loop forever in this case.<br>
+ */<br>
+ LREG t3, _SMP_Processor_configured_maximum<br>
+ bgeu s0, t3, .Lwfi<br>
+<br>
LADDR t0, _Per_CPU_Information<br>
slli t1, s0, PER_CPU_CONTROL_SIZE_LOG2<br>
add s1, t0, t1<br>
@@ -100,6 +109,9 @@ SYM(_start):<br>
tail boot_card<br>
<br>
#ifdef RTEMS_SMP<br>
+.Lwfi:<br>
+ wfi<br>
+ j .Lwfi<br>
<br>
.Lstart_on_secondary_processor:<br>
<br>
-- <br>
2.35.3<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>