RTEMS
Files | Macros | Typedefs | Enumerations | Functions | Variables
SMP Support

SMP Support. More...

Files

file  smp.h
 SuperCore SMP Support API.
 

Macros

#define SMP_MESSAGE_SHUTDOWN   0x1UL
 SMP message to request a processor shutdown. More...
 
#define SMP_MESSAGE_PERFORM_JOBS   0x2UL
 SMP message to perform per-processor jobs. More...
 

Typedefs

typedef void(* SMP_Action_handler) (void *arg)
 

Enumerations

enum  SMP_Fatal_code {
  SMP_FATAL_BOOT_PROCESSOR_NOT_ASSIGNED_TO_SCHEDULER, SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT, SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR, SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR,
  SMP_FATAL_SHUTDOWN, SMP_FATAL_SHUTDOWN_RESPONSE, SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED, SMP_FATAL_SCHEDULER_PIN_OR_UNPIN_NOT_SUPPORTED,
  SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS
}
 SMP fatal codes.
 

Functions

static uint32_t _SMP_Get_processor_maximum (void)
 
static uint32_t _SMP_Get_current_processor (void)
 
static void _SMP_Fatal (SMP_Fatal_code code)
 Terminates with the given code. More...
 
void _SMP_Handler_initialize (void)
 Initializes SMP Handler. More...
 
void _SMP_Start_multitasking_on_secondary_processor (Per_CPU_Control *cpu_self) RTEMS_NO_RETURN
 Performs high-level initialization of a secondary processor and runs the application threads. More...
 
static long unsigned _SMP_Inter_processor_interrupt_handler (Per_CPU_Control *cpu_self)
 Interrupts handler for inter-processor interrupts. More...
 
bool _SMP_Should_start_processor (uint32_t cpu_index)
 Checks if the processor with the specified index should be started. More...
 
void _SMP_Send_message (uint32_t cpu_index, unsigned long message)
 Sends an SMP message to a processor. More...
 
void _SMP_Send_message_broadcast (unsigned long message)
 Sends an SMP message to all other online processors. More...
 
void _SMP_Send_message_multicast (const Processor_mask *targets, unsigned long message)
 Sends an SMP message to a set of processors. More...
 
void _SMP_Multicast_action (const Processor_mask *targets, SMP_Action_handler handler, void *arg)
 Initiates an SMP multicast action to the set of target processors. More...
 
void _SMP_Broadcast_action (SMP_Action_handler handler, void *arg)
 Initiates an SMP multicast action to the set of all online processors. More...
 
void _SMP_Othercast_action (SMP_Action_handler handler, void *arg)
 Initiates an SMP multicast action to the set of all online processors excluding the current processor. More...
 
void _SMP_Unicast_action (uint32_t cpu_index, SMP_Action_handler handler, void *arg)
 Initiates an SMP action on the specified target processor. More...
 
void _SMP_Synchronize (void)
 Ensures that all store operations issued by the current processor before the call this function are visible to all other online processors. More...
 
void _SMP_Request_start_multitasking (void)
 Requests a multitasking start on all configured and available processors.
 
void _SMP_Request_shutdown (void)
 Requests a shutdown of all processors. More...
 
static __inline__ const Processor_mask * _SMP_Get_online_processors (void)
 Gets all online processors. More...
 
static __inline__ const bool _SMP_Need_inter_processor_interrupts (void)
 Indicate if inter-processor interrupts are needed. More...
 

Variables

const uint32_t _SMP_Processor_configured_maximum
 The configured processor maximum. More...
 
uint32_t _SMP_Processor_maximum
 
Processor_mask _SMP_Online_processors
 Set of online processors. More...
 

Detailed Description

SMP Support.

This defines the interface of the SuperCore SMP support.

Macro Definition Documentation

◆ SMP_MESSAGE_PERFORM_JOBS

#define SMP_MESSAGE_PERFORM_JOBS   0x2UL

SMP message to perform per-processor jobs.

See also
_SMP_Send_message().

Definition at line 50 of file smpimpl.h.

◆ SMP_MESSAGE_SHUTDOWN

#define SMP_MESSAGE_SHUTDOWN   0x1UL

SMP message to request a processor shutdown.

See also
_SMP_Send_message().

Definition at line 43 of file smpimpl.h.

Function Documentation

◆ _SMP_Broadcast_action()

void _SMP_Broadcast_action ( SMP_Action_handler  handler,
void *  arg 
)

Initiates an SMP multicast action to the set of all online processors.

Simply calls _SMP_Multicast_action() with _SMP_Get_online_processors() as the target processor set.

Parameters
handlerThe multicast action handler.
argThe multicast action argument.

Definition at line 202 of file smpmulticastaction.c.

◆ _SMP_Fatal()

static void _SMP_Fatal ( SMP_Fatal_code  code)
inlinestatic

Terminates with the given code.

Parameters
codeThe code for the termination.

Definition at line 72 of file smpimpl.h.

◆ _SMP_Get_online_processors()

static __inline__ const Processor_mask* _SMP_Get_online_processors ( void  )
static

Gets all online processors.

Returns
The processor mask with all online processors.

Definition at line 318 of file smpimpl.h.

◆ _SMP_Handler_initialize()

void _SMP_Handler_initialize ( void  )

Initializes SMP Handler.

This method initialize the SMP Handler.

Definition at line 113 of file smp.c.

◆ _SMP_Inter_processor_interrupt_handler()

static long unsigned _SMP_Inter_processor_interrupt_handler ( Per_CPU_Control cpu_self)
inlinestatic

Interrupts handler for inter-processor interrupts.

Parameters
[in,out]cpu_selfThe cpu control for the operation.
Returns
The received message.

Definition at line 138 of file smpimpl.h.

◆ _SMP_Multicast_action()

void _SMP_Multicast_action ( const Processor_mask *  targets,
SMP_Action_handler  handler,
void *  arg 
)

Initiates an SMP multicast action to the set of target processors.

The current processor may be part of the set. The caller must ensure that no thread dispatch can happen during the call of this function, otherwise the behaviour is undefined. In case a target processor is in a wrong state to process per-processor jobs, then this function results in an SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS fatal SMP error.

Parameters
targetsThe set of target processors for the action.
handlerThe multicast action handler.
argThe multicast action argument.

Definition at line 183 of file smpmulticastaction.c.

◆ _SMP_Need_inter_processor_interrupts()

static __inline__ const bool _SMP_Need_inter_processor_interrupts ( void  )
static

Indicate if inter-processor interrupts are needed.

Returns
True if inter-processor interrupts are needed for the correct system operation, otherwise false.

Definition at line 333 of file smpimpl.h.

◆ _SMP_Othercast_action()

void _SMP_Othercast_action ( SMP_Action_handler  handler,
void *  arg 
)

Initiates an SMP multicast action to the set of all online processors excluding the current processor.

Simply calls _SMP_Multicast_action() with _SMP_Get_online_processors() as the target processor set excluding the current processor.

Parameters
handlerThe multicast action handler.
argThe multicast action argument.

Definition at line 210 of file smpmulticastaction.c.

◆ _SMP_Request_shutdown()

void _SMP_Request_shutdown ( void  )

Requests a shutdown of all processors.

This function is a part of the system termination procedure.

See also
_Terminate().

Definition at line 205 of file smp.c.

◆ _SMP_Send_message()

void _SMP_Send_message ( uint32_t  cpu_index,
unsigned long  message 
)

Sends an SMP message to a processor.

The target processor may be the sending processor.

Parameters
cpu_indexThe target processor of the message.
messageThe message to send.

Definition at line 215 of file smp.c.

◆ _SMP_Send_message_broadcast()

void _SMP_Send_message_broadcast ( unsigned long  message)

Sends an SMP message to all other online processors.

Parameters
messageThe message to send.

Definition at line 224 of file smp.c.

◆ _SMP_Send_message_multicast()

void _SMP_Send_message_multicast ( const Processor_mask *  targets,
unsigned long  message 
)

Sends an SMP message to a set of processors.

The sending processor may be part of the set.

Parameters
targetsThe set of processors to send the message.
messageThe message to send.

Definition at line 244 of file smp.c.

◆ _SMP_Should_start_processor()

bool _SMP_Should_start_processor ( uint32_t  cpu_index)

Checks if the processor with the specified index should be started.

Parameters
cpu_indexThe processor index.
Return values
trueThe processor should be started.
falseThe processor should not be started.

Definition at line 176 of file smp.c.

◆ _SMP_Start_multitasking_on_secondary_processor()

void _SMP_Start_multitasking_on_secondary_processor ( Per_CPU_Control cpu_self)

Performs high-level initialization of a secondary processor and runs the application threads.

The low-level initialization code must call this function to hand over the control of this processor to RTEMS. Interrupts must be disabled. It must be possible to send inter-processor interrupts to this processor. Since interrupts are disabled the inter-processor interrupt delivery is postponed until interrupts are enabled the first time. Interrupts are enabled during the execution begin of threads in case they have interrupt level zero (this is the default).

The pre-requisites for the call to this function are

  • disabled interrupts,
  • delivery of inter-processor interrupts is possible,
  • a valid stack pointer and enough stack space,
  • a valid code memory, and
  • a valid BSS section.

This function must not be called by the main processor. The main processor uses _Thread_Start_multitasking() instead.

This function does not return to the caller.

Parameters
cpu_selfThe current processor control.

Definition at line 184 of file smp.c.

◆ _SMP_Synchronize()

void _SMP_Synchronize ( void  )

Ensures that all store operations issued by the current processor before the call this function are visible to all other online processors.

Simply calls _SMP_Othercast_action() with an empty multicast action.

Definition at line 227 of file smpmulticastaction.c.

◆ _SMP_Unicast_action()

void _SMP_Unicast_action ( uint32_t  cpu_index,
SMP_Action_handler  handler,
void *  arg 
)

Initiates an SMP action on the specified target processor.

This is an optimized variant of _SMP_Multicast_action().

Parameters
cpu_indexThe index of the target processor.
handlerThe action handler.
argThe action argument.

Definition at line 34 of file smpunicastaction.c.

Variable Documentation

◆ _SMP_Online_processors

Processor_mask _SMP_Online_processors

Set of online processors.

A processor is online if was started during system initialization. In this case its corresponding bit in the mask is set.

See also
_SMP_Handler_initialize().

Definition at line 36 of file smp.c.

◆ _SMP_Processor_configured_maximum

const uint32_t _SMP_Processor_configured_maximum

The configured processor maximum.

In SMP configurations, this constant is defined by the application configuration via <rtems/confdefs.h>, otherwise it is a compile-time constant with the value one.