Re: [PATCH V4 06/12] OvmfPkg/PeilessStartupLib: Build GuidHob for Tdx measurement


Min Xu
 

On January 27, 2023 3:54 PM, Gerd Hoffmann wrote:
On Fri, Jan 27, 2023 at 08:11:00AM +0800, Min Xu wrote:
From: Min M Xu <min.m.xu@...>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4243
What is the reason to create a new TdxHelperLib btw.?
Are there any problems with the code being in PlatformInitLib?
When tdx-measurement is being enabled in OvmfPkgX64, we find below functions are needed.
- ProcessTdHob
- MeasureTdHob
- MeasureCfvImage
- BuildGuidHobForTdxMeasurement

The first one was implemented in PlatformInitLib. The others were implemented in PeilessStartupLib. These 4 functions should be implemented in one lib so that they could be called in both OvmfPkgX64 and IntelTdxX64.
So there are below 2 options
1) Implement all these 4 functions in PlatformInitLib
2) Implement all these 4 functions in a new TdxHelperLib

We choose option-2 (a new TdxHelperLib).
1. TdxHelperLib contains all the tdx specific helper functions as the lib name indicates.
2. We can avoid PlatformInitLib getting bigger and bigger by adding more and more functions. (these functions can be implemented in a separate lib)
3. Furthermore, PlatformTdxPublishRamRegions in PlatformInitLib can be moved to TdxHelperLib as well (we will submit a separate patch-set later). So that we can have a general-purpose PlatformInitLib.

Based on above consideration, we create a new TdxHelperLib.

Thanks
Min

Join {devel@edk2.groups.io to automatically receive all group messages.