aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/x86/smm
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-02-15 19:39:01 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-03-19 11:33:28 +0000
commit478f3d8f5e5b5e506ca4c9644bfa97ad389cef7f (patch)
treeff42d0163c59c0f45bd297b362dc86fef4d80555 /src/cpu/x86/smm
parentad0116c0327f575f0af184a2f4861848a49a0e2a (diff)
cpu/x86/mp_init: Allow stub sizes larger than the save state size
The permanent handler module argument 'save_state_size' now holds the meaning of the real save state size which is then substracted from the CPUs save state 'top' to get the save state base. TESTED with qemu Q35 on x86_64 where the stub size exceeds the AMD64 save state size. Change-Id: I55d7611a17b6d0a39aee1c56318539232a9bb781 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50770 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/cpu/x86/smm')
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c8
-rw-r--r--src/cpu/x86/smm/smm_module_loaderv2.c8
2 files changed, 2 insertions, 14 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index 021d739f94..39cd9101a5 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -198,12 +198,6 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
smm_stub_size = rmodule_memory_size(&smm_stub);
stub_entry_offset = rmodule_entry_offset(&smm_stub);
- if (smm_stub_size > params->per_cpu_save_state_size) {
- printk(BIOS_ERR, "SMM Module: SMM stub size larger than save state size\n");
- printk(BIOS_ERR, "SMM Module: Staggered entry points will overlap stub\n");
- return -1;
- }
-
/* Assume the stub is always small enough to live within upper half of
* SMRAM region after the save state space has been allocated. */
smm_stub_loc = &base[SMM_ENTRY_OFFSET];
@@ -389,7 +383,7 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params)
handler_mod_params = rmodule_parameters(&smm_mod);
handler_mod_params->smbase = (uintptr_t)smram;
handler_mod_params->smm_size = size;
- handler_mod_params->save_state_size = params->per_cpu_save_state_size;
+ handler_mod_params->save_state_size = params->real_cpu_save_state_size;
handler_mod_params->num_cpus = params->num_concurrent_stacks;
handler_mod_params->gnvs_ptr = (uintptr_t)acpi_get_gnvs();
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c
index c8b9fe689a..8354568b4b 100644
--- a/src/cpu/x86/smm/smm_module_loaderv2.c
+++ b/src/cpu/x86/smm/smm_module_loaderv2.c
@@ -123,12 +123,6 @@ static int smm_create_map(uintptr_t smbase, unsigned int num_cpus,
return 0;
}
- if (stub_size > ss_size) {
- printk(BIOS_ERR, "%s: Save state larger than SMM stub size\n", __func__);
- printk(BIOS_ERR, " Decrease stub size or increase the size allocated for the save state\n");
- return 0;
- }
-
for (i = 0; i < num_cpus; i++) {
cpus[i].smbase = base;
cpus[i].entry = base + smm_entry_offset;
@@ -588,7 +582,7 @@ int smm_load_module(void *smram, size_t size, struct smm_loader_params *params)
handler_mod_params = rmodule_parameters(&smm_mod);
handler_mod_params->smbase = (uintptr_t)smram;
handler_mod_params->smm_size = size;
- handler_mod_params->save_state_size = params->per_cpu_save_state_size;
+ handler_mod_params->save_state_size = params->real_cpu_save_state_size;
handler_mod_params->num_cpus = params->num_concurrent_stacks;
handler_mod_params->gnvs_ptr = (uintptr_t)acpi_get_gnvs();