smp: Simplify SMP initialization sequence

Delete bsp_smp_wait_for().  Other parts of the system work without
timeout, e.g. the spinlocks.  Using a timeout here does not make the
system more robust.

Delete bsp_smp_cpu_state and replace it with Per_CPU_State.  The
Per_CPU_State follows the Score naming conventions.  Add
_Per_CPU_Change_state() and _Per_CPU_Wait_for_state() functions to
change and observe states.

Use Per_CPU_State in Per_CPU_Control instead of the anonymous integer.

Add _CPU_Processor_event_broadcast() and _CPU_Processor_event_receive()
functions provided by the CPU port.  Use these functions in
_Per_CPU_Change_state() and _Per_CPU_Wait_for_state().

Add prototype for _SMP_Send_message().

Delete RTEMS_BSP_SMP_FIRST_TASK message.  The first context switch is
now performed in rtems_smp_secondary_cpu_initialize().  Issuing the
first context switch in the context of the inter-processor interrupt is
not possible on systems with a modern interrupt controller.  Such an
interrupt controler usually requires a handshake protocol with interrupt
acknowledge and end of interrupt signals.  A direct context switch in an
interrupt handler circumvents the interrupt processing epilogue and may
leave the system in an inconsistent state.

Release lock in rtems_smp_process_interrupt() even if no message was
delivered.  This prevents deadlock of the system.

Simplify and format _SMP_Send_message(),
_SMP_Request_other_cores_to_perform_first_context_switch(),
_SMP_Request_other_cores_to_dispatch() and
_SMP_Request_other_cores_to_shutdown().
This commit is contained in:
Sebastian Huber
2013-05-28 10:58:19 +02:00
parent 8cacceb7b9
commit 2f6108f93b
13 changed files with 264 additions and 297 deletions

View File

@@ -33,7 +33,7 @@ static inline unsigned int sparc_leon3_get_cctrl( void )
return v;
}
rtems_isr bsp_ap_ipi_isr(
static rtems_isr bsp_ap_ipi_isr(
rtems_vector_number vector
)
{
@@ -99,10 +99,11 @@ uint32_t bsp_smp_initialize( uint32_t configured_cpu_count )
bsp_smp_delay( 1000000 );
#if defined(RTEMS_DEBUG)
printk(
"CPU %d is %s\n",
cpu,
((_Per_CPU_Information[cpu].state == RTEMS_BSP_SMP_CPU_INITIALIZED) ?
"online" : "offline")
"CPU %d is %s\n",
cpu,
_Per_CPU_Information[cpu].state
== PER_CPU_STATE_READY_TO_BEGIN_MULTITASKING ?
"online" : "offline"
);
#endif
}
@@ -160,21 +161,3 @@ void bsp_smp_delay( int max )
{
__delay( max );
}
void bsp_smp_wait_for(
volatile unsigned int *address,
unsigned int desired,
int maximum_usecs
)
{
int iterations;
volatile unsigned int *p = address;
for (iterations=0 ; iterations < maximum_usecs ; iterations++ ) {
if ( *p == desired )
break;
bsp_smp_delay( 5000 );
}
}