From 6bf4da9e916137080da8f4e3c33dd4bc40cf7749 Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Tue, 7 Nov 2023 11:49:17 +0100 Subject: [PATCH] smp: perform full AP initialization before releasing All initialization routines and settings must be through, before letting BSP continue. Signed-off-by: Pawel Wieczorkiewicz --- smp/smp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/smp/smp.c b/smp/smp.c index 4aa5147d..bff4b570 100644 --- a/smp/smp.c +++ b/smp/smp.c @@ -56,15 +56,16 @@ void __noreturn ap_startup(void) { init_traps(cpu); init_apic(ap_cpuid, apic_get_mode()); - ap_callin = true; - smp_wmb(); - init_timers(cpu); sti(); if (opt_fpu) enable_fpu(); + /* Release BSP after full AP initialization */ + ap_callin = true; + smp_wmb(); + while (true) run_tasks(cpu); @@ -103,6 +104,7 @@ static __text_init void boot_cpu(cpu_t *cpu) { apic_wait_ready(); + /* Wait for AP initialization */ while (!ap_callin) cpu_relax();