From 5539c3ed9030a18b0282831c41a5505343cd8305 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 26 Dec 2019 12:06:28 -0800 Subject: [PATCH] xtensa: add calling entry point for multi-processing Under multi-processing, only the first CPU#0 needs to go through setting up the kernel structs and clearing out BSS (among others). There is no need for other CPUs to do those tasks. Since each Xtensa core starts using the same boot vector, CPUs other than #0 need to skip all the startup tasks by not calling to z_cstart(). So provide another entry point for those CPUs. Note that Xtensa arch is highly configurable. So the implementation of the entry point is up to each individual SoC config. Signed-off-by: Daniel Leung --- arch/xtensa/core/crt1.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/xtensa/core/crt1.S b/arch/xtensa/core/crt1.S index f1d718609e4..29881f707cc 100644 --- a/arch/xtensa/core/crt1.S +++ b/arch/xtensa/core/crt1.S @@ -23,6 +23,7 @@ .global __start .type z_cstart, @function +.type z_mp_entry, @function /* Macros to abstract away ABI differences */ @@ -185,6 +186,19 @@ _start: #endif /* !XCHAL_HAVE_BOOTLOADER */ +#ifdef CONFIG_SMP + /* + * z_cstart() is only for CPU #0. + * Other CPUs have different entry point. + */ + rsr a3, PRID + extui a3, a3, 0, 8 /* extract core ID */ + beqz a3, 2f + CALL z_mp_entry + +2: +#endif /* CONFIG_SMP */ + /* Enter C domain, never returns from here */ CALL z_cstart