Hi, Ray & Eric I am doing the TDVF upstreaming and this commit is in UefiCpuPkg. You're the maintainer/reviewer of UefiCpuPkg. Your comments to this patch is great helpful. The complete code is at: https://github.com/mxu9/edk2/tree/tdvf_wave2.v6
Thanks Min > RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 > > Add base support to handle #VE exceptions. Update the common exception > handlers to invoke the VmTdExitHandleVe () function of the VmgExitLib > library when a #VE is encountered. A non-zero return code will propagate to > the targeted exception handler. > > Cc: Brijesh Singh <brijesh.si...@amd.com> > Cc: Erdem Aktas <erdemak...@google.com> > Cc: James Bottomley <j...@linux.ibm.com> > Cc: Jiewen Yao <jiewen....@intel.com> > Cc: Tom Lendacky <thomas.lenda...@amd.com> > Cc: Eric Dong <eric.d...@intel.com> > Cc: Ray Ni <ray...@intel.com> > Cc: Rahul Kumar <rahul1.ku...@intel.com> > Cc: Gerd Hoffmann <kra...@redhat.com> > Acked-by: Gerd Hoffmann <kra...@redhat.com> > Signed-off-by: Min Xu <min.m...@intel.com> > --- > .../PeiDxeSmmCpuException.c | 17 +++++++++++++++++ > .../SecPeiCpuException.c | 18 ++++++++++++++++++ > 2 files changed, 35 insertions(+) > > diff --git > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c > index 762ea2460f91..4fa3f8202a33 100644 > --- > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c > +++ > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiDxeSmmCpuException.c > @@ -45,6 +45,23 @@ CommonExceptionHandlerWorker ( > } > } > > + if (ExceptionType == VE_EXCEPTION) { > + EFI_STATUS Status; > + // > + // #VE needs to be handled immediately upon enabling exception > handling > + // and therefore can't use the RegisterCpuInterruptHandler() interface. > + // > + // Handle the #VE: > + // On EFI_SUCCESS - Exception has been handled, return > + // On other - ExceptionType contains (possibly new) exception > + // value > + // > + Status = VmTdExitHandleVe (&ExceptionType, SystemContext); > + if (!EFI_ERROR (Status)) { > + return; > + } > + } > + > ExceptionHandlerContext = (EXCEPTION_HANDLER_CONTEXT > *)(UINTN)(SystemContext.SystemContextIa32); > ReservedVectors = ExceptionHandlerData->ReservedVectors; > ExternalInterruptHandler = ExceptionHandlerData- > >ExternalInterruptHandler; > diff --git > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c > index c614d5b0b6f1..148d89011721 100644 > --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c > +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuException.c > @@ -43,6 +43,24 @@ CommonExceptionHandler ( > } > } > > + if (ExceptionType == VE_EXCEPTION) { > + EFI_STATUS Status; > + // > + // #VE needs to be handled immediately upon enabling exception > handling > + // and therefore can't use the RegisterCpuInterruptHandler() interface > + // (which isn't supported under Sec and Pei anyway). > + // > + // Handle the #VE: > + // On EFI_SUCCESS - Exception has been handled, return > + // On other - ExceptionType contains (possibly new) exception > + // value > + // > + Status = VmTdExitHandleVe (&ExceptionType, SystemContext); > + if (!EFI_ERROR (Status)) { > + return; > + } > + } > + > // > // Initialize the serial port before dumping. > // > -- > 2.29.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86876): https://edk2.groups.io/g/devel/message/86876 Mute This Topic: https://groups.io/mt/89252028/21656 Mute #ve:https://edk2.groups.io/g/devel/mutehashtag/ve Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-