From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.91010.1674778280571183584 for ; Thu, 26 Jan 2023 16:11:42 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=BtESu9Yq; spf=pass (domain: intel.com, ip: 134.134.136.20, 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=1674778302; x=1706314302; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DwFBhmP4C8Fh7u8gC9HSPRuPUt0NuBbM1Oe+7vBsZ2w=; b=BtESu9Yq21Cfzu/ku1Y70svf30JJFLGaFP0HfDAhYI1GqgIsRAOZTkfO gf1sqPkTkD0a4Y1udy5QhKX3xnj8D19Cw2FRXy43dxa5TQN7X1VtDzC2Q dOqgSgSzlzYWPbsPHXvtiyvQp3tdalX6nn/bBGGdqrQVOrMqFOOmBJhFo GeAIeMBWZueDVYgQM/VU+eIJ7airaFPWYBEullpQ+C1CfZ53pBXaeiYRE 0MRNk579MKuhCcrmQVUp5gxCjHqcTq9uD1+hUWQFA6N5sFhzgYp+hcUvl CGHBhwQ/H7yNFuhz29iXiH67znpEvULA+7+kBanb7+Y2l6CceDYLsDhSE Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10602"; a="314942430" X-IronPort-AV: E=Sophos;i="5.97,249,1669104000"; d="scan'208";a="314942430" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2023 16:11:41 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10602"; a="695335774" X-IronPort-AV: E=Sophos;i="5.97,249,1669104000"; d="scan'208";a="695335774" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.254.209.180]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2023 16:11:39 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Gerd Hoffmann , Tom Lendacky , Michael Roth Subject: [PATCH V4 08/12] OvmfPkg/TdxHelperLib: Implement TdxHelperBuildGuidHobForTdxMeasurement Date: Fri, 27 Jan 2023 08:11:02 +0800 Message-Id: <20230127001106.2038-9-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: <20230127001106.2038-1-min.m.xu@intel.com> References: <20230127001106.2038-1-min.m.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4243 TdxHelperBuildGuidHobForTdxMeasurement builds GuidHob for tdx-measurement which is measured in SEC phase. The implementation is movded from PeilessStartupLib/IntelTdx.c. Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Tom Lendacky Cc: Michael Roth Signed-off-by: Min Xu --- OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c | 16 ++++++++++++++++ .../IntelTdx/TdxHelperLib/SecTdxHelperLib.inf | 1 + .../TdxHelperLib/TdxMeasurementHob.c} | 9 +++++---- .../PeilessStartupLib/PeilessStartupLib.inf | 1 - 4 files changed, 22 insertions(+), 5 deletions(-) rename OvmfPkg/{Library/PeilessStartupLib/IntelTdx.c => IntelTdx/TdxHelperLib/TdxMeasurementHob.c} (95%) diff --git a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c index f64071827658..c857fe2ed06f 100644 --- a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c +++ b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelper.c @@ -23,6 +23,18 @@ #include #include +/** + Build the GuidHob for tdx measurements which were done in SEC phase. + The measurement values are stored in WorkArea. + + @retval EFI_SUCCESS The GuidHob is built successfully + @retval Others Other errors as indicated +**/ +EFI_STATUS +InternalBuildGuidHobForTdxMeasurement ( + VOID + ); + /** In Tdx guest, some information need to be passed from host VMM to guest firmware. For example, the memory resource, etc. These information are @@ -208,5 +220,9 @@ TdxHelperBuildGuidHobForTdxMeasurement ( VOID ) { + #ifdef TDX_PEI_LESS_BOOT + return InternalBuildGuidHobForTdxMeasurement (); + #else return EFI_UNSUPPORTED; + #endif } diff --git a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf index 3c6b96f7759a..d17b84c01f20 100644 --- a/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf +++ b/OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf @@ -24,6 +24,7 @@ [Sources] SecTdxHelper.c + TdxMeasurementHob.c [Packages] CryptoPkg/CryptoPkg.dec diff --git a/OvmfPkg/Library/PeilessStartupLib/IntelTdx.c b/OvmfPkg/IntelTdx/TdxHelperLib/TdxMeasurementHob.c similarity index 95% rename from OvmfPkg/Library/PeilessStartupLib/IntelTdx.c rename to OvmfPkg/IntelTdx/TdxHelperLib/TdxMeasurementHob.c index 4bc6f5e95e63..a4c7095cffab 100644 --- a/OvmfPkg/Library/PeilessStartupLib/IntelTdx.c +++ b/OvmfPkg/IntelTdx/TdxHelperLib/TdxMeasurementHob.c @@ -1,6 +1,10 @@ /** @file - Copyright (c) 2022, Intel Corporation. All rights reserved.
+ Build GuidHob for tdx measurement. + + Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + **/ #include @@ -12,11 +16,8 @@ #include #include #include -#include #include -#include "PeilessStartupInternal.h" - #pragma pack(1) #define HANDOFF_TABLE_DESC "TdxTable" diff --git a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf b/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf index 5be6baf2cef8..e77ad7bc921e 100644 --- a/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf +++ b/OvmfPkg/Library/PeilessStartupLib/PeilessStartupLib.inf @@ -29,7 +29,6 @@ PeilessStartup.c Hob.c DxeLoad.c - IntelTdx.c X64/VirtualMemory.c [Packages] -- 2.29.2.windows.2