From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web09.26612.1656212770864849318 for ; Sat, 25 Jun 2022 20:06:21 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=IG5F4yTc; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656212781; x=1687748781; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RHBVtkAKRve8fe6JdLPKvyswP/6jU2nhcLQsbv28X9o=; b=IG5F4yTch6qkoyVr30jFbC9YXlZktqV0wgkKID5bdURyaMyJBnbngu8S /Fydw45OG5p0gW3VvF8zO599WcdaU2hemTuiMiDkr/0bCdFOtKKNhodca UnQ/TPlwJ/AhqjiAHvzMMOK7YJWrP0EWmMjwAwEIa6/ZMwvzFsj7TEnJQ 17W/N82Qy3/a1veM8N3uJw9ccTeAdFQT0Jvh1MoKQy6Uq9D+q55hzLmet zFfFqu12AvjXhMw6L60H1wWPkbhWmm0Y8ANOOS/b8JBAi1OsrgejRch/i Ybgn1496O8W4JhwLwzIhoz4zYJoHMy0q2NGOa8bfU3mz1aW2eOkwYXbg1 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10389"; a="367554882" X-IronPort-AV: E=Sophos;i="5.92,223,1650956400"; d="scan'208";a="367554882" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2022 20:06:21 -0700 X-IronPort-AV: E=Sophos;i="5.92,223,1650956400"; d="scan'208";a="645862140" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.30.236]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2022 20:06:19 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [PATCH V2 6/8] OvmfPkg: Reserve and init EmuVariableNvStore in Pei-less Startup Date: Sun, 26 Jun 2022 11:05:55 +0800 Message-Id: <760d2a35647b7b5360da20760865aa729b6cb0e5.1656210686.git.min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Min M Xu 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 Cc: James Bottomley [jejb] Cc: Jiewen Yao [jyao1] Cc: Tom Lendacky [tlendacky] Cc: Gerd Hoffmann Signed-off-by: Min Xu --- 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 fdfefd00d732..663d5dacd3da 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