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/include/cpu/x86/smm.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/include') diff --git a/src/include/cpu/x86/smm.h b/src/include/cpu/x86/smm.h index 68c7c3bba7..a240ac2f51 100644 --- a/src/include/cpu/x86/smm.h +++ b/src/include/cpu/x86/smm.h @@ -33,6 +33,15 @@ #define SMM_PCI_RESOURCE_STORE_NUM_RESOURCES 6 +/* + * SMI Transfer Monitor (STM) descriptor reserved in SMM save state. + */ +#if CONFIG(STM) +#define STM_PSD_SIZE ALIGN_UP(sizeof(TXT_PROCESSOR_SMM_DESCRIPTOR), 0x100) +#else +#define STM_PSD_SIZE 0 +#endif + /* Send cmd to APM_CNT with HAVE_SMI_HANDLER checking. */ int apm_control(u8 cmd); u8 apm_get_apmc(void); -- cgit v1.2.3