BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3974
CcProbeLib once was designed to probe the Confidential Computing guest type by checking the PcdOvmfWorkArea. But this memory is allocated with either EfiACPIMemoryNVS or EfiBootServicesData. It cannot be accessed after ExitBootService. Please see the detailed analysis in BZ#3974. To fix this issue, CcProbeLib is re-designed as 2 implementation: - SecPeiCcProbeLib - CcProbeLib In SecPeiCcProbeLib we still check the CC guest type by reading the PcdOvmfWorkArea. Because it is used in SEC / PEI and we don't worry about the issues in BZ#3974. In CcProbeLib we call TdIsEnabled() to check if it is of Tdx guest. To improve the efficiency the result is cached in a global variable. In current stage only the Tdx related code is added in CcProbeLib. SEV code may be added in the future. The reason why we probe CC guest type in 2 different ways is the global varialbe. Global variable cannot be used in SEC/PEI and CcProbe is called very frequently. Code: https://github.com/mxu9/edk2/tree/CcProbeLib.BZ3974.v1 Cc: Gerd Hoffmann <kra...@redhat.com> Cc: Erdem Aktas <erdemak...@google.com> Cc: James Bottomley <j...@linux.ibm.com> Cc: Jiewen Yao <jiewen....@intel.com> Cc: Tom Lendacky <thomas.lenda...@amd.com> Cc: Yuan Yu <yua...@google.com> Signed-off-by: Min Xu <min.m...@intel.com> Min M Xu (2): OvmfPkg: Add SecPeiCcProbeLib OvmfPkg: Update CcProbeLib OvmfPkg/IntelTdx/IntelTdxX64.dsc | 1 + OvmfPkg/Library/CcProbeLib/CcProbeLib.c | 24 +++++++++++--- OvmfPkg/Library/CcProbeLib/CcProbeLib.inf | 5 +-- OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.c | 31 +++++++++++++++++++ .../Library/CcProbeLib/SecPeiCcProbeLib.inf | 25 +++++++++++++++ OvmfPkg/OvmfPkgX64.dsc | 3 ++ 6 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.c create mode 100644 OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf -- 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#91132): https://edk2.groups.io/g/devel/message/91132 Mute This Topic: https://groups.io/mt/92223431/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-