From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.8602.1583114378301954699 for ; Sun, 01 Mar 2020 17:59:38 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, 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 fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2020 17:59:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,506,1574150400"; d="scan'208";a="318762348" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 01 Mar 2020 17:59:37 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 1 Mar 2020 17:59:35 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 1 Mar 2020 17:59:35 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.206]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.43]) with mapi id 14.03.0439.000; Mon, 2 Mar 2020 09:59:33 +0800 From: "Ni, Ray" To: Leo Duran , "devel@edk2.groups.io" CC: "Dong, Eric" , Laszlo Ersek Subject: Re: [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors. Thread-Topic: [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors. Thread-Index: AQHV7xHFPFn++iMZKkGu3xeXtPCoM6g0jfLg Date: Mon, 2 Mar 2020 01:59:32 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C472CE9@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> In-Reply-To: <1582988745-1189-2-git-send-email-leo.duran@amd.com> 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 Leo, The function name is the same as another local function defined in LocalApi= cLib. You may need to add a STATIC keyword for this local function, or change it = to a different name. Thanks, Ray > -----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. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2556 >=20 > This patch uses CPUID signature check to skip reading the PlatformId MSR, > which is not implemented on AMD processors. >=20 > The PlatformId is used for loading microcode patches, which is also not > 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. >=20 > 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 >=20 > 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. >=20 > Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> + Copyright (c) 2020, AMD Inc. All rights reserved.
> + > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -10,6 +12,29 @@ >=20 > EFI_GUID mCpuInitMpLibHobGuid =3D CPU_INIT_MP_LIB_HOB_GUID; >=20 > + > +/** > + 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. >=20 > @@ -564,8 +589,13 @@ InitializeApData ( > CpuMpData->CpuData[ProcessorNumber].Waiting =3D FALSE; > CpuMpData->CpuData[ProcessorNumber].CpuHealthy =3D (BistData =3D=3D 0)= ? > TRUE : FALSE; >=20 > - 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; > + } >=20 > 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. >=20 > Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> + Copyright (c) 2020, AMD Inc. All rights reserved.
> + > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -12,6 +14,7 @@ > #include >=20 > #include > +#include > #include > #include > #include > -- > 2.7.4