diff options
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/amd/common/block/cpu/smm/finalize.c | 22 | ||||
-rw-r--r-- | src/soc/amd/common/block/cpu/smm/smm_helper.c | 14 | ||||
-rw-r--r-- | src/soc/amd/common/block/cpu/smm/smm_relocate.c | 11 | ||||
-rw-r--r-- | src/soc/amd/common/block/include/amdblocks/smm.h | 2 |
4 files changed, 11 insertions, 38 deletions
diff --git a/src/soc/amd/common/block/cpu/smm/finalize.c b/src/soc/amd/common/block/cpu/smm/finalize.c index d0fe4bc9d6..07196d13ca 100644 --- a/src/soc/amd/common/block/cpu/smm/finalize.c +++ b/src/soc/amd/common/block/cpu/smm/finalize.c @@ -10,30 +10,8 @@ #include <cpu/x86/msr.h> #include <types.h> -static void per_core_finalize(void *unused) -{ - /* Finalize SMM settings */ - if (is_smm_locked()) /* Skip if already locked, avoid GPF */ - return; - - if (CONFIG(HAVE_SMI_HANDLER)) - tseg_valid(); - - lock_smm(); -} - -static void finalize_cores(void) -{ - printk(BIOS_SPEW, "Lock SMM configuration\n"); - - if (mp_run_on_all_cpus(per_core_finalize, NULL) != CB_SUCCESS) - printk(BIOS_WARNING, "Failed to finalize all cores\n"); -} - static void soc_finalize(void *unused) { - finalize_cores(); - if (!acpi_is_wakeup_s3()) { acpi_clear_pm_gpe_status(); diff --git a/src/soc/amd/common/block/cpu/smm/smm_helper.c b/src/soc/amd/common/block/cpu/smm/smm_helper.c index e87d12c641..a6e7d2dac5 100644 --- a/src/soc/amd/common/block/cpu/smm/smm_helper.c +++ b/src/soc/amd/common/block/cpu/smm/smm_helper.c @@ -30,20 +30,6 @@ void clear_tvalid(void) wrmsr(SMM_MASK_MSR, mask); } -void tseg_valid(void) -{ - msr_t mask = rdmsr(SMM_MASK_MSR); - mask.lo |= SMM_TSEG_VALID; - - wrmsr(SMM_MASK_MSR, mask); -} - -bool is_smm_locked(void) -{ - msr_t hwcr = rdmsr(HWCR_MSR); - return hwcr.lo & SMM_LOCK ? true : false; -} - void lock_smm(void) { msr_t hwcr = rdmsr(HWCR_MSR); diff --git a/src/soc/amd/common/block/cpu/smm/smm_relocate.c b/src/soc/amd/common/block/cpu/smm/smm_relocate.c index e464cfca6d..87636df850 100644 --- a/src/soc/amd/common/block/cpu/smm/smm_relocate.c +++ b/src/soc/amd/common/block/cpu/smm/smm_relocate.c @@ -49,6 +49,14 @@ static void get_smm_info(uintptr_t *perm_smbase, size_t *perm_smsize, *smm_save_state_size = sizeof(amd64_smm_state_save_area_t); } +static void tseg_valid(void) +{ + msr_t mask = rdmsr(SMM_MASK_MSR); + mask.lo |= SMM_TSEG_VALID; + + wrmsr(SMM_MASK_MSR, mask); +} + static void smm_relocation_handler(int cpu, uintptr_t curr_smbase, uintptr_t staggered_smbase) { amd64_smm_state_save_area_t *smm_state; @@ -70,6 +78,9 @@ static void smm_relocation_handler(int cpu, uintptr_t curr_smbase, uintptr_t sta smm_state = (void *)(SMM_AMD64_SAVE_STATE_OFFSET + curr_smbase); smm_state->smbase = staggered_smbase; + + tseg_valid(); + lock_smm(); } const struct mp_ops amd_mp_ops_with_smm = { diff --git a/src/soc/amd/common/block/include/amdblocks/smm.h b/src/soc/amd/common/block/include/amdblocks/smm.h index f0a06bf015..2218385477 100644 --- a/src/soc/amd/common/block/include/amdblocks/smm.h +++ b/src/soc/amd/common/block/include/amdblocks/smm.h @@ -10,8 +10,6 @@ void *get_smi_source_handler(int source); void handle_smi_gsmi(void); void handle_smi_store(void); void clear_tvalid(void); -void tseg_valid(void); -bool is_smm_locked(void); void lock_smm(void); /* See SMITYPE_* for list possible of events. GEVENTS are handled with mainboard_smi_gpi. */ void mainboard_handle_smi(int event); |