cpu/x86/smm: reserve SMRAM for OPAL S3 state

Reserve a small persistent SMRAM subregion for OPAL S3 unlock state, so
the payload-provided OPAL secret can survive SMM handler reload on S3
resume.

Expose the region base/size to SMM via smm_runtime and provide an
accessor for SMM code. Clear the region on cold boot/reboot, but
preserve it when waking from S3.

TEST=tested with rest of patch train

Change-Id: Ib1e92edb31c845367afe6185e5fa18ab1bc71108
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91414
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Sean Rhodes 2026-02-13 20:58:00 +00:00 committed by Matt DeVillier
commit ce1db1f54a
5 changed files with 62 additions and 1 deletions

View file

@ -100,6 +100,10 @@ struct smm_runtime {
uintptr_t opal_s3_scratch_base;
size_t opal_s3_scratch_size;
#endif
#if CONFIG(SMM_OPAL_S3_STATE_SMRAM)
uintptr_t opal_s3_state_base;
size_t opal_s3_state_size;
#endif
} __packed;
struct smm_module_params {
@ -206,6 +210,8 @@ static inline void aseg_region(uintptr_t *start, size_t *size)
enum {
/* SMM handler area. */
SMM_SUBREGION_HANDLER,
/* Persistent OPAL S3 state area. */
SMM_SUBREGION_OPAL_S3_STATE,
/* SMM cache region. */
SMM_SUBREGION_CACHE,
/* Chipset specific area. */
@ -245,5 +251,8 @@ void smm_get_smmstore_com_buffer(uintptr_t *base, size_t *size);
#if CONFIG(SMM_OPAL_S3_SCRATCH_CBMEM)
void smm_get_opal_s3_scratch_buffer(uintptr_t *base, size_t *size);
#endif
#if CONFIG(SMM_OPAL_S3_STATE_SMRAM)
void smm_get_opal_s3_state_buffer(uintptr_t *base, size_t *size);
#endif
#endif /* CPU_X86_SMM_H */