mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 23:23:13 +00:00
aarch64: More robust SMP system start
In SMP configurations, check that we run on a configured processor. If not, then there is not much that can be done since we do not have a stack available for this processor. Just loop forever in this case. Do this in assemlby to ensure that no stack memory is used.
This commit is contained in:
@@ -230,6 +230,24 @@ _start:
|
|||||||
#ifdef RTEMS_SMP
|
#ifdef RTEMS_SMP
|
||||||
bl _AArch64_Get_current_processor_for_system_start
|
bl _AArch64_Get_current_processor_for_system_start
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check that this is a configured processor. If not, then there is
|
||||||
|
* not much that can be done since we do not have a stack available for
|
||||||
|
* this processor. Just loop forever in this case.
|
||||||
|
*/
|
||||||
|
#ifdef AARCH64_MULTILIB_ARCH_V8_ILP32
|
||||||
|
ldr w1, =_SMP_Processor_configured_maximum
|
||||||
|
#else
|
||||||
|
ldr x1, =_SMP_Processor_configured_maximum
|
||||||
|
#endif
|
||||||
|
ldr w1, [x1]
|
||||||
|
cmp x1, x0
|
||||||
|
bgt .Lconfigured_processor
|
||||||
|
.Linvalid_processor_wait_for_ever:
|
||||||
|
wfe
|
||||||
|
b .Linvalid_processor_wait_for_ever
|
||||||
|
.Lconfigured_processor:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get current per-CPU control and store it in PL1 only Thread ID
|
* Get current per-CPU control and store it in PL1 only Thread ID
|
||||||
* Register (TPIDR_EL1).
|
* Register (TPIDR_EL1).
|
||||||
|
|||||||
@@ -54,24 +54,14 @@ BSP_START_TEXT_SECTION void bsp_start_hook_0( void )
|
|||||||
|
|
||||||
BSP_START_TEXT_SECTION void bsp_start_hook_1( void )
|
BSP_START_TEXT_SECTION void bsp_start_hook_1( void )
|
||||||
{
|
{
|
||||||
|
AArch64_start_set_vector_base();
|
||||||
|
|
||||||
#ifdef RTEMS_SMP
|
#ifdef RTEMS_SMP
|
||||||
uint32_t cpu_index_self;
|
uint32_t cpu_index_self;
|
||||||
|
|
||||||
cpu_index_self = _SMP_Get_current_processor();
|
cpu_index_self = _SMP_Get_current_processor();
|
||||||
|
|
||||||
if ( cpu_index_self != 0 ) {
|
if ( cpu_index_self != 0 ) {
|
||||||
if (
|
|
||||||
cpu_index_self >= rtems_configuration_get_maximum_processors()
|
|
||||||
|| !_SMP_Should_start_processor( cpu_index_self )
|
|
||||||
) {
|
|
||||||
while ( true ) {
|
|
||||||
_AARCH64_Wait_for_event();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Change the VBAR from the start to the normal vector table */
|
|
||||||
AArch64_start_set_vector_base();
|
|
||||||
|
|
||||||
zynqmp_setup_secondary_cpu_mmu_and_cache();
|
zynqmp_setup_secondary_cpu_mmu_and_cache();
|
||||||
arm_gic_irq_initialize_secondary_cpu();
|
arm_gic_irq_initialize_secondary_cpu();
|
||||||
|
|
||||||
@@ -83,7 +73,6 @@ BSP_START_TEXT_SECTION void bsp_start_hook_1( void )
|
|||||||
}
|
}
|
||||||
#endif /* RTEMS_SMP */
|
#endif /* RTEMS_SMP */
|
||||||
|
|
||||||
AArch64_start_set_vector_base();
|
|
||||||
zynqmp_setup_mmu_and_cache();
|
zynqmp_setup_mmu_and_cache();
|
||||||
bsp_start_clear_bss();
|
bsp_start_clear_bss();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user