[edk2-devel] [PATCH V6 26/42] OvmfPkg: Add null instance of PlatformInitLib

Min Xu min.m.xu at intel.com
Wed Feb 23 00:34:21 UTC 2022


On February 22, 2022 9:10 PM, Gerd Hoffmann wrote:
> >
> > Add null instance of PlatformInitLib.
> 
> What is this library needed for?
> 
In #25 (OvmfPkg: Update PlatformInitLib to process Tdx hoblist) ProcessTdxHobList is added in PlatformInitLib to process the Tdx HobList. This function is called in OvmfPkg/Sec/SecMain.c (#28 OvmfPkg: Update Sec to support Tdx). ProcessTdxHobList is called by OvmfPkg/IntelTdx/Sec/SecMain.c as well. See https://edk2.groups.io/g/devel/message/86120

OvmfPkg/Sec/SecMain.c is used by OvmfXen.dsc/AmdSevX64.dsc/BhyveX64.dsc/CloudHvX64.dsc/MicrovmX64.dsc. So PlatformInitLibNull is needed by these platforms.

There is another option which can reduce the changes in dscs.
1. Define a macro (for example: TDX_GUEST_SUPPORTED) in OvmfPkgX64.dsc
  MSFT:*_*_*_CC_FLAGS = /D TDX_GUEST_SUPPORTED
  INTEL:*_*_*_CC_FLAGS = /D TDX_GUEST_SUPPORTED
  GCC:*_*_*_CC_FLAGS = -D TDX_GUEST_SUPPORTED

2. TDX_GUEST_SUPPORTED wrap the tdx specific code in SecMain.c
#if defined (TDX_GUEST_SUPPORTED)
  if (TdIsEnabled ()) {
    if (ProcessTdxHobList () != EFI_SUCCESS) {
      CpuDeadLoop ();
    }
  }
 #endif

What's your thought?

Thanks
Min


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86871): https://edk2.groups.io/g/devel/message/86871
Mute This Topic: https://groups.io/mt/89252053/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list