xiaoxiang781216 commented on code in PR #7247:
URL: https://github.com/apache/incubator-nuttx/pull/7247#discussion_r988710107


##########
arch/risc-v/src/qemu-rv/qemu_rv_start.c:
##########
@@ -144,9 +148,25 @@ void qemu_rv_start(int mhartid)
 
 #ifdef CONFIG_BUILD_KERNEL
 
+static bool g_bss_cleared = false;
+
 void qemu_rv_start_s(int mhartid)
 {
-  qemu_rv_clear_bss();
+  if (0 == mhartid)
+    {
+      qemu_rv_clear_bss();
+      g_bss_cleared = true;
+      __DMB();
+    }
+#ifdef CONFIG_SMP
+  else
+    {
+      while (!g_bss_cleared)

Review Comment:
   Here is my summary:
   
   1. It's enough to check hartid equals zero to avoid the double initialization
   2. To avoid the secondary cores run before the primary core finish the basic 
initialization, we need either wait a special SGI sent from primary code or a 
variable which is clear by hardware(NOT software) when power on but set by 
primary code.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to