From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: eric.dong@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Thu, 25 Apr 2019 17:04:52 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2019 17:04:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,395,1549958400"; d="scan'208";a="138899565" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 25 Apr 2019 17:04:51 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 25 Apr 2019 17:04:51 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 25 Apr 2019 17:04:51 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.42]) with mapi id 14.03.0415.000; Fri, 26 Apr 2019 08:04:49 +0800 From: "Dong, Eric" To: "Kinney, Michael D" , "devel@edk2.groups.io" CC: "Ni, Ray" , Laszlo Ersek Subject: Re: [Patch 2/4] UefiCpuPkg/MpInitLib: Avoid MSR_IA32_APIC_BASE for single core Thread-Topic: [Patch 2/4] UefiCpuPkg/MpInitLib: Avoid MSR_IA32_APIC_BASE for single core Thread-Index: AQHU+4/SG3hSPu9no06YEk1GNj+iWqZNkB3A Date: Fri, 26 Apr 2019 00:04:48 +0000 Message-ID: References: <20190425175334.5944-1-michael.d.kinney@intel.com> <20190425175334.5944-3-michael.d.kinney@intel.com> In-Reply-To: <20190425175334.5944-3-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: eric.dong@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: Kinney, Michael D > Sent: Friday, April 26, 2019 1:54 AM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray ; Laszlo > Ersek > Subject: [Patch 2/4] UefiCpuPkg/MpInitLib: Avoid MSR_IA32_APIC_BASE for > single core >=20 > Avoid access to MSR_IA32_APIC_BASE that may not be supported > on single core CPUs. If PcdCpuMaxLogicalProcessorNumber is 1, > then there is only one CPU that must be the BSP. >=20 > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Michael D Kinney > --- > UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c > b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c > index 35dff91fd2..5488049c08 100644 > --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c > @@ -1,7 +1,7 @@ > /** @file > MP initialize support functions for PEI phase. >=20 > - Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
> + Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -101,6 +101,19 @@ GetCpuMpData ( > MSR_IA32_APIC_BASE_REGISTER ApicBaseMsr; > IA32_DESCRIPTOR Idtr; >=20 > + // > + // If there is only 1 CPU, then it must be the BSP. This avoids an ac= cess to > + // MSR_IA32_APIC_BASE that may not be supported on single core CPUs. > + // > + if (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) =3D=3D 1) { > + CpuMpData =3D GetCpuMpDataFromGuidedHob (); > + ASSERT (CpuMpData !=3D NULL); > + return CpuMpData; > + } > + > + // > + // Otherwise use MSR_IA32_APIC_BASE to determine if the CPU is BSP or > AP. > + // > ApicBaseMsr.Uint64 =3D AsmReadMsr64 (MSR_IA32_APIC_BASE); > if (ApicBaseMsr.Bits.BSP =3D=3D 1) { > CpuMpData =3D GetCpuMpDataFromGuidedHob (); > -- > 2.21.0.windows.1