From 5b8cfd1e7cb04f0ff67041af4986db78b61cd4b9 Mon Sep 17 00:00:00 2001 From: Nick Chan Date: Sun, 25 Aug 2024 15:40:29 +0800 Subject: [PATCH] kboot: Reserve secondary CPU stacks The secondary CPU may potentially use the stack after leaving WFE. Signed-off-by: Nick Chan --- src/kboot.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/kboot.c b/src/kboot.c index 02cf9527..40e644b3 100644 --- a/src/kboot.c +++ b/src/kboot.c @@ -408,6 +408,14 @@ static int dt_set_cpus(void) cpu++; node = next; continue; + } else { + printf("FDT: Reserving stack for CPU %d 0x%lx\n", cpu, (uint64_t)secondary_stacks[cpu]); + fdt_add_mem_rsv(dt, (uint64_t)secondary_stacks[cpu], SECONDARY_STACK_SIZE); + if (has_el3()) { + printf("FDT: Reserving EL3 stack for CPU %d 0x%lx\n", cpu, + (uint64_t)secondary_stacks_el3[cpu]); + fdt_add_mem_rsv(dt, (uint64_t)secondary_stacks_el3[cpu], SECONDARY_STACK_SIZE); + } } u64 mpidr = smp_get_mpidr(cpu);