public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min M Xu <min.m.xu@intel.com>,
	Erdem Aktas <erdemaktas@google.com>,
	James Bottomley <jejb@linux.ibm.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH V4 5/8] OvmfPkg: Reserve and init EmuVariableNvStore in Pei-less Startup
Date: Fri,  1 Jul 2022 07:29:14 +0800	[thread overview]
Message-ID: <0586936abdc27ab58302ae0a8630d4e598e8067c.1656630360.git.min.m.xu@intel.com> (raw)
In-Reply-To: <cover.1656630360.git.min.m.xu@intel.com>

From: Min M Xu <min.m.xu@intel.com>

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>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
 OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
index 7502ec44669e..380e71597206 100644
--- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
+++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c
@@ -42,6 +42,7 @@ InitializePlatform (
   )
 {
   UINT32  LowerMemorySize;
+  VOID    *VariableStore;
 
   DEBUG ((DEBUG_INFO, "InitializePlatform in Pei-less boot\n"));
   PlatformDebugDumpCmos ();
@@ -79,6 +80,12 @@ InitializePlatform (
     LowerMemorySize
     ));
 
+  VariableStore                                  = PlatformReserveEmuVariableNvStore ();
+  PlatformInfoHob->PcdEmuVariableNvStoreReserved = (UINT64)(UINTN)VariableStore;
+ #ifdef SECURE_BOOT_FEATURE_ENABLED
+  PlatformInitEmuVariableNvStore (VariableStore);
+ #endif
+
   if (TdIsEnabled ()) {
     PlatformTdxPublishRamRegions ();
   } else {
-- 
2.29.2.windows.2


  parent reply	other threads:[~2022-06-30 23:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 23:29 [PATCH V4 0/8] Enable secure-boot when lauch OVMF with -bios parameter Min Xu
2022-06-30 23:29 ` [PATCH V4 1/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib Min Xu
2022-09-05 11:54   ` [edk2-devel] " Ard Biesheuvel
2022-06-30 23:29 ` [PATCH V4 2/8] OvmfPkg/PeilessStartupLib: Delete TdxValidateCfv Min Xu
2022-06-30 23:29 ` [PATCH V4 3/8] OvmfPkg/PlatformInitLib: Add functions for EmuVariableNvStore Min Xu
2022-06-30 23:29 ` [PATCH V4 4/8] OvmfPkg/PlatformPei: Update ReserveEmuVariableNvStore Min Xu
2022-06-30 23:29 ` Min Xu [this message]
2022-06-30 23:29 ` [PATCH V4 6/8] OvmfPkg/NvVarsFileLib: Shortcut ConnectNvVarsToFileSystem in secure-boot Min Xu
2022-06-30 23:29 ` [PATCH V4 7/8] OvmfPkg/TdxDxe: Set PcdEmuVariableNvStoreReserved Min Xu
2022-06-30 23:29 ` [PATCH V4 8/8] OvmfPkg: Add build-flag SECURE_BOOT_FEATURE_ENABLED Min Xu
2022-07-20  6:38 ` [PATCH V4 0/8] Enable secure-boot when lauch OVMF with -bios parameter Min Xu
2022-07-20  8:24   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0586936abdc27ab58302ae0a8630d4e598e8067c.1656630360.git.min.m.xu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox