wangchdo commented on code in PR #16892:
URL: https://github.com/apache/nuttx/pull/16892#discussion_r2296893090


##########
arch/arm/src/armv8-r/arm_doirq.c:
##########
@@ -113,14 +113,32 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
 
 void up_irqinitialize(void)
 {
-  /* The following operations need to be atomic, but since this function is
-   * called early in the initialization sequence, we expect to have exclusive
-   * access to the GIC.
-   */
+#ifdef CONFIG_SMP
+  static volatile uint32_t gicd_ready = 0;
+
+  if (up_cpu_index() == 0)
+    {
+#endif
+      /* Initialize GICD、GICRD and GIC cpu interface for cpu0  */
+
+      arm_gic_initialize();
+#ifdef CONFIG_SMP
+      gicd_ready = 1;
+    }
+  else
+    {
+      /* For other CPUs, we will only initialize GICRD and
+       * GIC cpu interface.
+       */
 
-  /* Initialize the Generic Interrupt Controller (GIC) for CPU0 */
+      while (gicd_ready == 0)

Review Comment:
   Some SoC may release all the cpus simultaneously after power on, while let 
the software to do the synchronization.  
   
   By the way, gic init was called by nuttx kernel in nx_start, which is also 
probably called by some cpus simultaneously while cpu0 is doing it, because 
cpu0 tend to do more stuff in initialization after releasing other cpus.



-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to