From a8772dbb1ba4a8204c80a8ebf066e4107a7f7f7e Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 19 Oct 2021 02:57:22 +0200 Subject: cpu/x86/mp_init: rework start_aps to fix X86_AMD_INIT_SIPI case When CONFIG_X86_AMD_INIT_SIPI was set, the second/final SIPI that afterwards checks if all APs have checked in was skipped and if it got so far, start_aps returned CB_SUCCESS despite not having checked if all APs had checked in after the SIPI. This patch makes start_aps skip the first SIPI in the CONFIG_X86_AMD_INIT_SIPI case so we use the proper timeouts and error handling for the final and this case only SIPI and signal the caller an error when not all APs have checked in after the SIPI. A timeless build for lenovo/x230 which is a mainboard that doesn't select X86_AMD_INIT_SIPI results in identical binary, so this doesn't change the behavior of the !X86_AMD_INIT_SIPI case. Signed-off-by: Felix Held Change-Id: I39438229497c5d9c44dc7e247c7b2c81252b4bdb Reviewed-on: https://review.coreboot.org/c/coreboot/+/58456 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Raul Rangel --- src/cpu/x86/mp_init.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index 806fc98123..fd2add0b9b 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -486,19 +486,16 @@ static enum cb_err start_aps(struct bus *cpu_bus, int ap_count, atomic_t *num_ap if (!CONFIG(X86_AMD_INIT_SIPI)) { printk(BIOS_DEBUG, "Waiting for 10ms after sending INIT.\n"); mdelay(10); - } - - /* Send 1st Startup IPI (SIPI) */ - if (send_sipi_to_aps(ap_count, num_aps, sipi_vector) != CB_SUCCESS) - return CB_ERR; - /* Wait for CPUs to check in up to 200 us. */ - wait_for_aps(num_aps, ap_count, 200 /* us */, 15 /* us */); + /* Send 1st Startup IPI (SIPI) */ + if (send_sipi_to_aps(ap_count, num_aps, sipi_vector) != CB_SUCCESS) + return CB_ERR; - if (CONFIG(X86_AMD_INIT_SIPI)) - return CB_SUCCESS; + /* Wait for CPUs to check in up to 200 us. */ + wait_for_aps(num_aps, ap_count, 200 /* us */, 15 /* us */); + } - /* Send 2nd SIPI */ + /* Send final SIPI */ if (send_sipi_to_aps(ap_count, num_aps, sipi_vector) != CB_SUCCESS) return CB_ERR; -- cgit v1.2.3