On August 25, 2022 3:42 PM, Gerd Hoffmann wrote:
>   Hi,
> 
> > > Runtime service call are restricted so that you don't have
> > > concurrent threads executing (see section 8.1 of the specification).
> > > Without that you would have problems with runtime services today.
> > >
> > One of the situation of CcProbe used is in BaseIoLib.
> > https://github.com/tianocore/edk2/blob/master/MdePkg/Library/BaseIoLib
> > Intrinsic/IoLibInternalTdx.c#L35-L40
> >
> > BaseIoLib is a basic library and it may be called by APs. While dynamic PCD
> access is not allowed in APs. Of course we can cache the PCD in a variable but
> I think it is still not safe.
> >
> > Reserving the OVMF work area as RT_DATA breaks the original intention of
> the design.
> >
> > Then how about this solution?
> > https://edk2.groups.io/g/devel/message/91132
> > We can design 2 instances of CcProbe. One is to read the OvmfWorkArea.
> The other is to call Cc guest specific way to determine the type.
> 
> When using RT_DATA is out of question there is no way around two instances
> I think.
> 
> I don't see the point in reinventing the wheel though.  We know what the
> guest type is, why determine it *again*?  We only need to copy the guest type
> from the work area to another place before it is gone.  I think the dxe 
> library
> instance could copy it to a variable in the init function.
> 
As I mentioned CcProbe is used in BaseIoLib which is a basic library and it is 
used in SEC/PEI/DXE phases. Global variable cannot be used in SEC phase. Unless 
BaseIoLib is split into 2 instance, one for SEC/PEI phase, the other for DXE 
phase. 
Gerd, do you mean this solution?

Or there is another solution based on 
https://edk2.groups.io/g/devel/message/91132
We can design 2 instances of CcProbe. One is to read the OvmfWorkArea. This is 
for SEC/PEI phase.
The other is to save the guest type in Ovmf work area to a global variable in 
its init function. This is for DXE phase.

Thanks
Min



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92799): https://edk2.groups.io/g/devel/message/92799
Mute This Topic: https://groups.io/mt/93173995/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to