You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/10 17:31:21 UTC
(nuttx) 23/28: sim: fix sim smp boot regression
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b1932c668d948370106fedd725a9b14e25775816
Author: hujun5 <hu...@xiaomi.com>
AuthorDate: Tue Oct 8 21:01:08 2024 +0800
sim: fix sim smp boot regression
This commit fixes the regression from https://github.com/apache/nuttx/pull/13716
Signed-off-by: hujun5 <hu...@xiaomi.com>
---
arch/sim/src/sim/posix/sim_hostsmp.c | 2 ++
arch/sim/src/sim/sim_doirq.c | 10 ++++++++++
arch/sim/src/sim/sim_internal.h | 1 +
include/nuttx/irq.h | 5 +----
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/sim/src/sim/posix/sim_hostsmp.c b/arch/sim/src/sim/posix/sim_hostsmp.c
index f338c5b38a..beed1dd332 100644
--- a/arch/sim/src/sim/posix/sim_hostsmp.c
+++ b/arch/sim/src/sim/posix/sim_hostsmp.c
@@ -106,6 +106,8 @@ static void *sim_idle_trampoline(void *arg)
host_cpu_started();
+ sim_unlock();
+
/* The idle Loop */
for (; ; )
diff --git a/arch/sim/src/sim/sim_doirq.c b/arch/sim/src/sim/sim_doirq.c
index 62fba5aaea..5adcf15cdf 100644
--- a/arch/sim/src/sim/sim_doirq.c
+++ b/arch/sim/src/sim/sim_doirq.c
@@ -27,6 +27,7 @@
#include <stdbool.h>
#include <nuttx/arch.h>
#include <sched/sched.h>
+#include <nuttx/init.h>
#include "sim_internal.h"
@@ -34,6 +35,15 @@
* Public Functions
****************************************************************************/
+void sim_unlock(void)
+{
+ /* wait until cpu0 in idle() */
+
+ while (!OSINIT_IDLELOOP());
+
+ sched_unlock();
+}
+
/****************************************************************************
* Name: sim_doirq
****************************************************************************/
diff --git a/arch/sim/src/sim/sim_internal.h b/arch/sim/src/sim/sim_internal.h
index 5660d9d129..1c35be0d96 100644
--- a/arch/sim/src/sim/sim_internal.h
+++ b/arch/sim/src/sim/sim_internal.h
@@ -206,6 +206,7 @@ extern char **g_argv;
void sim_copyfullstate(xcpt_reg_t *dest, xcpt_reg_t *src);
void *sim_doirq(int irq, void *regs);
+void sim_unlock(void);
/* sim_hostmisc.c ***********************************************************/
diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h
index 3d0373f030..6ee2dd8ed0 100644
--- a/include/nuttx/irq.h
+++ b/include/nuttx/irq.h
@@ -78,10 +78,7 @@
do \
{ \
g_cpu_irqset = 0; \
- SP_DMB(); \
- g_cpu_irqlock = SP_UNLOCKED; \
- SP_DSB(); \
- SP_SEV(); \
+ spin_unlock_wo_note(&g_cpu_irqlock); \
} \
while (0)
#endif