diff --git a/bsps/aarch64/xen/include/bsp.h b/bsps/aarch64/xen/include/bsp.h index fcbeebd211..bab1d6ce51 100644 --- a/bsps/aarch64/xen/include/bsp.h +++ b/bsps/aarch64/xen/include/bsp.h @@ -71,6 +71,14 @@ extern "C" { BSP_START_TEXT_SECTION void xen_setup_mmu_and_cache( void ); +/** + * @brief Xen-specific set up of the MMU for non-primary + * cores. + * + * Provide in the application to override the defaults in the BSP. + */ +BSP_START_TEXT_SECTION void xen_setup_secondary_cpu_mmu_and_cache( void ); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/bsps/aarch64/xen/start/bspstarthooks.c b/bsps/aarch64/xen/start/bspstarthooks.c index 63b0782fcb..88d2f4d522 100644 --- a/bsps/aarch64/xen/start/bspstarthooks.c +++ b/bsps/aarch64/xen/start/bspstarthooks.c @@ -37,9 +37,34 @@ #include #include +#ifdef RTEMS_SMP +#include +#include + +#include +#endif + BSP_START_TEXT_SECTION void bsp_start_hook_1( void ) { AArch64_start_set_vector_base(); + +#ifdef RTEMS_SMP + uint32_t cpu_index_self; + + cpu_index_self = _SMP_Get_current_processor(); + + if ( cpu_index_self != 0 ) { + xen_setup_secondary_cpu_mmu_and_cache(); + arm_gic_irq_initialize_secondary_cpu(); + + bsp_interrupt_vector_enable( ARM_GIC_IRQ_SGI_0 ); + _SMP_Start_multitasking_on_secondary_processor( + _Per_CPU_Get_by_index( cpu_index_self ) + ); + /* Unreached */ + } +#endif /* RTEMS_SMP */ + xen_setup_mmu_and_cache(); bsp_start_clear_bss(); } diff --git a/bsps/aarch64/xen/start/bspstartmmu.c b/bsps/aarch64/xen/start/bspstartmmu.c index 229b0d99fc..6b9ee01800 100644 --- a/bsps/aarch64/xen/start/bspstartmmu.c +++ b/bsps/aarch64/xen/start/bspstartmmu.c @@ -56,3 +56,12 @@ xen_setup_mmu_and_cache( void ) aarch64_mmu_enable( control ); } + +BSP_START_TEXT_SECTION void xen_setup_secondary_cpu_mmu_and_cache( void ) +{ + aarch64_mmu_control *control = &aarch64_mmu_instance; + + /* Perform basic MMU setup */ + aarch64_mmu_setup(); + aarch64_mmu_enable( control ); +} diff --git a/spec/build/bsps/aarch64/xen/grp.yml b/spec/build/bsps/aarch64/xen/grp.yml index 78a5302016..fcaa4064a8 100644 --- a/spec/build/bsps/aarch64/xen/grp.yml +++ b/spec/build/bsps/aarch64/xen/grp.yml @@ -14,6 +14,8 @@ links: uid: abi - role: build-dependency uid: obj +- role: build-dependency + uid: objsmp - role: build-dependency uid: optloadoff - role: build-dependency diff --git a/spec/build/cpukit/optsmp.yml b/spec/build/cpukit/optsmp.yml index b93345fe61..09ff1e4cfa 100644 --- a/spec/build/cpukit/optsmp.yml +++ b/spec/build/cpukit/optsmp.yml @@ -21,6 +21,7 @@ enabled-by: - arm/realview_pbx_a9_qemu - arm/xilinx_zynqmp_ultra96 - bsps/aarch64/xilinx-zynqmp +- bsps/aarch64/xen - bsps/arm/xilinx-zynq - bsps/powerpc/qoriq - i386/pc586sse