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 <felix-coreboot@felixheld.de>
Change-Id: I39438229497c5d9c44dc7e247c7b2c81252b4bdb
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58456
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Felix Held 2021-10-19 02:57:22 +02:00 committed by Felix Held
parent 64ed1f1f86
commit a8772dbb1b
1 changed files with 8 additions and 11 deletions

View File

@ -486,7 +486,6 @@ static enum cb_err start_aps(struct bus *cpu_bus, int ap_count, atomic_t *num_ap
if (!CONFIG(X86_AMD_INIT_SIPI)) { if (!CONFIG(X86_AMD_INIT_SIPI)) {
printk(BIOS_DEBUG, "Waiting for 10ms after sending INIT.\n"); printk(BIOS_DEBUG, "Waiting for 10ms after sending INIT.\n");
mdelay(10); mdelay(10);
}
/* Send 1st Startup IPI (SIPI) */ /* Send 1st Startup IPI (SIPI) */
if (send_sipi_to_aps(ap_count, num_aps, sipi_vector) != CB_SUCCESS) if (send_sipi_to_aps(ap_count, num_aps, sipi_vector) != CB_SUCCESS)
@ -494,11 +493,9 @@ static enum cb_err start_aps(struct bus *cpu_bus, int ap_count, atomic_t *num_ap
/* Wait for CPUs to check in up to 200 us. */ /* Wait for CPUs to check in up to 200 us. */
wait_for_aps(num_aps, ap_count, 200 /* us */, 15 /* us */); wait_for_aps(num_aps, ap_count, 200 /* us */, 15 /* us */);
}
if (CONFIG(X86_AMD_INIT_SIPI)) /* Send final SIPI */
return CB_SUCCESS;
/* Send 2nd SIPI */
if (send_sipi_to_aps(ap_count, num_aps, sipi_vector) != CB_SUCCESS) if (send_sipi_to_aps(ap_count, num_aps, sipi_vector) != CB_SUCCESS)
return CB_ERR; return CB_ERR;