summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-03-16 13:44:05 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-03-19 11:33:35 +0000
commit1e1d5d60f72efa006dad18cab9f49f381d79cd9b (patch)
tree97c3f4837ec9a78c77b38af0b1c993753206171a /src/cpu
parent478f3d8f5e5b5e506ca4c9644bfa97ad389cef7f (diff)
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> Reviewed-on: https://review.coreboot.org/c/coreboot/+/51527 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/x86/smm/smm_module_loaderv2.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c
index 8354568b4b..5c45fcc017 100644
--- a/src/cpu/x86/smm/smm_module_loaderv2.c
+++ b/src/cpu/x86/smm/smm_module_loaderv2.c
@@ -243,8 +243,7 @@ static int smm_place_entry_code(uintptr_t smbase, unsigned int num_cpus,
* 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 @@ static void *smm_stub_place_stacks(char *base, size_t size,
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 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size,
* 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;
@@ -418,6 +406,8 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size,
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,