diff --git a/src/arch/arm64/cpu_ramstage.c b/src/arch/arm64/cpu_ramstage.c index ce81f9399d..ec1ac0f0e4 100644 --- a/src/arch/arm64/cpu_ramstage.c +++ b/src/arch/arm64/cpu_ramstage.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -155,6 +156,13 @@ static void init_cpu_info(struct bus *bus) cpu_mark_online(cpu_info()); } +static void invalidate_cpu_stack_top(unsigned int id) +{ + const size_t size = 128; + char *stack = cpu_get_stack(id); + dcache_invalidate_by_mva(stack - size, size); +} + void arch_initialize_cpus(device_t cluster, struct cpu_control_ops *cntrl_ops) { size_t max_cpus; @@ -208,6 +216,10 @@ void arch_initialize_cpus(device_t cluster, struct cpu_control_ops *cntrl_ops) if (!cpu_online(ci)) { /* Start the CPU. */ printk(BIOS_DEBUG, "Starting CPU%x\n", ci->id); + + /* Ensure CPU's top of stack is not in the cache. */ + invalidate_cpu_stack_top(ci->id); + if (cntrl_ops->start_cpu(ci->id, entry)) { printk(BIOS_ERR, "Failed to start CPU%x\n", ci->id);