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

commit 48ca996ad73ff8fd0d8da454b4f82247d58e0213
Author: zhangyuan21 <[email protected]>
AuthorDate: Tue Sep 26 10:15:57 2023 +0800

    arch: arm64 support smp function call
    
    Add up_send_smp_call function to support smp function call.
    
    Signed-off-by: zhangyuan21 <[email protected]>
---
 arch/arm64/src/common/arm64_gicv3.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/src/common/arm64_gicv3.c 
b/arch/arm64/src/common/arm64_gicv3.c
index 81011ebb32..f040b37aee 100644
--- a/arch/arm64/src/common/arm64_gicv3.c
+++ b/arch/arm64/src/common/arm64_gicv3.c
@@ -64,11 +64,13 @@
 
 /* Config SGI8 ~ SGI15 as group0, to signal fiq */
 
-#define IGROUPR_SGI_VAL  0xFFFF00FFU
+#  define IGROUPR_SGI_VAL 0xFFFF00FFU
 #else
-#define IGROUPR_SGI_VAL  0xFFFFFFFFU
+#  define IGROUPR_SGI_VAL 0xFFFFFFFFU
 #endif
 
+#define SMP_FUNC_CALL_IPI GIC_IRQ_SGI3
+
 /***************************************************************************
  * Private Data
  ***************************************************************************/
@@ -631,6 +633,10 @@ static void gicv3_dist_init(void)
   /* Attach SGI interrupt handlers. This attaches the handler to all CPUs. */
 
   DEBUGVERIFY(irq_attach(GIC_IRQ_SGI2, arm64_pause_handler, NULL));
+#  ifdef CONFIG_SMP_CALL
+  DEBUGVERIFY(irq_attach(SMP_FUNC_CALL_IPI,
+                         nxsched_smp_call_handler, NULL));
+#  endif
 #endif
 }
 
@@ -905,6 +911,9 @@ static void arm64_gic_init(void)
 
 #ifdef CONFIG_SMP
   up_enable_irq(GIC_IRQ_SGI2);
+#  ifdef CONFIG_SMP_CALL
+  up_enable_irq(SMP_FUNC_CALL_IPI);
+#  endif
 #endif
 }
 
@@ -931,5 +940,11 @@ void arm64_gic_secondary_init(void)
 {
   arm64_gic_init();
 }
+#endif
 
+#ifdef CONFIG_SMP_CALL
+void up_send_smp_call(cpu_set_t cpuset)
+{
+  up_trigger_irq(SMP_FUNC_CALL_IPI, cpuset);
+}
 #endif

Reply via email to