[PATCH 14/17] score: Delete bsp_smp_broadcast_interrupt()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 17 15:51:39 UTC 2014


Since the per-CPU SMP lock must be acquired and released to send the
message a single interrupt broadcast operations offers no benefits.  If
synchronization is required, then a SMP barrier must be used anyway.
---
 c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c |   12 ------------
 c/src/lib/libbsp/i386/shared/smp/smp-imps.c    |    6 ------
 c/src/lib/libbsp/powerpc/qoriq/startup/smp.c   |    6 ------
 c/src/lib/libbsp/shared/smp/smp_stub.c         |   16 +---------------
 c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c   |   16 ----------------
 cpukit/score/include/rtems/bspsmp.h            |   14 --------------
 cpukit/score/src/smp.c                         |   12 ++++--------
 7 files changed, 5 insertions(+), 77 deletions(-)

diff --git a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c
index 9f465aa..bf776c5 100644
--- a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c
+++ b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c
@@ -44,18 +44,6 @@ uint32_t _CPU_SMP_Initialize(uint32_t configured_cpu_count)
   return used_cpu_count;
 }
 
-void bsp_smp_broadcast_interrupt(void)
-{
-  /*
-   * FIXME: This broadcasts the interrupt also to processors not used by RTEMS.
-   */
-  rtems_status_code sc = arm_gic_irq_generate_software_irq(
-    ARM_GIC_IRQ_SGI_0,
-    ARM_GIC_IRQ_SOFTWARE_IRQ_TO_ALL_EXCEPT_SELF,
-    0xff
-  );
-}
-
 void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
 {
   rtems_status_code sc = arm_gic_irq_generate_software_irq(
diff --git a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
index a2dbc32..6170beb 100644
--- a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
+++ b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
@@ -803,9 +803,3 @@ void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
 {
   send_ipi( target_processor_index, 0x30 );
 }
-
-void bsp_smp_broadcast_interrupt(void)
-{
-  /* Single broadcast interrupt */
-  send_ipi( 0, LAPIC_ICR_DS_ALLEX | 0x30 );
-}
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c b/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
index ea9d1cb..d124303 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
@@ -163,12 +163,6 @@ uint32_t _CPU_SMP_Initialize(uint32_t configured_cpu_count)
   return cores;
 }
 
-void bsp_smp_broadcast_interrupt(void)
-{
-  uint32_t self = ppc_processor_id();
-  qoriq.pic.per_cpu [self].ipidr [IPI_INDEX].reg = ALL_CORES;
-}
-
 void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
 {
   uint32_t self = ppc_processor_id();
diff --git a/c/src/lib/libbsp/shared/smp/smp_stub.c b/c/src/lib/libbsp/shared/smp/smp_stub.c
index b4a9cc3..037a45c 100644
--- a/c/src/lib/libbsp/shared/smp/smp_stub.c
+++ b/c/src/lib/libbsp/shared/smp/smp_stub.c
@@ -9,11 +9,7 @@
  *  http://www.rtems.com/license/LICENSE.
  */
 
-#include <rtems.h>
-#include <bsp.h>
-#include <rtems/bspIo.h>
-#include <rtems/bspsmp.h>
-#include <stdlib.h>
+#include <rtems/score/cpu.h>
 
 uint32_t _CPU_SMP_Initialize( uint32_t configured_cpu_count )
 {
@@ -21,16 +17,6 @@ uint32_t _CPU_SMP_Initialize( uint32_t configured_cpu_count )
   return 1;
 }
 
-void bsp_smp_broadcast_interrupt(void)
-{
-}
-
-void bsp_smp_broadcast_message(
-  uint32_t  message
-)
-{
-}
-
 void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
 {
 }
diff --git a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
index baf4cfd..dccca81 100644
--- a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
+++ b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
@@ -93,19 +93,3 @@ void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
   /* send interrupt to destination CPU */
   LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
 }
-
-void bsp_smp_broadcast_interrupt(void)
-{
-  uint32_t dest_cpu;
-  uint32_t cpu;
-  uint32_t max_cpus;
-
-  cpu = rtems_smp_get_current_processor();
-  max_cpus = rtems_smp_get_processor_count();
-
-  for ( dest_cpu=0 ; dest_cpu < max_cpus ; dest_cpu++ ) {
-    if ( cpu != dest_cpu ) {
-      _CPU_SMP_Send_interrupt( dest_cpu );
-    }
-  }
-}
diff --git a/cpukit/score/include/rtems/bspsmp.h b/cpukit/score/include/rtems/bspsmp.h
index 9cdb6dc..c7502ec 100644
--- a/cpukit/score/include/rtems/bspsmp.h
+++ b/cpukit/score/include/rtems/bspsmp.h
@@ -52,20 +52,6 @@ extern "C" {
 #ifndef ASM
 
 /**
- *  @brief Generate an interprocessor broadcast interrupt.
- *
- *  This method is invoked when RTEMS wants to let all of the other
- *  CPUs know that it has sent them message.  CPUs not including
- *  the originating CPU should receive the interrupt.
-
- *
- *  @note On CPUs without the capability to generate a broadcast
- *        to all other CPUs interrupt, this can be implemented by
- *        a loop of sending interrupts to specific CPUs.
- */
-void bsp_smp_broadcast_interrupt(void);
-
-/**
  * @brief Performs high-level initialization of a secondary processor and runs
  * the application threads.
  *
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 612c6e9..f3aa25f 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -19,6 +19,7 @@
 #endif
 
 #include <rtems/bspsmp.h>
+#include <rtems/score/assert.h>
 #include <rtems/score/threaddispatch.h>
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/smp.h>
@@ -102,18 +103,13 @@ void _SMP_Broadcast_message( uint32_t message )
   uint32_t ncpus = _SMP_Get_processor_count();
   uint32_t cpu;
 
+  _Assert_Thread_dispatching_repressed();
+
   for ( cpu = 0 ; cpu < ncpus ; ++cpu ) {
     if ( cpu != self ) {
-      Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu );
-      ISR_Level level;
-
-      _Per_CPU_ISR_disable_and_acquire( per_cpu, level );
-      per_cpu->message |= message;
-      _Per_CPU_Release_and_ISR_enable( per_cpu, level );
+      _SMP_Send_message( cpu, message );
     }
   }
-
-  bsp_smp_broadcast_interrupt();
 }
 
 void _SMP_Request_other_cores_to_perform_first_context_switch( void )
-- 
1.7.7




More information about the devel mailing list