summaryrefslogtreecommitdiffstats
path: root/OvmfPkg
diff options
context:
space:
mode:
authorCeping Sun <cepingx.sun@intel.com>2024-08-15 05:10:06 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-08-29 01:53:14 +0000
commit383f729ac096b8deb279933fce86e83a5f7f5ec7 (patch)
tree51998bfa3064bbf7afcf329430b7b2c22d0946f5 /OvmfPkg
parent9cd66aca1a54b10dd3f6adcfef8d784281385a2c (diff)
downloadedk2-383f729ac096b8deb279933fce86e83a5f7f5ec7.tar.gz
edk2-383f729ac096b8deb279933fce86e83a5f7f5ec7.tar.bz2
edk2-383f729ac096b8deb279933fce86e83a5f7f5ec7.zip
OvmfPkg/PlatformInitLib: Reserve Sec Page Tables in TDVF
In the system boot phase, if OS postpone onlining some CPU until later, the sec page tables could be overwritten. So, TDVF needs to reserve the initial page tables that would be used by APs on Mailbox wakeup. Cc: Erdem Aktas <erdemaktas@google.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Elena Reshetova <elena.reshetova@intel.com> Cc: Kirill A Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
Diffstat (limited to 'OvmfPkg')
-rw-r--r--OvmfPkg/Library/PlatformInitLib/IntelTdx.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
index e561cee30b..12e4501c5b 100644
--- a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
+++ b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
@@ -154,6 +154,18 @@ PlatformTdxPublishRamRegions (
TransferTdxHobList ();
//
+ // Reserve the initial page tables built by the reset vector code.
+ //
+ // Since this memory range will be used by APs on Mailbox
+ // wakeup, it must be reserved as ACPI NVS.
+ //
+ BuildMemoryAllocationHob (
+ (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfSecPageTablesBase),
+ (UINT64)(UINTN)PcdGet32 (PcdOvmfSecPageTablesSize),
+ EfiACPIMemoryNVS
+ );
+
+ //
// The memory region defined by PcdOvmfSecGhcbBackupBase is pre-allocated by
// host VMM and used as the td mailbox at the beginning of system boot.
//