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>
This commit is contained in:
parent
6f9b1a9049
commit
50e849fc9b
|
@ -709,15 +709,12 @@ static void smm_enable(void)
|
||||||
static void asmlinkage smm_do_relocation(void *arg)
|
static void asmlinkage smm_do_relocation(void *arg)
|
||||||
{
|
{
|
||||||
const struct smm_module_params *p;
|
const struct smm_module_params *p;
|
||||||
const struct smm_runtime *runtime;
|
|
||||||
int cpu;
|
int cpu;
|
||||||
uintptr_t curr_smbase;
|
const uintptr_t curr_smbase = SMM_DEFAULT_BASE;
|
||||||
uintptr_t perm_smbase;
|
uintptr_t perm_smbase;
|
||||||
|
|
||||||
p = arg;
|
p = arg;
|
||||||
runtime = p->runtime;
|
|
||||||
cpu = p->cpu;
|
cpu = p->cpu;
|
||||||
curr_smbase = runtime->smbase;
|
|
||||||
|
|
||||||
if (cpu >= CONFIG_MAX_CPUS) {
|
if (cpu >= CONFIG_MAX_CPUS) {
|
||||||
printk(BIOS_CRIT,
|
printk(BIOS_CRIT,
|
||||||
|
|
|
@ -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->c_handler = (uintptr_t)params->handler;
|
||||||
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;
|
||||||
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 */
|
/* Initialize the APIC id to CPU number table to be 1:1 */
|
||||||
for (i = 0; i < params->num_concurrent_stacks; i++)
|
for (i = 0; i < params->num_concurrent_stacks; i++)
|
||||||
|
|
|
@ -342,7 +342,6 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
|
||||||
size_t i;
|
size_t i;
|
||||||
struct smm_stub_params *stub_params;
|
struct smm_stub_params *stub_params;
|
||||||
struct rmodule smm_stub;
|
struct rmodule smm_stub;
|
||||||
unsigned int total_size_all;
|
|
||||||
base = smbase;
|
base = smbase;
|
||||||
size = smm_size;
|
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->c_handler = (uintptr_t)params->handler;
|
||||||
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;
|
||||||
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",
|
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);
|
||||||
|
@ -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);
|
"%s: stack_top = 0x%x\n", __func__, stub_params->stack_top);
|
||||||
printk(BIOS_DEBUG, "%s: stack_size = 0x%x\n",
|
printk(BIOS_DEBUG, "%s: stack_size = 0x%x\n",
|
||||||
__func__, stub_params->stack_size);
|
__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__,
|
printk(BIOS_DEBUG, "%s: runtime.start32_offset = 0x%x\n", __func__,
|
||||||
stub_params->start32_offset);
|
stub_params->start32_offset);
|
||||||
printk(BIOS_DEBUG, "%s: runtime.smm_size = 0x%zx\n",
|
printk(BIOS_DEBUG, "%s: runtime.smm_size = 0x%zx\n",
|
||||||
__func__, smm_size);
|
__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 */
|
/* Initialize the APIC id to CPU number table to be 1:1 */
|
||||||
for (i = 0; i < params->num_concurrent_stacks; i++)
|
for (i = 0; i < params->num_concurrent_stacks; i++)
|
||||||
|
|
|
@ -34,20 +34,6 @@ apic_to_cpu_num:
|
||||||
start32_offset:
|
start32_offset:
|
||||||
.long smm_trampoline32 - _start
|
.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
|
.data
|
||||||
/* Provide fallback stack to use when a valid CPU number cannot be found. */
|
/* Provide fallback stack to use when a valid CPU number cannot be found. */
|
||||||
fallback_stack_bottom:
|
fallback_stack_bottom:
|
||||||
|
@ -200,9 +186,7 @@ smm_trampoline32:
|
||||||
* c_handler(&arg)
|
* c_handler(&arg)
|
||||||
*/
|
*/
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
push $0x0 /* Padding */
|
|
||||||
push %rbx /* uintptr_t *canary */
|
push %rbx /* uintptr_t *canary */
|
||||||
push $(smm_runtime)
|
|
||||||
push %rcx /* size_t cpu */
|
push %rcx /* size_t cpu */
|
||||||
|
|
||||||
mov %rsp, %rdi /* *arg */
|
mov %rsp, %rdi /* *arg */
|
||||||
|
@ -228,8 +212,8 @@ smm_trampoline32:
|
||||||
wrmsr
|
wrmsr
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
push $0x0 /* Padding */
|
||||||
push %ebx /* uintptr_t *canary */
|
push %ebx /* uintptr_t *canary */
|
||||||
push $(smm_runtime)
|
|
||||||
push %ecx /* size_t cpu */
|
push %ecx /* size_t cpu */
|
||||||
push %esp /* smm_module_params *arg (allocated on stack). */
|
push %esp /* smm_module_params *arg (allocated on stack). */
|
||||||
mov c_handler, %eax
|
mov c_handler, %eax
|
||||||
|
|
|
@ -64,7 +64,6 @@ struct smm_runtime {
|
||||||
|
|
||||||
struct smm_module_params {
|
struct smm_module_params {
|
||||||
size_t cpu;
|
size_t cpu;
|
||||||
const struct smm_runtime *runtime;
|
|
||||||
/* A canary value that has been placed at the end of the stack.
|
/* A canary value that has been placed at the end of the stack.
|
||||||
* If (uintptr_t)canary != *canary then a stack overflow has occurred.
|
* If (uintptr_t)canary != *canary then a stack overflow has occurred.
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +87,6 @@ struct smm_stub_params {
|
||||||
u8 apic_id_to_cpu[CONFIG_MAX_CPUS];
|
u8 apic_id_to_cpu[CONFIG_MAX_CPUS];
|
||||||
/* STM's 32bit entry into SMI handler */
|
/* STM's 32bit entry into SMI handler */
|
||||||
u32 start32_offset;
|
u32 start32_offset;
|
||||||
struct smm_runtime runtime;
|
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
/* smm_handler_t is called with arg of smm_module_params pointer. */
|
/* smm_handler_t is called with arg of smm_module_params pointer. */
|
||||||
|
|
Loading…
Reference in New Issue