Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/75405?usp=email )
(
6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: soc/amd/smm: Sanity check the SMM TSEG size ......................................................................
soc/amd/smm: Sanity check the SMM TSEG size
As per AMD64 Architecture Programmer's Manual, section 10.2.5 SMRAM Protected Areas: The TSEG range must be aligned to a 128 Kbyte boundary and the minimum TSEG size is 128 Kbytes.
The SMM TSEG size should be less than SMM reserved size.
AMD TSEG mask works like an MTRR. It needs to be aligned to it's size and it's size needs to be a power of 2.
Change-Id: Ic4f557c7b77db6fc5ab2783ca4e2ebe7a4476e85 Signed-off-by: Zheng Bao fishbaozi@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/75405 Reviewed-by: Paul Menzel paulepanter@mailbox.org Reviewed-by: Himanshu Sahdev himanshu.sahdev@intel.com Reviewed-by: Arthur Heymans arthur@aheymans.xyz Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Eric Lai eric_lai@quanta.corp-partner.google.com --- M src/soc/amd/common/block/include/amdblocks/smm.h 1 file changed, 12 insertions(+), 0 deletions(-)
Approvals: Eric Lai: Looks good to me, but someone else must approve Arthur Heymans: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve Himanshu Sahdev: Looks good to me, but someone else must approve build bot (Jenkins): Verified
diff --git a/src/soc/amd/common/block/include/amdblocks/smm.h b/src/soc/amd/common/block/include/amdblocks/smm.h index fb2e488..97b11be 100644 --- a/src/soc/amd/common/block/include/amdblocks/smm.h +++ b/src/soc/amd/common/block/include/amdblocks/smm.h @@ -15,4 +15,16 @@ /* See SMITYPE_* for list possible of events. GEVENTS are handled with mainboard_smi_gpi. */ void mainboard_handle_smi(int event);
+#if CONFIG_SMM_TSEG_SIZE != 0 +#if (CONFIG_SMM_TSEG_SIZE <= CONFIG_SMM_RESERVED_SIZE) +# error "CONFIG_SMM_TSEG_SIZE <= CONFIG_SMM_RESERVED_SIZE" +#endif +#if (CONFIG_SMM_TSEG_SIZE < 0x20000) +# error "CONFIG_SMM_TSEG_SIZE must at least be 128KiB" +#endif +#if ((CONFIG_SMM_TSEG_SIZE & (CONFIG_SMM_TSEG_SIZE - 1)) != 0) +# error "CONFIG_SMM_TSEG_SIZE is not a power of 2" +#endif +#endif + #endif