Reviewed-by: Eric Dong <eric.d...@intel.com> Thanks, Eric
> -----Original Message----- > From: Tom Lendacky <thomas.lenda...@amd.com> > Sent: Friday, June 5, 2020 9:28 PM > To: devel@edk2.groups.io > Cc: Brijesh Singh <brijesh.si...@amd.com>; Ard Biesheuvel > <ard.biesheu...@arm.com>; Dong, Eric <eric.d...@intel.com>; Justen, > Jordan L <jordan.l.jus...@intel.com>; Laszlo Ersek <ler...@redhat.com>; > Gao, Liming <liming....@intel.com>; Kinney, Michael D > <michael.d.kin...@intel.com>; Ni, Ray <ray...@intel.com> > Subject: [PATCH v9 41/46] UefiCpuPkg/MpInitLib: Add CPU MP data flag to > indicate if SEV-ES is enabled > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 > > When starting APs in an SMP configuration, the AP needs to know if it is > running as an SEV-ES guest in order to assign a GHCB page. > > Add a field to the CPU_MP_DATA structure that will indicate if SEV-ES is > enabled. This new field is set during MP library initialization with the > PCD value PcdSevEsIsEnabled. This flag can then be used to determine if > SEV-ES is enabled. > > Cc: Eric Dong <eric.d...@intel.com> > Cc: Ray Ni <ray...@intel.com> > Cc: Laszlo Ersek <ler...@redhat.com> > Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com> > --- > UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 + > UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 + > UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 ++ > UefiCpuPkg/Library/MpInitLib/MpLib.c | 1 + > 4 files changed, 5 insertions(+) > > diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf > b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf > index 9907f4157b09..583276595619 100644 > --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf > +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf > @@ -71,4 +71,5 @@ [Pcd] > gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## > CONSUMES > > gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## > SOMETIMES_CONSUMES > > > gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckIntervalInMicroSeconds > ## CONSUMES > > + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## > CONSUMES > > diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf > b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf > index 89ee9a79d8c5..4b3d39fbf36c 100644 > --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf > +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf > @@ -61,6 +61,7 @@ [Pcd] > gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## > CONSUMES > > gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## > CONSUMES > > gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## > SOMETIMES_CONSUMES > > + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled ## > CONSUMES > > > > [Ppis] > > gEdkiiPeiShadowMicrocodePpiGuid ## SOMETIMES_CONSUMES > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h > b/UefiCpuPkg/Library/MpInitLib/MpLib.h > index a8ca03efb8e3..5b46c295b6b2 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h > @@ -276,6 +276,8 @@ struct _CPU_MP_DATA { > // driver. > > // > > BOOLEAN WakeUpByInitSipiSipi; > > + > > + BOOLEAN SevEsIsEnabled; > > }; > > > > extern EFI_GUID mCpuInitMpLibHobGuid; > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c > b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index ab7a8ed6633a..a8b605f569bf 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -1727,6 +1727,7 @@ MpInitLibInitialize ( > CpuMpData->CpuData = (CPU_AP_DATA *) (CpuMpData + 1); > > CpuMpData->CpuInfoInHob = (UINT64) (UINTN) (CpuMpData->CpuData > + MaxLogicalProcessorNumber); > > InitializeSpinLock(&CpuMpData->MpLock); > > + CpuMpData->SevEsIsEnabled = PcdGetBool (PcdSevEsIsEnabled); > > > > // > > // Make sure no memory usage outside of the allocated buffer. > > -- > 2.27.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61182): https://edk2.groups.io/g/devel/message/61182 Mute This Topic: https://groups.io/mt/74698713/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-