mb/emulation/qemu: Fix SMP boot

Fix booting with SMP enabled, when specifying more CPUs than supported
by the code.

Change-Id: Ib3d7c1a1a7a8633d4d434ccbd46cf92b0074b724
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50235
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Patrick Rudolph 2021-02-02 18:14:24 +01:00 committed by Patrick Georgi
parent 944da4828f
commit cfa02256a5
2 changed files with 8 additions and 2 deletions

View File

@ -44,8 +44,8 @@ endchoice
config MAX_CPUS
int
default 4 if SMM_ASEG
default 32
default 32 if SMM_TSEG
default 4
config CPU_QEMU_X86_64
bool "Experimental 64bit support"

View File

@ -271,6 +271,12 @@ static void cpu_bus_scan(struct device *bus)
if (max_cpus < 0)
return;
/*
* Do not install more CPUs than supported by coreboot.
* This will cause a buffer overflow where fixed arrays of CONFIG_MAX_CPUS
* are used and might result in a boot failure.
*/
max_cpus = MIN(max_cpus, CONFIG_MAX_CPUS);
/*
* TODO: This only handles the simple "qemu -smp $nr" case