public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V3 0/9] Enable Tdx measurement in OvmfPkgX64
@ 2023-01-25  2:23 Min Xu
  2023-01-25  2:23 ` [PATCH V3 1/9] OvmfPkg: Add Tdx measurement data structure in WorkArea Min Xu
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Min Xu @ 2023-01-25  2:23 UTC (permalink / raw)
  To: devel
  Cc: Min Xu, Erdem Aktas, James Bottomley, Jiewen Yao, Gerd Hoffmann,
	Tom Lendacky, Michael Roth

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:
  Introduce TdxHelperLibNull which is the NULL instance of TdxHelperLib.

Patch #3:
  Introduce SecTdxHelperLib which is the instance of TdxHelperLib for SEC
  Phase. In this patch TdxHelperBuildGuidHobForTdxMeasurement and
  TdxHelperProcessTdHob are not implemented. Their implementation are in
  patch #9 and patch #5. This is for the patch to be reviewed more
  friendly.

Patch #4:
  SecMain.c in IntelTdx is updated with the new functions provided
  by TdxHelperLib.

Patch #5:
  Implement TdxHelperBuildGuidHobForTdxMeasurement and update
  PeilessStartupLib accordingly.

Patch #7:
  This patch introduce PeiTdxHelperLib which is for PEI phase.

Patch #6/8:
  These 2 patches are the changes for OvmfPkg/OvmfPkgX64 to enable Tdx
  measurement.

Patch #9:
  This patch implements TdxHelperProcessTdHob which is moved from
  PlatformInitLib/IntelTdx.c. Its counterpart in PlatformInitLib is
  ProcessTdxHobList and the duplicated codes are deleted in this patch.

Code: https://github.com/mxu9/edk2/tree/TdxMeasurementInOvmfX64.v3

v3 changes:
 - Use the definition of PLATFORM_FIRMWARE_BLOB2_STRUCT in
   Library/TcgEventLogRecordLib.h.
 - Rename TDX_ENABLE as TDX_MEASUREMENT_ENABLE because this flag is
   introduced for Tdx-measurement.
 - Split the patch of SecTdxHelperLib into 2 separate patches (#3/#9).
   Patch#3 implements TdxHelperMeasureTdHob and TdxHelperMeasureCfvImage.
   Patch#9 implements TdxHelperProcessTdHob. This is to make the patches
   more reviewable. The duplicated codes of TdxHelperProcessTdHob are
   deleted in Patch#9 as well.
 - The implementation of TdxHelperBuildGuidHobForTdxMeasurement and update
   of PeilessStartupLib are in one patch (#5). Because the implmentation
   of TdxHelperBuildGuidHobForTdxMeasurement was once in PeilessStartupLib.

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 <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>

Min M Xu (9):
  OvmfPkg: Add Tdx measurement data structure in WorkArea
  OvmfPkg/IntelTdx: Add TdxHelperLibNull
  OvmfPkg/IntelTdx: Add SecTdxHelperLib
  OvmfPkg/IntelTdx: Update tdx measurement in SEC phase
  OvmfPkg/TdxHelperLib: Implement TdxHelperBuildGuidHobForTdxMeasurement
  OvmfPkg: Enable Tdx measurement in OvmfPkgX64
  OvmfPkg/IntelTdx: Add PeiTdxHelperLib
  OvmfPkg/PlatformPei: Build GuidHob for Tdx measurement
  OvmfPkg/TdxHelperLib: Implement TdxHelperProcessTdHob

 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 | 262 ++++++
 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, 927 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


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-01-26  7:50 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-25  2:23 [PATCH V3 0/9] Enable Tdx measurement in OvmfPkgX64 Min Xu
2023-01-25  2:23 ` [PATCH V3 1/9] OvmfPkg: Add Tdx measurement data structure in WorkArea Min Xu
2023-01-25  2:23 ` [PATCH V3 2/9] OvmfPkg/IntelTdx: Add TdxHelperLibNull Min Xu
2023-01-25  2:23 ` [PATCH V3 3/9] OvmfPkg/IntelTdx: Add SecTdxHelperLib Min Xu
2023-01-25 12:16   ` Gerd Hoffmann
2023-01-26  1:56     ` [edk2-devel] " Min Xu
2023-01-26  2:01       ` Yao, Jiewen
2023-01-26  2:08         ` Min Xu
2023-01-25  2:23 ` [PATCH V3 4/9] OvmfPkg/IntelTdx: Update tdx measurement in SEC phase Min Xu
2023-01-25  2:23 ` [PATCH V3 5/9] OvmfPkg/TdxHelperLib: Implement TdxHelperBuildGuidHobForTdxMeasurement Min Xu
2023-01-25 12:22   ` Gerd Hoffmann
2023-01-26  1:58     ` Min Xu
2023-01-26  7:09     ` Min Xu
2023-01-26  7:50       ` Gerd Hoffmann
2023-01-25  2:23 ` [PATCH V3 6/9] OvmfPkg: Enable Tdx measurement in OvmfPkgX64 Min Xu
2023-01-25  2:23 ` [PATCH V3 7/9] OvmfPkg/IntelTdx: Add PeiTdxHelperLib Min Xu
2023-01-25  2:23 ` [PATCH V3 8/9] OvmfPkg/PlatformPei: Build GuidHob for Tdx measurement Min Xu
2023-01-25  2:23 ` [PATCH V3 9/9] OvmfPkg/TdxHelperLib: Implement TdxHelperProcessTdHob Min Xu
2023-01-25 12:24   ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox