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>
This commit is contained in:
parent
478f3d8f5e
commit
1e1d5d60f7
|
@ -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
|
* Place stacks in base -> base + size region, but ensure the stacks don't
|
||||||
* overlap the staggered entry points.
|
* overlap the staggered entry points.
|
||||||
*/
|
*/
|
||||||
static void *smm_stub_place_stacks(char *base, size_t size,
|
static void *smm_stub_place_stacks(char *base, struct smm_loader_params *params)
|
||||||
struct smm_loader_params *params)
|
|
||||||
{
|
{
|
||||||
size_t total_stack_size;
|
size_t total_stack_size;
|
||||||
char *stacks_top;
|
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",
|
printk(BIOS_DEBUG, "%s: cpus: %zx : stack space: needed -> %zx\n",
|
||||||
__func__, params->num_concurrent_stacks,
|
__func__, params->num_concurrent_stacks,
|
||||||
total_stack_size);
|
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. */
|
/* There has to be at least one stack user. */
|
||||||
if (params->num_concurrent_stacks < 1)
|
if (params->num_concurrent_stacks < 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Total stack size cannot fit. */
|
|
||||||
if (total_stack_size > size)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Stacks extend down to SMBASE */
|
/* Stacks extend down to SMBASE */
|
||||||
stacks_top = &base[total_stack_size];
|
stacks_top = &base[total_stack_size];
|
||||||
printk(BIOS_DEBUG, "%s: exit, stack_top %p\n", __func__, stacks_top);
|
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
|
* for default handler, but for relocated handler it lives at the beginning
|
||||||
* of SMRAM which is TSEG base
|
* of SMRAM which is TSEG base
|
||||||
*/
|
*/
|
||||||
const size_t total_stack_size = params->num_concurrent_stacks *
|
stacks_top = smm_stub_place_stacks(smbase, params);
|
||||||
params->per_cpu_stack_size;
|
|
||||||
stacks_top = smm_stub_place_stacks(smbase, total_stack_size,
|
|
||||||
params);
|
|
||||||
if (stacks_top == NULL) {
|
if (stacks_top == NULL) {
|
||||||
printk(BIOS_ERR, "%s: not enough space for stacks\n", __func__);
|
printk(BIOS_ERR, "%s: error assigning stacks\n", __func__);
|
||||||
printk(BIOS_ERR, "%s: ....need -> %p : available -> %zx\n", __func__,
|
|
||||||
base, total_stack_size);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
params->stack_top = stacks_top;
|
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 = (uintptr_t)fxsave_area;
|
||||||
stub_params->fxsave_area_size = FXSAVE_SIZE;
|
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",
|
printk(BIOS_DEBUG, "%s: stack_end = 0x%lx\n",
|
||||||
__func__, stub_params->stack_top - total_stack_size);
|
__func__, stub_params->stack_top - total_stack_size);
|
||||||
printk(BIOS_DEBUG,
|
printk(BIOS_DEBUG,
|
||||||
|
|
Loading…
Reference in New Issue