Skip to content

Commit

Permalink
QemuQ35Pkg/PlatformPei: Drop S3 and Lock Box support
Browse files Browse the repository at this point in the history
Removes platform initialization logic for S3 and the lock box.

Notably, the number of MMRAM regions is reduced from two to one since
the first MMRAM range was previously a 4KB page used to hold S3
resume structures.

The amount of ACPI NVS reservation is reduced substantially since
areas like the following do not need to be preserved for S3 resume:

- CPU AP stack buffers
- Temp RAM stack and heap
- GUIDed section extraction handlers
- Reset vector initial page tables

The lock box storage buffer is also not allocated at all. Previously,
it was allocated as boot services data (not ACPI NVS) since S3 was
never enabled. In any case, that space is no longer allocated.

Asserts are added in places through key control flow to alert a
developer if S3 is detected as enabled when it should not be.

Signed-off-by: Michael Kubacki <Michael.kubacki@microsoft.com>
  • Loading branch information
makubacki committed Sep 24, 2024
1 parent 4044593 commit d21b07f
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 339 deletions.
31 changes: 2 additions & 29 deletions Platforms/QemuQ35Pkg/PlatformPei/Fv.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,58 +25,31 @@ PeiFvInitialization (
VOID
)
{
BOOLEAN SecureS3Needed;

DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n"));

//
// Create a memory allocation HOB for the PEI FV.
//
// Allocate as ACPI NVS is S3 is supported
//
BuildMemoryAllocationHob (
PcdGet32 (PcdOvmfPeiMemFvBase),
PcdGet32 (PcdOvmfPeiMemFvSize),
mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
EfiBootServicesData
);

//
// Let DXE know about the DXE FV
//
BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));

SecureS3Needed = mS3Supported && FeaturePcdGet (PcdSmmSmramRequire);

//
// Create a memory allocation HOB for the DXE FV.
//
// If "secure" S3 is needed, then SEC will decompress both PEI and DXE
// firmware volumes at S3 resume too, hence we need to keep away the OS from
// DXEFV as well. Otherwise we only need to keep away DXE itself from the
// DXEFV area.
//
BuildMemoryAllocationHob (
PcdGet32 (PcdOvmfDxeMemFvBase),
PcdGet32 (PcdOvmfDxeMemFvSize),
SecureS3Needed ? EfiACPIMemoryNVS : EfiBootServicesData
EfiBootServicesData
);

//
// Additionally, said decompression will use temporary memory above the end
// of DXEFV, so let's keep away the OS from there too.
//
if (SecureS3Needed) {
UINT32 DxeMemFvEnd;

DxeMemFvEnd = PcdGet32 (PcdOvmfDxeMemFvBase) +
PcdGet32 (PcdOvmfDxeMemFvSize);
BuildMemoryAllocationHob (
DxeMemFvEnd,
PcdGet32 (PcdOvmfDecompressionScratchEnd) - DxeMemFvEnd,
EfiACPIMemoryNVS
);
}

//
// Let PEI know about the DXE FV so it can find the DXE Core
//
Expand Down
Loading

0 comments on commit d21b07f

Please sign in to comment.