From a0c618c2a25bef8e54aaa6224b234209515d6e8b Mon Sep 17 00:00:00 2001 From: Ceping Sun Date: Fri, 27 Sep 2024 13:53:24 +0800 Subject: [PATCH] OvmfPkg/PeilessStartupLib: Cache and measure FwCfg item Since OVMF would initialize the platform info with fwcfg, TDVF needs to cache and measure the fwcfg at first. Cc: Erdem Aktas Cc: Jiewen Yao Cc: Min Xu Cc: Gerd Hoffmann Cc: Elena Reshetova Signed-off-by: Min Xu Signed-off-by: Ceping Sun --- OvmfPkg/IntelTdx/IntelTdxX64.dsc | 3 ++- OvmfPkg/IntelTdx/Sec/SecMain.inf | 1 + OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc index 6d3e0a5f1c6e..03cd190020a6 100644 --- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc +++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc @@ -240,6 +240,8 @@ PeilessStartupLib|OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf TdxMeasurementLib|OvmfPkg/IntelTdx/TdxMeasurementLib/SecPeiTdxMeasurementLib.inf + TdxHelperLib|OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf + TpmMeasurementLib|OvmfPkg/Library/SecTpmMeasurementLib/SecTpmMeasurementLib.inf [LibraryClasses.common.DXE_CORE] HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf @@ -545,7 +547,6 @@ OvmfPkg/IntelTdx/Sec/SecMain.inf { NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf - NULL|OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf } diff --git a/OvmfPkg/IntelTdx/Sec/SecMain.inf b/OvmfPkg/IntelTdx/Sec/SecMain.inf index cf95284f027e..1e06586aeca0 100644 --- a/OvmfPkg/IntelTdx/Sec/SecMain.inf +++ b/OvmfPkg/IntelTdx/Sec/SecMain.inf @@ -50,6 +50,7 @@ PeilessStartupLib PlatformInitLib CcProbeLib + TdxHelperLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c index 42db1a61cb50..a72d47827f3c 100644 --- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c +++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartup.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "PeilessStartupInternal.h" #define GET_GPAW_INIT_STATE(INFO) ((UINT8) ((INFO) & 0x3f)) @@ -47,6 +49,10 @@ InitializePlatform ( DEBUG ((DEBUG_INFO, "InitializePlatform in Pei-less boot\n")); PlatformDebugDumpCmos (); + if (RETURN_ERROR (QemuFwCfgInitCache ())) { + DEBUG ((DEBUG_ERROR, "QemuFwCfgInitCache failed !\n")); + } + PlatformInfoHob->DefaultMaxCpuNumber = 64; PlatformInfoHob->PcdPciMmio64Size = 0x800000000;