\r
ASSERT_RETURN_ERROR (PcdStatus);\r
}\r
+\r
+/**\r
+ The function performs SEV specific region initialization.\r
+\r
+ **/\r
+VOID\r
+SevInitializeRam (\r
+ VOID\r
+ )\r
+{\r
+ if (MemEncryptSevSnpIsEnabled ()) {\r
+ //\r
+ // If SEV-SNP is enabled, reserve the Secrets and CPUID memory area.\r
+ //\r
+ // This memory range is given to the PSP by the hypervisor to populate\r
+ // the information used during the SNP VM boots, and it need to persist\r
+ // across the kexec boots. Mark it as EfiReservedMemoryType so that\r
+ // the guest firmware and OS does not use it as a system memory.\r
+ //\r
+ BuildMemoryAllocationHob (\r
+ (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfSnpSecretsBase),\r
+ (UINT64)(UINTN)PcdGet32 (PcdOvmfSnpSecretsSize),\r
+ EfiReservedMemoryType\r
+ );\r
+ BuildMemoryAllocationHob (\r
+ (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfCpuidBase),\r
+ (UINT64)(UINTN)PcdGet32 (PcdOvmfCpuidSize),\r
+ EfiReservedMemoryType\r
+ );\r
+ }\r
+}\r
gUefiCpuPkgTokenSpaceGuid.PcdGhcbHypervisorFeatures\r
\r
[FixedPcd]\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidBase\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidSize\r
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress\r
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS\r
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory\r
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBackupSize\r
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase\r
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsBase\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize\r
\r
[FeaturePcd]\r
gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable\r