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/+/61689
to review the following change.
Change subject: security/intel/stm: Make STM setup MP safe ......................................................................
security/intel/stm: Make STM setup MP safe
Some processor families allow for SMM setup to be done in parallel.
On processors that have this feature, the BIOS resource list becomes unusable for some processors during STM startup.
This patch covers two cases: (1) The BIOS resource list becomes twice as long because the smm_relocation function is called twice - this is resolved by recreating the list on each invocation. (2) Not all processors receive the correct resource list pointer - this is resolved by having every processor execute the pointer calculation code, which is a lot faster then forcing all processors to spin lock waiting for this value to be calculated.
This patch has been tested on a Purism L1UM-1X8C and Purism 15v4.
Signed-off-by: Eugene Myers cedarhouse@comcast.net Change-Id: I7619038edc78f306bd7eb95844bd1598766f8b37 --- M src/security/intel/stm/StmPlatformResource.c M src/security/intel/stm/StmPlatformSmm.c 2 files changed, 11 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/61689/1
diff --git a/src/security/intel/stm/StmPlatformResource.c b/src/security/intel/stm/StmPlatformResource.c index 75d52a2..4e56e2e 100644 --- a/src/security/intel/stm/StmPlatformResource.c +++ b/src/security/intel/stm/StmPlatformResource.c @@ -167,9 +167,14 @@ /* * Add resources to BIOS resource database. */ + +extern uint8_t *m_stm_resources_ptr; + void add_resources_cmd(void) {
+ m_stm_resources_ptr = NULL; + add_simple_resources();
add_msr_resources(); diff --git a/src/security/intel/stm/StmPlatformSmm.c b/src/security/intel/stm/StmPlatformSmm.c index ef02ae3..bcf935c 100644 --- a/src/security/intel/stm/StmPlatformSmm.c +++ b/src/security/intel/stm/StmPlatformSmm.c @@ -155,12 +155,15 @@ return; }
+ // This code moved here because paralled SMM set can cause + // some processor to receive a bad value + // calculate the location in SMRAM + addr_calc = mseg - CONFIG_BIOS_RESOURCE_LIST_SIZE; + stm_resource_heap = (uint8_t *) addr_calc; + if (cpu == 0) {
// need to create the BIOS resource list once - // first calculate the location in SMRAM - addr_calc = mseg - CONFIG_BIOS_RESOURCE_LIST_SIZE; - stm_resource_heap = (uint8_t *) addr_calc; printk(BIOS_DEBUG, "STM: stm_resource_heap located at %p\n", stm_resource_heap); //setup the list