Skip to content

Commit ee91d9e

Browse files
mxu9mergify[bot]
authored andcommitted
OvmfPkg: Reserve and init EmuVariableNvStore in Pei-less Startup
EmuVariableNvStore is reserved and init with below 2 functions defined in PlatformInitLib: - PlatformReserveEmuVariableNvStore - PlatformInitEmuVariableNvStore PlatformInitEmuVariableNvStore works when secure boot feature is enabled. This is because secure boot needs the EFI variables (PK/KEK/DB/DBX, etc) and EmuVariableNvStore is cleared when OVMF is launched with -bios parameter. Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
1 parent 58eb851 commit ee91d9e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ InitializePlatform (
4242
)
4343
{
4444
UINT32 LowerMemorySize;
45+
VOID *VariableStore;
4546

4647
DEBUG ((DEBUG_INFO, "InitializePlatform in Pei-less boot\n"));
4748
PlatformDebugDumpCmos ();
@@ -79,6 +80,12 @@ InitializePlatform (
7980
LowerMemorySize
8081
));
8182

83+
VariableStore = PlatformReserveEmuVariableNvStore ();
84+
PlatformInfoHob->PcdEmuVariableNvStoreReserved = (UINT64)(UINTN)VariableStore;
85+
#ifdef SECURE_BOOT_FEATURE_ENABLED
86+
PlatformInitEmuVariableNvStore (VariableStore);
87+
#endif
88+
8289
if (TdIsEnabled ()) {
8390
PlatformTdxPublishRamRegions ();
8491
} else {

0 commit comments

Comments
 (0)