diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2021-02-15 23:39:01 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-03-19 11:31:17 +0000 |
commit | dfff5c2d193066adff8e0bee9ed4525b622eb7c8 (patch) | |
tree | 4c66baf5dd9e96cf534d5dcc31441200e7ab8ad5 | |
parent | 50e849fc9b09773b2647bd074e9f08e1a5f028a3 (diff) |
cpu/x86/smm_loaderv2: Fix when only 1 CPU is present
Move out smm_create_map as this was not run if concurrent_save_states
is 1. The cpus struct array is used in the smm_get_cpu_smbase()
callback so it is necessary to create this.
TEST: run qemu/q35 with -smp 1 (or no -smp argument)
Change-Id: I07a98bbc9ff6dce548171ee6cd0c303db94087aa
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50783
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/cpu/x86/smm/smm_module_loaderv2.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c index 5f7e76ec01..e0877e7fc4 100644 --- a/src/cpu/x86/smm/smm_module_loaderv2.c +++ b/src/cpu/x86/smm/smm_module_loaderv2.c @@ -214,24 +214,20 @@ static int smm_place_entry_code(uintptr_t smbase, unsigned int num_cpus, { unsigned int i; unsigned int size; - if (smm_create_map(smbase, num_cpus, params)) { - /* - * Ensure there was enough space and the last CPUs smbase - * did not encroach upon the stack. Stack top is smram start - * + size of stack. - */ - if (cpus[num_cpus].active) { - if (cpus[num_cpus - 1].smbase + - params->smm_main_entry_offset < stack_top) { - printk(BIOS_ERR, "%s: stack encroachment\n", __func__); + + /* + * Ensure there was enough space and the last CPUs smbase + * did not encroach upon the stack. Stack top is smram start + * + size of stack. + */ + if (cpus[num_cpus].active) { + if (cpus[num_cpus - 1].smbase + + params->smm_main_entry_offset < stack_top) { + printk(BIOS_ERR, "%s: stack encroachment\n", __func__); printk(BIOS_ERR, "%s: smbase %zx, stack_top %lx\n", - __func__, cpus[num_cpus].smbase, stack_top); + __func__, cpus[num_cpus].smbase, stack_top); return 0; - } } - } else { - printk(BIOS_ERR, "%s: unable to place smm entry code\n", __func__); - return 0; } printk(BIOS_INFO, "%s: smbase %zx, stack_top %lx\n", @@ -639,5 +635,11 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params) printk(BIOS_DEBUG, "%s: cpu0 entry: %p\n", __func__, base); params->smm_entry = (uintptr_t)base + params->smm_main_entry_offset; + + if (!smm_create_map((uintptr_t)base, params->num_concurrent_save_states, params)) { + printk(BIOS_ERR, "%s: Error creating CPU map\n", __func__); + return -1; + } + return smm_module_setup_stub(base, size, params, fxsave_area); } |