aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/emulation
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2021-02-02 18:14:24 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-02-04 09:53:02 +0000
commitcfa02256a5098e8449b4cbc1830990fac75d5fc1 (patch)
tree3abfea603b9c709b898a44b38d8cbd514a3a147a /src/mainboard/emulation
parent944da4828fefe3ffcb691e55d9c55edef190fabe (diff)
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>
Diffstat (limited to 'src/mainboard/emulation')
-rw-r--r--src/mainboard/emulation/qemu-i440fx/northbridge.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c
index f49d47dac9..80fba1de07 100644
--- a/src/mainboard/emulation/qemu-i440fx/northbridge.c
+++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c
@@ -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