On June 20, 2022 7:01 PM, Gerd Hoffman wrote: > > > + UINT8 *CfvBase; > > + UINT32 CfvSize; > > > > DEBUG ((DEBUG_INFO, "EMU Variable FVB Started\n")); > > > > @@ -774,6 +776,23 @@ FvbInitialize ( > > > > mEmuVarsFvb.BufferPtr = Ptr; > > > > + // > > + // In Tdx guest the VarNvStore content should be initialized by the > Configuration FV (CFV). > > + // Integrity of the CFV has been validated by TdxValidateCfv > > + (@PlatformInitLib) // if (TdIsEnabled ()) { > > + CfvBase = (UINT8 *)(UINTN)PcdGet32 (PcdCfvBase); > > + CfvSize = (UINT32)PcdGet32 (PcdCfvRawDataSize); > > + > > + if (CfvSize > mEmuVarsFvb.Size) { > > + DEBUG ((DEBUG_ERROR, "Size of CFV is larger than the EMU Variable > FVB.\n")); > > + ASSERT (FALSE); > > + } else { > > + CopyMem (Ptr, CfvBase, CfvSize); > > + Initialize = FALSE; > > + } > > + } > > 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. What's your thought? > > 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.
Thanks Min -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90668): https://edk2.groups.io/g/devel/message/90668 Mute This Topic: https://groups.io/mt/91835110/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-