Attention is currently required from: Rocky Phagura. Hello Rocky Phagura,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/52518
to review the following change.
Change subject: src/cpu/x86/smm: move console init to thread safe section ......................................................................
src/cpu/x86/smm: move console init to thread safe section
This patch moves the console init code in SMM to a thread safe location which is right after obtaining the lock.
Tested on DeltaLake mainboard with SMM enabled.
Change-Id: I7e8af35d1cde78b327144b6a9da528ae7870e874 Signed-off-by: Rocky Phagura rphagura@fb.com --- M src/cpu/x86/smm/smm_module_handler.c 1 file changed, 10 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/52518/1
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c index f7cf928..3b10d13 100644 --- a/src/cpu/x86/smm/smm_module_handler.c +++ b/src/cpu/x86/smm/smm_module_handler.c @@ -131,14 +131,10 @@ * will be the same across CPUs as well as multiple SMIs. */ gnvs = (void *)(uintptr_t)smm_runtime.gnvs_ptr;
- if (cpu >= CONFIG_MAX_CPUS) { - console_init(); - printk(BIOS_CRIT, - "Invalid CPU number assigned in SMM stub: %d\n", cpu); - return; - } - - /* Are we ok to execute the handler? */ + /* + * Only thread safe code should be executed before obtaining + * a lock + */ if (!smi_obtain_lock()) { /* For security reasons we don't release the other CPUs * until the CPU with the lock is actually done */ @@ -150,6 +146,12 @@ return; }
+ if (cpu > CONFIG_MAX_CPUS) { + console_init(); + printk(BIOS_CRIT, + "Invalid CPU number assigned in SMM stub: %d\n", cpu); + return; + } smi_backup_pci_address();
console_init();