This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new bac838b888 armv7a: Amp mode support
bac838b888 is described below

commit bac838b8889a43263d12655b96fa5f08eaaaf4d6
Author: hujun5 <[email protected]>
AuthorDate: Fri Jan 3 20:58:36 2025 +0800

    armv7a: Amp mode support
    
    reason:
    In AMP mode, we can also use SGI as an inter-core interrupt,
    and ensure that arm_gic0_initialize is called only once.
    
    Signed-off-by: hujun5 <[email protected]>
---
 arch/arm/src/armv7-a/arm_gicv2.c |  5 -----
 arch/arm/src/qemu/qemu_irq.c     | 10 ++++++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arm/src/armv7-a/arm_gicv2.c b/arch/arm/src/armv7-a/arm_gicv2.c
index 6b38e160be..1020c01e77 100644
--- a/arch/arm/src/armv7-a/arm_gicv2.c
+++ b/arch/arm/src/armv7-a/arm_gicv2.c
@@ -724,13 +724,8 @@ void arm_cpu_sgi(int sgi, unsigned int cpuset)
 
   arm_gic_wait_done(cpuset);
 
-#ifdef CONFIG_SMP
   regval = GIC_ICDSGIR_INTID(sgi) | GIC_ICDSGIR_CPUTARGET(cpuset) |
            GIC_ICDSGIR_TGTFILTER_LIST;
-#else
-  regval = GIC_ICDSGIR_INTID(sgi) | GIC_ICDSGIR_CPUTARGET(0) |
-           GIC_ICDSGIR_TGTFILTER_THIS;
-#endif
 
 #if defined(CONFIG_ARCH_TRUSTZONE_SECURE)
   if (sgi >= GIC_IRQ_SGI0 && sgi <= GIC_IRQ_SGI7)
diff --git a/arch/arm/src/qemu/qemu_irq.c b/arch/arm/src/qemu/qemu_irq.c
index 398cdc1f1c..06530b3d50 100644
--- a/arch/arm/src/qemu/qemu_irq.c
+++ b/arch/arm/src/qemu/qemu_irq.c
@@ -116,9 +116,15 @@ void up_irqinitialize(void)
    * access to the GIC.
    */
 
-  /* Initialize the Generic Interrupt Controller (GIC) for CPU0 */
+  /* Initialize the Generic Interrupt Controller (GIC) for CPU0.
+   * In AMP mode, we want arm_gic0_initialize to be called only once.
+   */
+
+  if (sched_getcpu() == 0)
+    {
+      arm_gic0_initialize();  /* Initialization unique to CPU0 */
+    }
 
-  arm_gic0_initialize();  /* Initialization unique to CPU0 */
   arm_gic_initialize();   /* Initialization common to all CPUs */
 
 #ifndef CONFIG_SUPPRESS_INTERRUPTS

Reply via email to