From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.303.1662438976985344787 for ; Mon, 05 Sep 2022 21:36:25 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=PJgCwWIx; spf=permerror, err=too many SPF records (domain: intel.com, ip: 192.55.52.115, 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=1662438985; x=1693974985; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ykp+BWbed0EeJK0A2FQd+jOi3YvHVdP/oExA0bx3gzY=; b=PJgCwWIxEN5XpIExtFp202UZOocpZUQCIagzYAs4VOTH5/xlFRvSHTfz n/EzQTsmj2dRD5m1ZipbNpQS6rO8S/zLzaI+JTG6F9MHzkJt7f8E6nqZJ n1MggrCx/DmuQXN0KSVr7XNlBr2opkV/sdRNx4z97sCCUMJYb55xaUWos TC65/oRFh6qGCcz6hxW2dv7Ssq7YSj4IQut6fmpY6CM4TbUYYmTdrA0AF alS2k4Y4TWJQUoIOFLMaKPiUdtGiE0VFeoZKuDenf5kIh/vgsuWF18kbw GuHxOUW0lsX9FvHD234S00S6pOVmqOaNvavxihSqxeNJE277TxuB+Ejit A==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="296502090" X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="296502090" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 21:36:25 -0700 X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="675517321" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.238.4.118]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 21:36:23 -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 V5 5/8] OvmfPkg: Reserve and init EmuVariableNvStore in Pei-less Startup Date: Tue, 6 Sep 2022 12:35:57 +0800 Message-Id: <5ea1dbaa18b8358d05c3498dc5a049a9d7ad8d82.1662423715.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 Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Acked-by: 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 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