From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web12.9725.1583122911716185211 for ; Sun, 01 Mar 2020 20:21:51 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: ray.ni@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2020 20:21:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,506,1574150400"; d="scan'208";a="318786050" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 01 Mar 2020 20:21:50 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 1 Mar 2020 20:21:50 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 1 Mar 2020 20:21:50 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.206]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.137]) with mapi id 14.03.0439.000; Mon, 2 Mar 2020 12:21:48 +0800 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Ni, Ray" , Leo Duran CC: "Dong, Eric" , Laszlo Ersek Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors. Thread-Topic: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors. Thread-Index: AQHV7xHFPFn++iMZKkGu3xeXtPCoM6g0jfLggAAn6jA= Date: Mon, 2 Mar 2020 04:21:47 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C473F36@SHSMSX104.ccr.corp.intel.com> References: <1582988745-1189-1-git-send-email-leo.duran@amd.com> <1582988745-1189-2-git-send-email-leo.duran@amd.com> <15F85A23C0D08039.4290@groups.io> In-Reply-To: <15F85A23C0D08039.4290@groups.io> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni I will add the "STATIC" when pushing. > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Ni, Ray > Sent: Monday, March 2, 2020 10:00 AM > To: Leo Duran ; devel@edk2.groups.io > Cc: Dong, Eric ; Laszlo Ersek > Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Skip reading > PlatformId on AMD processors. >=20 > Leo, > The function name is the same as another local function defined in > LocalApicLib. > You may need to add a STATIC keyword for this local function, or change = it to > a > different name. >=20 > Thanks, > Ray >=20 > > -----Original Message----- > > From: Leo Duran > > Sent: Saturday, February 29, 2020 11:06 PM > > To: devel@edk2.groups.io > > Cc: Leo Duran ; Dong, Eric ; > Ni, > > Ray ; Laszlo Ersek > > Subject: [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD > > processors. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2556 > > > > This patch uses CPUID signature check to skip reading the PlatformId M= SR, > > which is not implemented on AMD processors. > > > > The PlatformId is used for loading microcode patches, which is also no= t > > supported and AMD-based platforms. To mitigate the PlatformId > > dependency, > > PcdCpuMicrocodePatchAddress and PcdCpuMicrodePatchRegionSize must > > be set > > to 0 (default value), in order to bypass microcode loading code paths. > > > > Cc: Eric Dong > > Cc: Ray Ni > > Cc: Laszlo Ersek > > Signed-off-by: Leo Duran > > --- > > UefiCpuPkg/Library/MpInitLib/MpLib.c | 34 > > ++++++++++++++++++++++++++++++++-- > > UefiCpuPkg/Library/MpInitLib/MpLib.h | 3 +++ > > 2 files changed, 35 insertions(+), 2 deletions(-) > > mode change 100644 =3D> 100755 UefiCpuPkg/Library/MpInitLib/MpLib.h > > > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c > > b/UefiCpuPkg/Library/MpInitLib/MpLib.c > > index d0fbc17..d2200c3 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.
> > + > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -10,6 +12,29 @@ > > > > EFI_GUID mCpuInitMpLibHobGuid =3D CPU_INIT_MP_LIB_HOB_GUID; > > > > + > > +/** > > + Determine if the standard CPU signature is "AuthenticAMD". > > + > > + @retval TRUE The CPU signature matches. > > + @retval FALSE The CPU signature does not match. > > + > > +**/ > > +BOOLEAN > > +StandardSignatureIsAuthenticAMD ( > > + VOID > > + ) > > +{ > > + UINT32 RegEbx; > > + UINT32 RegEcx; > > + UINT32 RegEdx; > > + > > + AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > > + return (RegEbx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && > > + RegEcx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && > > + RegEdx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); > > +} > > + > > /** > > The function will check if BSP Execute Disable is enabled. > > > > @@ -564,8 +589,13 @@ InitializeApData ( > > CpuMpData->CpuData[ProcessorNumber].Waiting =3D FALSE; > > CpuMpData->CpuData[ProcessorNumber].CpuHealthy =3D (BistData =3D=3D= 0) ? > > TRUE : FALSE; > > > > - PlatformIdMsr.Uint64 =3D AsmReadMsr64 (MSR_IA32_PLATFORM_ID); > > - CpuMpData->CpuData[ProcessorNumber].PlatformId =3D (UINT8) > > PlatformIdMsr.Bits.PlatformId; > > + // > > + // NOTE: PlatformId is not relevant on AMD platforms. > > + // > > + if (!StandardSignatureIsAuthenticAMD ()) { > > + PlatformIdMsr.Uint64 =3D AsmReadMsr64 (MSR_IA32_PLATFORM_ID); > > + CpuMpData->CpuData[ProcessorNumber].PlatformId =3D > > (UINT8)PlatformIdMsr.Bits.PlatformId; > > + } > > > > AsmCpuid ( > > CPUID_VERSION_INFO, > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h > > b/UefiCpuPkg/Library/MpInitLib/MpLib.h > > old mode 100644 > > new mode 100755 > > index 455cb3f..0c89f8a > > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h > > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h > > @@ -2,6 +2,8 @@ > > Common header file for MP Initialize Library. > > > > Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.<= BR> > > + Copyright (c) 2020, AMD Inc. All rights reserved.
> > + > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -12,6 +14,7 @@ > > #include > > > > #include > > +#include > > #include > > #include > > #include > > -- > > 2.7.4 >=20 >=20 >=20