Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/51527 )
Change subject: cpu/x86/smm_module_loaderv2.c: Remove noop stack size check ......................................................................
cpu/x86/smm_module_loaderv2.c: Remove noop stack size check
The argument provided to the function was always the same as the one computed inside the function so drop the argument.
Change-Id: I14abf400dce1bd9b03e401b6619a0500a650fa0e Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/cpu/x86/smm/smm_module_loaderv2.c 1 file changed, 5 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/51527/1
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c index f6d45dc..3f0be01 100644 --- a/src/cpu/x86/smm/smm_module_loaderv2.c +++ b/src/cpu/x86/smm/smm_module_loaderv2.c @@ -243,8 +243,7 @@ * Place stacks in base -> base + size region, but ensure the stacks don't * overlap the staggered entry points. */ -static void *smm_stub_place_stacks(char *base, size_t size, - struct smm_loader_params *params) +static void *smm_stub_place_stacks(char *base, struct smm_loader_params *params) { size_t total_stack_size; char *stacks_top; @@ -256,17 +255,11 @@ printk(BIOS_DEBUG, "%s: cpus: %zx : stack space: needed -> %zx\n", __func__, params->num_concurrent_stacks, total_stack_size); - printk(BIOS_DEBUG, " available -> %zx : per_cpu_stack_size : %zx\n", - size, params->per_cpu_stack_size);
/* There has to be at least one stack user. */ if (params->num_concurrent_stacks < 1) return NULL;
- /* Total stack size cannot fit. */ - if (total_stack_size > size) - return NULL; - /* Stacks extend down to SMBASE */ stacks_top = &base[total_stack_size]; printk(BIOS_DEBUG, "%s: exit, stack_top %p\n", __func__, stacks_top); @@ -388,14 +381,9 @@ * for default handler, but for relocated handler it lives at the beginning * of SMRAM which is TSEG base */ - const size_t total_stack_size = params->num_concurrent_stacks * - params->per_cpu_stack_size; - stacks_top = smm_stub_place_stacks(smbase, total_stack_size, - params); + stacks_top = smm_stub_place_stacks(smbase, params); if (stacks_top == NULL) { - printk(BIOS_ERR, "%s: not enough space for stacks\n", __func__); - printk(BIOS_ERR, "%s: ....need -> %p : available -> %zx\n", __func__, - base, total_stack_size); + printk(BIOS_ERR, "%s: error assigning stacks\n", __func__); return -1; } params->stack_top = stacks_top; @@ -419,6 +407,8 @@ stub_params->fxsave_area = (uintptr_t)fxsave_area; stub_params->fxsave_area_size = FXSAVE_SIZE;
+ const size_t total_stack_size = + params->num_concurrent_stacks * params->per_cpu_stack_size; printk(BIOS_DEBUG, "%s: stack_end = 0x%lx\n", __func__, stub_params->stack_top - total_stack_size); printk(BIOS_DEBUG,