summaryrefslogtreecommitdiff
path: root/src/cpu/x86
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-02-15 16:43:19 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-03-19 11:30:47 +0000
commit50e849fc9b09773b2647bd074e9f08e1a5f028a3 (patch)
tree87ddc19ae05f63994bcb07519b442868da8dc383 /src/cpu/x86
parent6f9b1a904923cab9905bd6521738e7b6617cf3c5 (diff)
cpu/x86/smm_stub.S: Drop smm_runtime from the stub
The parameters that the permanent handler requires are pushed directly to the permanent handlers relocatable module params. The paremeters that the relocation handler requires are not passed on via arguments but are copied inside the ramstage. This is ok as the relocation handler calls into ramstage. Change-Id: Ice311d05e2eb0e95122312511d83683d7f0dee58 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50767 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/cpu/x86')
-rw-r--r--src/cpu/x86/mp_init.c5
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c5
-rw-r--r--src/cpu/x86/smm/smm_module_loaderv2.c20
-rw-r--r--src/cpu/x86/smm/smm_stub.S18
4 files changed, 2 insertions, 46 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index 26b1ccabe2..6003c9745b 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -709,15 +709,12 @@ static void smm_enable(void)
static void asmlinkage smm_do_relocation(void *arg)
{
const struct smm_module_params *p;
- const struct smm_runtime *runtime;
int cpu;
- uintptr_t curr_smbase;
+ const uintptr_t curr_smbase = SMM_DEFAULT_BASE;
uintptr_t perm_smbase;
p = arg;
- runtime = p->runtime;
cpu = p->cpu;
- curr_smbase = runtime->smbase;
if (cpu >= CONFIG_MAX_CPUS) {
printk(BIOS_CRIT,
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index 028ace27eb..de2738ab36 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -251,11 +251,6 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
stub_params->c_handler = (uintptr_t)params->handler;
stub_params->fxsave_area = (uintptr_t)fxsave_area;
stub_params->fxsave_area_size = FXSAVE_SIZE;
- stub_params->runtime.smbase = (uintptr_t)smbase;
- stub_params->runtime.smm_size = smm_size;
- stub_params->runtime.save_state_size = params->per_cpu_save_state_size;
- stub_params->runtime.num_cpus = params->num_concurrent_stacks;
- stub_params->runtime.gnvs_ptr = (uintptr_t)acpi_get_gnvs();
/* Initialize the APIC id to CPU number table to be 1:1 */
for (i = 0; i < params->num_concurrent_stacks; i++)
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c
index afed05f9bd..5f7e76ec01 100644
--- a/src/cpu/x86/smm/smm_module_loaderv2.c
+++ b/src/cpu/x86/smm/smm_module_loaderv2.c
@@ -342,7 +342,6 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
size_t i;
struct smm_stub_params *stub_params;
struct rmodule smm_stub;
- unsigned int total_size_all;
base = smbase;
size = smm_size;
@@ -431,11 +430,6 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
stub_params->c_handler = (uintptr_t)params->handler;
stub_params->fxsave_area = (uintptr_t)fxsave_area;
stub_params->fxsave_area_size = FXSAVE_SIZE;
- stub_params->runtime.smbase = (uintptr_t)smbase;
- stub_params->runtime.smm_size = smm_size;
- stub_params->runtime.save_state_size = params->per_cpu_save_state_size;
- stub_params->runtime.num_cpus = params->num_concurrent_stacks;
- stub_params->runtime.gnvs_ptr = (uintptr_t)acpi_get_gnvs();
printk(BIOS_DEBUG, "%s: stack_end = 0x%lx\n",
__func__, stub_params->stack_top - total_stack_size);
@@ -443,24 +437,10 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
"%s: stack_top = 0x%x\n", __func__, stub_params->stack_top);
printk(BIOS_DEBUG, "%s: stack_size = 0x%x\n",
__func__, stub_params->stack_size);
- printk(BIOS_DEBUG, "%s: runtime.smbase = 0x%x\n",
- __func__, stub_params->runtime.smbase);
printk(BIOS_DEBUG, "%s: runtime.start32_offset = 0x%x\n", __func__,
stub_params->start32_offset);
printk(BIOS_DEBUG, "%s: runtime.smm_size = 0x%zx\n",
__func__, smm_size);
- printk(BIOS_DEBUG, "%s: per_cpu_save_state_size = 0x%x\n",
- __func__, stub_params->runtime.save_state_size);
- printk(BIOS_DEBUG, "%s: num_cpus = 0x%x\n", __func__,
- stub_params->runtime.num_cpus);
- printk(BIOS_DEBUG, "%s: total_save_state_size = 0x%x\n",
- __func__, (stub_params->runtime.save_state_size *
- stub_params->runtime.num_cpus));
- total_size_all = stub_params->stack_size +
- (stub_params->runtime.save_state_size *
- stub_params->runtime.num_cpus);
- printk(BIOS_DEBUG, "%s: total_size_all = 0x%x\n", __func__,
- total_size_all);
/* Initialize the APIC id to CPU number table to be 1:1 */
for (i = 0; i < params->num_concurrent_stacks; i++)
diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S
index 10560b1593..7c09e04108 100644
--- a/src/cpu/x86/smm/smm_stub.S
+++ b/src/cpu/x86/smm/smm_stub.S
@@ -34,20 +34,6 @@ apic_to_cpu_num:
start32_offset:
.long smm_trampoline32 - _start
-/* struct smm_runtime begins here. */
-smm_runtime:
-smbase:
-.long 0
-smm_size:
-.long 0
-save_state_size:
-.long 0
-num_cpus:
-.long 0
-gnvs_ptr:
-.long 0
-/* end struct smm_runtime */
-
.data
/* Provide fallback stack to use when a valid CPU number cannot be found. */
fallback_stack_bottom:
@@ -200,9 +186,7 @@ smm_trampoline32:
* c_handler(&arg)
*/
#ifdef __x86_64__
- push $0x0 /* Padding */
push %rbx /* uintptr_t *canary */
- push $(smm_runtime)
push %rcx /* size_t cpu */
mov %rsp, %rdi /* *arg */
@@ -228,8 +212,8 @@ smm_trampoline32:
wrmsr
#else
+ push $0x0 /* Padding */
push %ebx /* uintptr_t *canary */
- push $(smm_runtime)
push %ecx /* size_t cpu */
push %esp /* smm_module_params *arg (allocated on stack). */
mov c_handler, %eax