Attention is currently required from: Eugene Myers. Hello Eugene Myers,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/61688
to review the following change.
Change subject: security/intel/stm: Use correct SMBASE for SMM descriptor setup ......................................................................
security/intel/stm: Use correct SMBASE for SMM descriptor setup
CL:43684 (SMM module loader version 2) changed how the SMBASE is calculated.
This patch modifies setup_smm_descriptor to properly acquire the SMBASE.
This patch has been tested on a Purism L1UM-1X8C and a Purism 15v4.
Signed-off-by: Eugene Myers cedarhouse@comcast.net Change-Id: I1d62a36cdcbc20a19c42266164e612fb96f91953 --- M src/security/intel/stm/SmmStm.h M src/security/intel/stm/StmPlatformSmm.c 2 files changed, 6 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/61688/1
diff --git a/src/security/intel/stm/SmmStm.h b/src/security/intel/stm/SmmStm.h index b395493..8db770d 100644 --- a/src/security/intel/stm/SmmStm.h +++ b/src/security/intel/stm/SmmStm.h @@ -75,7 +75,7 @@ */ void *get_stm_resource(void);
-void setup_smm_descriptor(void *smbase, void *base_smbase, int32_t apic_id, +void setup_smm_descriptor(void *smbase, int32_t apic_id, int32_t entry32_off);
/* diff --git a/src/security/intel/stm/StmPlatformSmm.c b/src/security/intel/stm/StmPlatformSmm.c index cbb111a..ef02ae3 100644 --- a/src/security/intel/stm/StmPlatformSmm.c +++ b/src/security/intel/stm/StmPlatformSmm.c @@ -77,8 +77,7 @@ __asm__ __volatile__("sgdt %0" : "=m"(*gdtr)); }
-void setup_smm_descriptor(void *smbase, void *base_smbase, int32_t apic_id, - int32_t entry32_off) +void setup_smm_descriptor(void *smbase, int32_t apic_id, int32_t entry32_off) { struct descriptor gdtr; void *smbase_processor; @@ -103,7 +102,7 @@ psd->smm_descriptor_ver_minor = TXT_PROCESSOR_SMM_DESCRIPTOR_VERSION_MINOR; psd->smm_smi_handler_rip = - (uint64_t)((uintptr_t)base_smbase + SMM_ENTRY_OFFSET + + (uint64_t)((uintptr_t)smbase + SMM_ENTRY_OFFSET + entry32_off); psd->local_apic_id = apic_id; psd->size = sizeof(TXT_PROCESSOR_SMM_DESCRIPTOR); @@ -123,7 +122,7 @@ read_gdtr(&gdtr);
gdtr.base -= (uintptr_t) smbase_processor; - gdtr.base += (uintptr_t) base_smbase; + gdtr.base += (uintptr_t) smbase;
psd->smm_gdt_ptr = gdtr.base; psd->smm_gdt_size = gdtr.limit + 1; // the stm will subtract, so add @@ -183,8 +182,8 @@ cpu, MsegChk.hi, MsegChk.lo);
// setup the descriptor for this cpu - setup_smm_descriptor((void *)smbase, (void *) base_smbase, - cpu, offset32); + setup_smm_descriptor((void *)smbase, cpu, offset32); + } else { printk(BIOS_DEBUG, "STM: Error in STM load, STM not enabled: %d\n",