[edk2-devel] [PATCH V5 4/8] OvmfPkg/PlatformPei: Update ReserveEmuVariableNvStore

Min Xu min.m.xu at intel.com
Fri Mar 24 00:38:43 UTC 2023


Hi, joeyli
Please see my comments in https://bugzilla.tianocore.org/show_bug.cgi?id=4379
I need your help to catch some logs in AMD SEV environment for this problem.

Thanks
Min

> -----Original Message-----
> From: joeyli <jlee at suse.com>
> Sent: Tuesday, March 21, 2023 5:32 PM
> To: devel at edk2.groups.io; Xu, Min M <min.m.xu at intel.com>
> Cc: Aktas, Erdem <erdemaktas at google.com>; James Bottomley
> <jejb at linux.ibm.com>; Yao, Jiewen <jiewen.yao at intel.com>; Tom Lendacky
> <thomas.lendacky at amd.com>; Gerd Hoffmann <kraxel at redhat.com>
> Subject: Re: [edk2-devel] [PATCH V5 4/8] OvmfPkg/PlatformPei: Update
> ReserveEmuVariableNvStore
> 
> Hi Min M Xu,
> 
> I have filed a EDK2 bug relates to this patch:
> 
> Bug 4379 - Got NvVarStore FV headers were invalid when using OVMF with
> AMD SEV
> https://bugzilla.tianocore.org/show_bug.cgi?id=4379
> 
> I got a "NvVarStore FV headers were invalid." assert when using OVMF with
> AMD SEV. After reverted this patch, the assert is gone.
> 
> Thanks!
> Joey Lee
> 
> On Tue, Sep 06, 2022 at 12:35:56PM +0800, Min Xu via groups.io wrote:
> > From: Min M Xu <min.m.xu at intel.com>
> >
> > ReserveEmuVariableNvStore is updated with below 2 functions defined in
> > PlatformInitLib:
> >  - PlatformReserveEmuVariableNvStore
> >  - PlatformInitEmuVariableNvStore
> >
> > PlatformInitEmuVariableNvStore works when secure boot feature is enabled.
> > This is because secure boot needs the EFI variables (PK/KEK/DB/DBX,
> > etc) and EmuVariableNvStore is cleared when OVMF is launched with
> > -bios parameter.
> >
> > Cc: Erdem Aktas <erdemaktas at google.com>
> > Cc: James Bottomley <jejb at linux.ibm.com>
> > Cc: Jiewen Yao <jiewen.yao at intel.com>
> > Cc: Tom Lendacky <thomas.lendacky at amd.com>
> > Cc: Gerd Hoffmann <kraxel at redhat.com>
> > Acked-by: Gerd Hoffmann <kraxel at redhat.com>
> > Signed-off-by: Min Xu <min.m.xu at intel.com>
> > ---
> >  OvmfPkg/PlatformPei/Platform.c | 25 +++++++------------------
> >  1 file changed, 7 insertions(+), 18 deletions(-)
> >
> > diff --git a/OvmfPkg/PlatformPei/Platform.c
> > b/OvmfPkg/PlatformPei/Platform.c index 009db67ee60a..b1f8140d6041
> > 100644
> > --- a/OvmfPkg/PlatformPei/Platform.c
> > +++ b/OvmfPkg/PlatformPei/Platform.c
> > @@ -220,24 +220,13 @@ ReserveEmuVariableNvStore (
> >    EFI_PHYSICAL_ADDRESS  VariableStore;
> >    RETURN_STATUS         PcdStatus;
> >
> > -  //
> > -  // Allocate storage for NV variables early on so it will be
> > -  // at a consistent address.  Since VM memory is preserved
> > -  // across reboots, this allows the NV variable storage to survive
> > -  // a VM reboot.
> > -  //
> > -  VariableStore =
> > -    (EFI_PHYSICAL_ADDRESS)(UINTN)
> > -    AllocateRuntimePages (
> > -      EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize))
> > -      );
> > -  DEBUG ((
> > -    DEBUG_INFO,
> > -    "Reserved variable store memory: 0x%lX; size: %dkb\n",
> > -    VariableStore,
> > -    (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024
> > -    ));
> > -  PcdStatus = PcdSet64S (PcdEmuVariableNvStoreReserved,
> > VariableStore);
> > +  VariableStore =
> (EFI_PHYSICAL_ADDRESS)(UINTN)PlatformReserveEmuVariableNvStore ();
> > +  PcdStatus     = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);
> > +
> > + #ifdef SECURE_BOOT_FEATURE_ENABLED
> > +  PlatformInitEmuVariableNvStore ((VOID *)(UINTN)VariableStore);
> > + #endif
> > +
> >    ASSERT_RETURN_ERROR (PcdStatus);
> >  }
> >
> > --
> > 2.29.2.windows.2
> >
> >
> >
> > 
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101712): https://edk2.groups.io/g/devel/message/101712
Mute This Topic: https://groups.io/mt/93494907/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list