On Sat, Aug 27, 2022 at 07:07:06AM +0800, Min Xu wrote: > 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 > - DxeCcProbeLib > > In SecPeiCcProbeLib we 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 DxeCcProbeLib we cache the GuestType in Ovmf work area in a global > variable. After that the Guest type is returned with the cached value. > So that we don't need to worry about the access to Ovmf work area after > ExitBootService. > > 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.v4 > > v4 changes: > - Read Cc guest type in both DxeCcProbeLib's constructor and CcProbe. So > that we guarantee the Cc guest type is read early enough.
Acked-by: Gerd Hoffmann <kra...@redhat.com> take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#92910): https://edk2.groups.io/g/devel/message/92910 Mute This Topic: https://groups.io/mt/93281451/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-