Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58148 )
Change subject: cpu/x86/{mp_init,smm}: Remove cpu member from smm_module_params ......................................................................
cpu/x86/{mp_init,smm}: Remove cpu member from smm_module_params
This value can now be obtained by using cpu_info(). This also allows us to clean up the asm a bit too.
BUG=b:194391185, b:179699789 TEST=Boot guybrush to OS and verify all CPUs still function
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I67b31b6f2aea9e255db01ab29bd9a55416f67a7d --- M src/cpu/x86/mp_init.c M src/cpu/x86/smm/smm_module_handler.c M src/cpu/x86/smm/smm_stub.S M src/include/cpu/x86/smm.h 4 files changed, 5 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/58148/1
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index 81ce101..8993d2d 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -720,14 +720,10 @@ */ static void asmlinkage smm_do_relocation(void *arg) { - const struct smm_module_params *p; - int cpu; + int cpu = cpu_info()->index; const uintptr_t curr_smbase = SMM_DEFAULT_BASE; uintptr_t perm_smbase;
- p = arg; - cpu = p->cpu; - if (cpu >= CONFIG_MAX_CPUS) { printk(BIOS_CRIT, "Invalid CPU number assigned in SMM stub: %d\n", cpu); @@ -756,7 +752,7 @@ mseg = mp_state.perm_smbase + (mp_state.perm_smsize - CONFIG_MSEG_SIZE);
- stm_setup(mseg, p->cpu, + stm_setup(mseg, cpu, perm_smbase, mp_state.perm_smbase, mp_state.reloc_start32_offset); diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c index f9ebba4..d04af40 100644 --- a/src/cpu/x86/smm/smm_module_handler.c +++ b/src/cpu/x86/smm/smm_module_handler.c @@ -119,12 +119,11 @@ asmlinkage void smm_handler_start(void *arg) { const struct smm_module_params *p; - int cpu; + int cpu = cpu_info()->index; uintptr_t actual_canary; uintptr_t expected_canary;
p = arg; - cpu = p->cpu; expected_canary = (uintptr_t)p->canary;
/* Make sure to set the global runtime. It's OK to race as the value diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S index 60bde99..3e7a158 100644 --- a/src/cpu/x86/smm/smm_stub.S +++ b/src/cpu/x86/smm/smm_stub.S @@ -211,7 +211,6 @@ andl $0xfffffff0, %esp
#if ENV_X86_64 - mov %ecx, %edi /* Backup IA32_EFER. Preserves ebx. */ movl $(IA32_EFER), %ecx rdmsr @@ -220,7 +219,6 @@
/* entry64.inc preserves ebx, esi, edi */ #include <cpu/x86/64bit/entry64.inc> - mov %edi, %ecx
#endif
@@ -230,8 +228,8 @@ * c_handler(&arg) */ #if ENV_X86_64 + push $0x0 /* Padding */ push %rbx /* uintptr_t *canary */ - push %rcx /* size_t cpu */
mov %rsp, %rdi /* *arg */
@@ -257,8 +255,8 @@
#else push $0x0 /* Padding */ + push $0x0 /* Padding */ push %ebx /* uintptr_t *canary */ - push %ecx /* size_t cpu */ push %esp /* smm_module_params *arg (allocated on stack). */ mov c_handler, %eax call *%eax diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h index 08404d0..61c6e52 100644 --- a/src/include/cpu/x86/smm.h +++ b/src/include/cpu/x86/smm.h @@ -65,7 +65,6 @@ } __packed;
struct smm_module_params { - size_t cpu; /* A canary value that has been placed at the end of the stack. * If (uintptr_t)canary != *canary then a stack overflow has occurred. */