x86/mp_init: Add configurable stack size for SMM relocate

A stack overrun has been observed on AMD64 CPUs during the SMM module
relocation process.  Change the assumed required size from equaling the
save structure's size to a Kconfig symbol.

A value of 0x400 doubles the size used by AMD64 systems and maintains
the size used by EM64T.

BUG=b:118420852
TEST=S3 on Grunt and verify 0x2f000-0x30000 uncorrupted

Change-Id: Ib1d590ee4afb06ca649afd6ad253cdfd969ae777
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/29277
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Richard Spiegel <richard.spiegel@silverbackltd.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Marshall Dawson 2018-10-25 13:01:55 -06:00 committed by Martin Roth
parent bf00401e8a
commit 46fc684783
2 changed files with 9 additions and 1 deletions

View File

@ -118,6 +118,14 @@ config SMM_MODULE_STACK_SIZE
This option determines the size of the stack within the SMM handler This option determines the size of the stack within the SMM handler
modules. modules.
config SMM_STUB_STACK_SIZE
hex
default 0x400
depends on SMM_TSEG
help
This option determines the size of the stack within the SMM handler
modules.
config SMM_LAPIC_REMAP_MITIGATION config SMM_LAPIC_REMAP_MITIGATION
bool bool
default y if NORTHBRIDGE_INTEL_I945 default y if NORTHBRIDGE_INTEL_I945

View File

@ -773,7 +773,7 @@ static void adjust_smm_apic_id_map(struct smm_loader_params *smm_params)
static int install_relocation_handler(int num_cpus, size_t save_state_size) static int install_relocation_handler(int num_cpus, size_t save_state_size)
{ {
struct smm_loader_params smm_params = { struct smm_loader_params smm_params = {
.per_cpu_stack_size = save_state_size, .per_cpu_stack_size = CONFIG_SMM_STUB_STACK_SIZE,
.num_concurrent_stacks = num_cpus, .num_concurrent_stacks = num_cpus,
.per_cpu_save_state_size = save_state_size, .per_cpu_save_state_size = save_state_size,
.num_concurrent_save_states = 1, .num_concurrent_save_states = 1,