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.15044.1582985505875782490 for ; Sat, 29 Feb 2020 06:11:46 -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 fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Feb 2020 06:11:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,500,1574150400"; d="scan'208";a="273007351" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 29 Feb 2020 06:11:45 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 29 Feb 2020 06:11:45 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 29 Feb 2020 06:11:44 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.206]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.86]) with mapi id 14.03.0439.000; Sat, 29 Feb 2020 22:11:42 +0800 From: "Ni, Ray" To: Laszlo Ersek , Leo Duran , "devel@edk2.groups.io" CC: "Dong, Eric" Subject: Re: [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors. Thread-Topic: [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors. Thread-Index: AQHV7mkNTZnT+GGt/kiQIov2Fg4Lh6gxQfAAgAD1P5A= Date: Sat, 29 Feb 2020 14:11:41 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C46FDE3@SHSMSX104.ccr.corp.intel.com> References: <1582916283-29137-1-git-send-email-leo.duran@amd.com> <1582916283-29137-2-git-send-email-leo.duran@amd.com> <26bfc5b1-3dff-a188-7558-15a84397a059@redhat.com> In-Reply-To: <26bfc5b1-3dff-a188-7558-15a84397a059@redhat.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action 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 Did you try the build? I saw "error C2065: CPUID_SIGNATURE_AUTHENTIC_AMD_EBX: undeclared identifie= r" in my internal build report with this patch. Thanks, Ray > -----Original Message----- > From: Laszlo Ersek > Sent: Saturday, February 29, 2020 3:33 PM > To: Leo Duran ; devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray > Subject: Re: [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD= processors. >=20 > On 02/28/20 19:58, Leo Duran wrote: > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2556 > > > > This patch uses CPUID signature check to skip reading the PlatformId MS= R, > > which is not implemented on AMD processors. > > > > The PlatformId is used for loading microcode patches, which is also not > > supported and AMD-based platforms. To mitigate the PlatformId dependenc= y, > > PcdCpuMicrocodePatchAddress and PcdCpuMicrodePatchRegionSize must be se= t > > 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 ++++++++++++++++++++++++++++= ++++-- > > 1 file changed, 32 insertions(+), 2 deletions(-) > > > > 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. > > + 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) PlatformI= dMsr.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)Platform= IdMsr.Bits.PlatformId; > > + } > > > > AsmCpuid ( > > CPUID_VERSION_INFO, > > >=20 > Reviewed-by: Laszlo Ersek