From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.37667.1674098921938942214 for ; Wed, 18 Jan 2023 19:28:42 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=hN1gt9ks; spf=pass (domain: intel.com, ip: 134.134.136.31, 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=1674098922; x=1705634922; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SvP/LQxPHJrmc3WbsXn2X0buqxB/CZm3V+lWFXRNE+A=; b=hN1gt9ksEuuaK9KxV69SwHnytwszLQzY57vMeoAvrqyw9JrscIpO5o+a 8UtR1TkE715Qy7hKIm7xr+SlbMgP9NUj0hKq3xyjdCS7bQfVRttUdLtBE jXTTN0+eowUcb9Z40K/CGQAqnp9a83lInTjvXeaXakc1Udk61eLTHLj8K mZK56zP0rRxPXs9x4rcD5vU6wIiFqvrXWrTHtIJvGgZO8ofIVs+yCY02B ia5YCGubTa6AaOLzBS001ifDRlYu4+b4b7hRmrwRtBtp78nCSD6Fq0irm zJqe8XCWzXpsJWB+EF0DnNVidvXCmodUfsKnntysVqq5N7JDnS991oOZe Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10594"; a="387531088" X-IronPort-AV: E=Sophos;i="5.97,226,1669104000"; d="scan'208";a="387531088" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 19:28:40 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10594"; a="692264199" X-IronPort-AV: E=Sophos;i="5.97,226,1669104000"; d="scan'208";a="692264199" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.254.211.169]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 19:28:37 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Gerd Hoffmann , Tom Lendacky , Michael Roth Subject: [PATCH V2 00/10] Enable Tdx measurement in OvmfPkgX64 Date: Thu, 19 Jan 2023 11:28:12 +0800 Message-Id: <20230119032822.1406-1-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4243 Tdx measurement (RTMR based measurement) is enabled in OvmfPkg/IntelTdx. This patch-set enables the feature in OvmfPkgX64 as well. Patch #1: Introduce TDX_MEASUREMETNS_DATA in SEC_TDX_WORK_AREA. That is because the RTMR measurement of TdHob and Configuration FV (CFV) are executed in very early stage of boot process. At that time the memory service is not ready and the measurement values have to be stored in OvmfWorkArea. Patch #2 - 5: Introduce TdxHelperLib which provides helper functions for td-guest. Patch #6/7: These 2 patches are the changes for OvmfPkg/IntelTdx because of the introduction of TdxHelperLib. Patch #8/9: These 2 patches are the changes for OvmfPkg/OvmfPkgX64 to enable Tdx measurement. Patch #10: ProcessTdxHobList is moved to TdxHelperLib and is renamed as TdxHelperProcessTdHob(). So the duplicated codes are deleted in this patch. Code: https://github.com/mxu9/edk2/tree/TdxMeasurementInOvmfX64.v2 v2 changes: - Split the patch of TdxHelperLib into 4 separate patches. So that it is more reviewable. - Add commit message in Patch#1 to emphasize that the tdx-measurement in OvmfPkgX64 is supported in SEC phase. Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Tom Lendacky Cc: Michael Roth Signed-off-by: Min Xu Min M Xu (10): OvmfPkg: Add Tdx measurement data structure in WorkArea OvmfPkg/IntelTdx: Add TdxHelperLibNull OvmfPkg/IntelTdx: Add SecTdxHelperLib OvmfPkg/IntelTdx: Implement other helper functions in SecTdxHelperLib OvmfPkg/IntelTdx: Add PeiTdxHelperLib OvmfPkg/PeilessStartupLib: Build GuidHob for Tdx measurements OvmfPkg/IntelTdx: Update tdx measurement in SEC phase OvmfPkg: Enable Tdx measurement in OvmfPkgX64 OvmfPkg/PlatformPei: Build GuidHob for Tdx measurement OvmfPkg/PlatformInitLib: Delete the ProcessTdxHobList() OvmfPkg/AmdSev/AmdSevX64.dsc | 5 +- OvmfPkg/CloudHv/CloudHvX64.dsc | 5 +- OvmfPkg/Include/Dsc/OvmfTpmLibs.dsc.inc | 10 +- .../Include/Dsc/OvmfTpmSecurityStub.dsc.inc | 8 + OvmfPkg/Include/Library/PlatformInitLib.h | 17 - OvmfPkg/Include/Library/TdxHelperLib.h | 70 ++ OvmfPkg/Include/WorkArea.h | 25 +- OvmfPkg/IntelTdx/IntelTdxX64.dsc | 4 +- OvmfPkg/IntelTdx/Sec/SecMain.c | 17 +- OvmfPkg/IntelTdx/TdxHelperLib/PeiTdxHelper.c | 91 +++ .../IntelTdx/TdxHelperLib/PeiTdxHelperLib.inf | 48 ++ .../TdxHelperLib/SecTdxHelper.c} | 312 +++---- .../IntelTdx/TdxHelperLib/SecTdxHelperLib.inf | 53 ++ .../TdxHelperLib/TdxHelperLibNull.inf | 32 + OvmfPkg/IntelTdx/TdxHelperLib/TdxHelperNull.c | 79 ++ .../IntelTdx/TdxHelperLib/TdxMeasurementHob.c | 266 ++++++ OvmfPkg/Library/PeilessStartupLib/IntelTdx.c | 196 ----- .../PeilessStartupLib/PeilessStartup.c | 16 +- .../PeilessStartupInternal.h | 36 - .../PeilessStartupLib/PeilessStartupLib.inf | 3 - OvmfPkg/Library/PlatformInitLib/IntelTdx.c | 768 ------------------ .../Library/PlatformInitLib/IntelTdxNull.c | 20 - .../PlatformInitLib/PlatformInitLib.inf | 1 - OvmfPkg/Microvm/MicrovmX64.dsc | 5 +- OvmfPkg/OvmfPkg.dec | 4 + OvmfPkg/OvmfPkgX64.dsc | 20 +- OvmfPkg/OvmfPkgX64.fdf | 7 + OvmfPkg/PlatformPei/IntelTdx.c | 3 + OvmfPkg/Sec/SecMain.c | 17 +- 29 files changed, 931 insertions(+), 1207 deletions(-) create mode 100644 OvmfPkg/Include/Library/TdxHelperLib.h create mode 100644 OvmfPkg/IntelTdx/TdxHelperLib/PeiTdxHelper.c create mode 100644 OvmfPkg/IntelTdx/TdxHelperLib/PeiTdxHelperLib.inf copy OvmfPkg/{Library/PlatformInitLib/IntelTdx.c => IntelTdx/TdxHelperLib/SecTdxHelper.c} (79%) create mode 100644 OvmfPkg/IntelTdx/TdxHelperLib/SecTdxHelperLib.inf create mode 100644 OvmfPkg/IntelTdx/TdxHelperLib/TdxHelperLibNull.inf create mode 100644 OvmfPkg/IntelTdx/TdxHelperLib/TdxHelperNull.c create mode 100644 OvmfPkg/IntelTdx/TdxHelperLib/TdxMeasurementHob.c delete mode 100644 OvmfPkg/Library/PeilessStartupLib/IntelTdx.c -- 2.29.2.windows.2