mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
OvmfPkg/PlatformPei: retain SoftReserved memory under SEV-SNP
Soft Reserved (Specific Purpose Memory) regions carry the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attribute, which the OS sees as EFI_MEMORY_SP (E820 Soft Reserved). Under SEV-SNP this does not reach the guest: AmdSevSnpInitialize() changes every EFI_RESOURCE_SYSTEM_MEMORY HOB above 4GB to EFI_RESOURCE_MEMORY_UNACCEPTED, and AcceptAllMemory() later re-adds the region as plain system memory without EFI_MEMORY_SP, so the guest sees ordinary RAM instead of Soft Reserved. Exclude SPECIAL_PURPOSE regions from the unaccepted conversion so they keep the EFI_RESOURCE_SYSTEM_MEMORY type and are pre-validated in place, like sub-4GB memory. Signed-off-by: FangSheng Huang <FangSheng.Huang@amd.com>
This commit is contained in:
parent
9e3e68218c
commit
6c6d0a72c2
1 changed files with 11 additions and 1 deletions
|
|
@ -148,7 +148,17 @@ AmdSevSnpInitialize (
|
|||
ResourceHob = Hob.ResourceDescriptor;
|
||||
|
||||
if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
|
||||
if (ResourceHob->PhysicalStart >= SIZE_4GB) {
|
||||
//
|
||||
// Defer acceptance of memory above 4GB, which the OS accepts lazily.
|
||||
// Specific Purpose Memory (E820 Soft Reserved) is excepted: it must
|
||||
// keep the EFI_RESOURCE_SYSTEM_MEMORY type so its SPECIAL_PURPOSE
|
||||
// attribute reaches the EFI memory map, and it is never handed to the
|
||||
// OS allocator, so it would never be accepted lazily. Pre-validate
|
||||
// it in place, like sub-4GB memory.
|
||||
//
|
||||
if ((ResourceHob->PhysicalStart >= SIZE_4GB) &&
|
||||
((ResourceHob->ResourceAttribute & EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE) == 0))
|
||||
{
|
||||
ResourceHob->ResourceType = EFI_RESOURCE_MEMORY_UNACCEPTED;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue