From d205cf7e4ef6ebec49d45ec97f501f7de843ac94 Mon Sep 17 00:00:00 2001 From: "Eugene D. Myers" Date: Thu, 2 Nov 2023 13:34:56 -0700 Subject: cpu/x86/smm: Fix get_save_state calculation When the SMI transfer monitor (STM) is configured, get_save_state returns an incorrect pointer to the cpu save state because the size (rounded up to 0x100) of the processor System Management Mode (SMM) descriptor needs to be subtracted out in this case. This patch addresses the issue identified in CB:76601, which means that SMMSTOREv2 now works with the STM. Thanks to Jeremy Compostella for suggesting this version of the patch. Resolves: https://ticket.coreboot.org/issues/511 Change-Id: I0233c6d13bdffb3853845ac6ef25c066deaab747 Signed-off-by: Eugene D. Myers Reviewed-on: https://review.coreboot.org/c/coreboot/+/78889 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/cpu/x86/mp_init.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/cpu/x86/mp_init.c') diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index 642667b41b..d3af6ecc8f 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -1087,10 +1087,7 @@ static void fill_mp_state_smm(struct mp_state *state, const struct mp_ops *ops) /* * Make sure there is enough room for the SMM descriptor */ - if (CONFIG(STM)) { - state->smm_save_state_size += - ALIGN_UP(sizeof(TXT_PROCESSOR_SMM_DESCRIPTOR), 0x100); - } + state->smm_save_state_size += STM_PSD_SIZE; /* * Default to smm_initiate_relocation() if trigger callback isn't -- cgit v1.2.3