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>
This commit is contained in:
Ceping Sun 2024-08-15 05:10:06 +08:00 committed by mergify[bot]
parent 9cd66aca1a
commit 383f729ac0
1 changed files with 12 additions and 0 deletions

View File

@ -153,6 +153,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.