On June 22, 2022 3:01 PM, Gerd Hoffmann wrote:
> On Wed, Jun 22, 2022 at 02:02:00AM +0000, Xu, Min M wrote:
> > On June 20, 2022 7:01 PM, Gerd Hoffman wrote:
> > >
> > > There is PcdEmuVariableNvStoreReserved for that.  How about just
> > > copying the store to ram, then set PcdEmuVariableNvStoreReserved to
> > > the location and let the existing logic handle it?
> 
> > There is ReserveEmuVariableNvStore in PlatformPei/Platform.c. This
> > function is called to allocate storage for NV Variables.
> > PcdEmuVariableNvStoreReserved is set in that function too. So we can
> > copy the content to that reserved storage if it is tdx guest. Then we
> > let the exiting logic to handle it. So I would like to extract
> > ReserveEmuVariableNvStore to PlatformReserveEmuVariableNvStore (in
> > PlatformInitLib) and call it in both PlatformPei/Platform.c and
> > PeilesssStartup.c.
> 
> Moving the ReserveEmuVariableNvStore() function to PlatformInitLib make
> sense.  Will be a bit more than pure code motion though, we probably need
> a new variable in the platforminfo struct because PeilesssStartup.c can't set
> PCDs.
I check the current PlatformInfoHob and PcdEmuVariableNvStoreReserved has 
already been defined.
> 
> Copying over the content in PlatformInitLib makes sense too, probably best
> as separate function.
Yes, PlatformReserveEmuVariableNvStore() will be a separated function and it 
returns the pointer of the allocated storage. Then this pointer can be set to 
either the PCD (PlatformPei) or in PlatformInfoHob (PeilessStartupLib).
> 
> > > Also why limit this to tdx?
> > Because I am not sure if other platforms need such operation. So in
> > current stage it is limit to tdx.
> 
> I think the code should copy over the varstore in case the
> SECURE_BOOT_ENABLE option is set.  That is the actual use case and it
> makes sense without TDX too.
Then we need add a build-flag in *.dsc. Do you think OvmfPkgX64.dsc and 
IntelTdxX64.dsc are enough?

Thanks
Min


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90672): https://edk2.groups.io/g/devel/message/90672
Mute This Topic: https://groups.io/mt/91835110/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to