[edk2-devel] [PATCH 2/2] UefiCpuPkg: MpInitLib: Exclude code no pertinent to AMD processors.

Siyuan, Fu siyuan.fu at intel.com
Wed Feb 26 07:56:02 UTC 2020


Acked-by: Siyuan Fu <siyuan.fu at intel.com>

> -----Original Message-----
> From: Ni, Ray <ray.ni at intel.com>
> Sent: 2020年2月26日 15:46
> To: Leo Duran <leo.duran at amd.com>; devel at edk2.groups.io; Wu, Hao A
> <hao.a.wu at intel.com>; Fu, Siyuan <siyuan.fu at intel.com>
> Cc: Dong, Eric <eric.dong at intel.com>; Laszlo Ersek <lersek at redhat.com>
> Subject: RE: [PATCH 2/2] UefiCpuPkg: MpInitLib: Exclude code no pertinent
> to AMD processors.
> 
> + Hao Wu and Siyuan Fu for review.
> 
> > -----Original Message-----
> > From: Leo Duran <leo.duran at amd.com>
> > Sent: Wednesday, February 26, 2020 3:39 AM
> > To: devel at edk2.groups.io
> > Cc: Leo Duran <leo.duran at amd.com>; Dong, Eric <eric.dong at intel.com>;
> Ni, Ray <ray.ni at intel.com>; Laszlo Ersek
> > <lersek at redhat.com>
> > Subject: [PATCH 2/2] UefiCpuPkg: MpInitLib: Exclude code no pertinent to
> AMD processors.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2556
> >
> > This patch uses the newly exported StandardSignatureIsAuthenticAMD
> function
> > from LocalApicLib, to divert code paths not pertinent to AMD processors.
> > Specifically, the PlatformId MSR and embedded Microcode patches are not
> > relevant on AMD-based platforms.
> >
> > Cc: Eric Dong <eric.dong at intel.com>
> > Cc: Ray Ni <ray.ni at intel.com>
> > Cc: Laszlo Ersek <lersek at redhat.com>
> > Signed-off-by: Leo Duran <leo.duran at amd.com>
> > ---
> >  UefiCpuPkg/Library/MpInitLib/Microcode.c | 17 +++++++++++++++--
> >  UefiCpuPkg/Library/MpInitLib/MpLib.c     | 11 +++++++++--
> >  2 files changed, 24 insertions(+), 4 deletions(-)
> >
> > diff --git a/UefiCpuPkg/Library/MpInitLib/Microcode.c
> b/UefiCpuPkg/Library/MpInitLib/Microcode.c
> > index 1562959..750681d 100644
> > --- a/UefiCpuPkg/Library/MpInitLib/Microcode.c
> > +++ b/UefiCpuPkg/Library/MpInitLib/Microcode.c
> > @@ -2,6 +2,8 @@
> >    Implementation of loading microcode on processors.
> >
> >    Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
> > +  Copyright (c) 2020, AMD Inc. All rights reserved.<BR>
> > +
> >    SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  **/
> > @@ -97,9 +99,13 @@ MicrocodeDetect (
> >    UINT32                                  ThreadId;
> >    BOOLEAN                                 IsBspCallIn;
> >
> > -  if (CpuMpData->MicrocodePatchRegionSize == 0) {
> > +  //
> > +  // NOTE: Embedded Microcode patches are not relevant on AMD
> platforms.
> > +  //
> > +  if (CpuMpData->MicrocodePatchRegionSize == 0 ||
> > +      StandardSignatureIsAuthenticAMD ()) {
> >      //
> > -    // There is no microcode patches
> > +    // There are no microcode patches
> >      //
> >      return;
> >    }
> > @@ -350,6 +356,13 @@ IsProcessorMatchedMicrocodePatch (
> >    UINTN          Index;
> >    CPU_AP_DATA    *CpuData;
> >
> > +  //
> > +  // NOTE: PlatformId or embedded Microcode patches are not relevant on
> AMD platforms.
> > +  //
> > +  if (StandardSignatureIsAuthenticAMD ()) {
> > +    return FALSE;
> > +  }
> > +
> >    for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
> >      CpuData = &CpuMpData->CpuData[Index];
> >      if ((ProcessorSignature == CpuData->ProcessorSignature) &&
> > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > index d0fbc17..290e7bf 100644
> > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > @@ -2,6 +2,8 @@
> >    CPU MP Initialize Library common functions.
> >
> >    Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<BR>
> > +  Copyright (c) 2020, AMD Inc. All rights reserved.<BR>
> > +
> >    SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  **/
> > @@ -564,8 +566,13 @@ InitializeApData (
> >    CpuMpData->CpuData[ProcessorNumber].Waiting    = FALSE;
> >    CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ?
> TRUE : FALSE;
> >
> > -  PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);
> > -  CpuMpData->CpuData[ProcessorNumber].PlatformId = (UINT8)
> PlatformIdMsr.Bits.PlatformId;
> > +  //
> > +  // NOTE: PlatformId is not relevant on AMD platforms.
> > +  //
> > +  if (!StandardSignatureIsAuthenticAMD ()) {
> > +    PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);
> > +    CpuMpData->CpuData[ProcessorNumber].PlatformId =
> (UINT8)PlatformIdMsr.Bits.PlatformId;
> > +  }
> >
> >    AsmCpuid (
> >      CPUID_VERSION_INFO,
> > --
> > 2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54840): https://edk2.groups.io/g/devel/message/54840
Mute This Topic: https://groups.io/mt/71541520/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