From 53e008b6fda8ccd1cdcf0f000bbccf1d3788206b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 10 Apr 2014 15:48:05 +0200 Subject: score: SMP initialization changes Add and use _CPU_SMP_Start_processor(). Add and use _CPU_SMP_Finalize_initialization(). This makes most _CPU_SMP_Initialize() functions a bit simpler since we can calculate the minimum value of the count of processors requested by the application configuration and the count of physically or virtually available processors in the high-level code. The CPU port has now the ability to signal a processor start failure. With the support for clustered/partitioned scheduling the presence of particular processors can be configured to be optional or mandatory. There will be a fatal error only in case mandatory processors are not present. The CPU port may use a timeout to monitor the start of a processor. --- cpukit/score/src/smp.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'cpukit/score/src/smp.c') diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index bfb09dd783..08677d83c7 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -26,11 +26,13 @@ void _SMP_Handler_initialize( void ) { - uint32_t max_cpus = rtems_configuration_get_maximum_processors(); - uint32_t cpu; + uint32_t cpu_max = rtems_configuration_get_maximum_processors(); + uint32_t cpu_self; + uint32_t cpu_count; + uint32_t cpu_index; - for ( cpu = 0 ; cpu < max_cpus; ++cpu ) { - Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu ); + for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) { + Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu_index ); _SMP_ticket_lock_Initialize( &per_cpu->Lock, "per-CPU" ); } @@ -38,9 +40,28 @@ void _SMP_Handler_initialize( void ) /* * Discover and initialize the secondary cores in an SMP system. */ - max_cpus = _CPU_SMP_Initialize( max_cpus ); - _SMP_Processor_count = max_cpus; + cpu_count = _CPU_SMP_Initialize(); + cpu_count = cpu_count < cpu_max ? cpu_count : cpu_max; + _SMP_Processor_count = cpu_count; + + cpu_self = _SMP_Get_current_processor(); + + for ( cpu_index = 0 ; cpu_index < cpu_count; ++cpu_index ) { + if ( cpu_index != cpu_self ) { + bool ok = _CPU_SMP_Start_processor( cpu_index ); + + if ( !ok ) { + _Terminate( + RTEMS_FATAL_SOURCE_SMP, + false, + SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED + ); + } + } + } + + _CPU_SMP_Finalize_initialization( cpu_count ); } void _SMP_Request_start_multitasking( void ) -- cgit v1.2.3