Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/50768 )
Change subject: cpu/x86/smm_loaderv2: Fix SMM loading for 1 CPU ......................................................................
cpu/x86/smm_loaderv2: Fix SMM loading for 1 CPU
With 1 CPU the num_concurrent_save_state is 1 so the entry for the permanent handler is never placed.
Change-Id: I1df39ba507650a9cc545354db92d0735539fbe89 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/cpu/x86/smm/smm_module_loaderv2.c 1 file changed, 11 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/68/50768/1
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c index 8eef2f6..a2cd54a 100644 --- a/src/cpu/x86/smm/smm_module_loaderv2.c +++ b/src/cpu/x86/smm/smm_module_loaderv2.c @@ -290,22 +290,6 @@ * staggered by the per CPU SMM save state size extending down from * SMM_ENTRY_OFFSET. */ -static int smm_stub_place_staggered_entry_points(char *base, - const struct smm_loader_params *params, const struct rmodule *smm_stub) -{ - size_t stub_entry_offset; - int rc = 1; - stub_entry_offset = rmodule_entry_offset(smm_stub); - /* Each CPU now has its own stub code, which enters protected mode, - * sets up the stack, and then jumps to common SMI handler - */ - if (params->num_concurrent_save_states > 1 || stub_entry_offset != 0) { - rc = smm_place_entry_code((uintptr_t)base, - params->num_concurrent_save_states, - (uintptr_t)params->stack_top, params); - } - return rc; -}
/* * The stub setup code assumes it is completely contained within the @@ -386,7 +370,6 @@
smm_stub_loc = NULL; smm_stub_size = rmodule_memory_size(&smm_stub); - stub_entry_offset = rmodule_entry_offset(&smm_stub);
/* Put the stub at the main entry point */ smm_stub_loc = &base[params->smm_main_entry_offset]; @@ -418,9 +401,17 @@ return -1; }
- if (!smm_stub_place_staggered_entry_points(base, params, &smm_stub)) { - printk(BIOS_ERR, "%s: staggered entry points failed\n", __func__); - return -1; + /* + * Placing multiple entry codes is only needed for the permanent handler. + * The assumption is made that the permanent handler is not at SMM_DEFAULT_BASE. + * This assumption is sane as the default SMM space /* cannot hold our SMM setup. */ + */ + if (smbase != (void *)SMM_DEFAULT_BASE) { + if (!smm_place_entry_code((uintptr_t)smbase, params->num_concurrent_save_states, + (uintptr_t)params->stack_top, params)) { + printk(BIOS_ERR, "%s: staggered entry points failed\n", __func__); + return -1; + } }
/* Setup the parameters for the stub code. */