mirror of https://github.com/acidanthera/audk.git
OvmfPkg/PlatformPei: mark cpuid and secrets memory reserved in EFI map
When SEV-SNP is active, the CPUID and Secrets memory range contains the information that is used during the VM boot. The content need to be persist across the kexec boot. Mark the memory range as Reserved in the EFI map so that guest OS or firmware does not use the range as a system RAM. Cc: Michael Roth <michael.roth@amd.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
This commit is contained in:
parent
b7b8872031
commit
ea3a12d970
|
@ -416,3 +416,34 @@ AmdSevInitialize (
|
|||
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
The function performs SEV specific region initialization.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SevInitializeRam (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
if (MemEncryptSevSnpIsEnabled ()) {
|
||||
//
|
||||
// If SEV-SNP is enabled, reserve the Secrets and CPUID memory area.
|
||||
//
|
||||
// This memory range is given to the PSP by the hypervisor to populate
|
||||
// the information used during the SNP VM boots, and it need to persist
|
||||
// across the kexec boots. Mark it as EfiReservedMemoryType so that
|
||||
// the guest firmware and OS does not use it as a system memory.
|
||||
//
|
||||
BuildMemoryAllocationHob (
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfSnpSecretsBase),
|
||||
(UINT64)(UINTN)PcdGet32 (PcdOvmfSnpSecretsSize),
|
||||
EfiReservedMemoryType
|
||||
);
|
||||
BuildMemoryAllocationHob (
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfCpuidBase),
|
||||
(UINT64)(UINTN)PcdGet32 (PcdOvmfCpuidSize),
|
||||
EfiReservedMemoryType
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -871,6 +871,8 @@ InitializeRamRegions (
|
|||
{
|
||||
QemuInitializeRam ();
|
||||
|
||||
SevInitializeRam ();
|
||||
|
||||
if (mS3Supported && (mBootMode != BOOT_ON_S3_RESUME)) {
|
||||
//
|
||||
// This is the memory range that will be used for PEI on S3 resume
|
||||
|
|
|
@ -104,6 +104,11 @@ AmdSevInitialize (
|
|||
|
||||
extern EFI_BOOT_MODE mBootMode;
|
||||
|
||||
VOID
|
||||
SevInitializeRam (
|
||||
VOID
|
||||
);
|
||||
|
||||
extern BOOLEAN mS3Supported;
|
||||
|
||||
extern UINT8 mPhysMemAddressWidth;
|
||||
|
|
|
@ -111,6 +111,8 @@
|
|||
gUefiCpuPkgTokenSpaceGuid.PcdGhcbHypervisorFeatures
|
||||
|
||||
[FixedPcd]
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidBase
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidSize
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
|
||||
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
|
||||
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
|
||||
|
@ -121,6 +123,8 @@
|
|||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBackupSize
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize
|
||||
|
||||
[FeaturePcd]
|
||||
gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable
|
||||
|
|
Loading…
Reference in New Issue