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.20, mailfrom: eric.dong@intel.com) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Wed, 03 Apr 2019 23:24:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2019 23:24:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,306,1549958400"; d="scan'208";a="158094113" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 03 Apr 2019 23:24:12 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 3 Apr 2019 23:24:12 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 3 Apr 2019 23:24:11 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.21]) with mapi id 14.03.0415.000; Thu, 4 Apr 2019 14:24:09 +0800 From: "Dong, Eric" To: "devel@edk2.groups.io" , "Ni, Ray" CC: "Zeng, Star" , "Qin, Zhiqiang" Subject: Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly Thread-Topic: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly Thread-Index: AQHU6quxrgmwQAxdQkm8yK69VjPUfKYriKNA Date: Thu, 4 Apr 2019 06:24:09 +0000 Message-ID: References: <20190404060306.168500-1-ray.ni@intel.com> <20190404060306.168500-3-ray.ni@intel.com> In-Reply-To: <20190404060306.168500-3-ray.ni@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: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ni= , > Ray > Sent: Thursday, April 4, 2019 2:03 PM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Zeng, Star ; = Qin, > Zhiqiang > Subject: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/Cpuid: Dump leaf 1FH > information correctly >=20 > Leaf 1FH is very similar to leaf 0BH. Both return the CPU topology infor= mation. > Leaf 0BH returns 3-level (Package/Core/Thread) CPU topology info. > Leaf 1FH returns 6-level (Package/Die/Tile/Module/Core/Thread) CPU > topology info. > The logic to enumerate the topology info is the same. >=20 > But today's logic to handle 1FH is completely wrong. > The patch combines them together to fix the 1FH issue. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ray Ni > Cc: Eric Dong > Cc: Star Zeng > Cc: Zhiqiang Qin > --- > UefiCpuPkg/Application/Cpuid/Cpuid.c | 72 +++++++++------------------- > 1 file changed, 23 insertions(+), 49 deletions(-) >=20 > diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c > b/UefiCpuPkg/Application/Cpuid/Cpuid.c > index d229ac8e7b..30d43e9631 100644 > --- a/UefiCpuPkg/Application/Cpuid/Cpuid.c > +++ b/UefiCpuPkg/Application/Cpuid/Cpuid.c > @@ -717,7 +717,7 @@ CpuidArchitecturalPerformanceMonitoring ( **/ > VOID CpuidExtendedTopology ( > - VOID > + UINT32 LeafFunction > ) > { > CPUID_EXTENDED_TOPOLOGY_EAX Eax; > @@ -726,27 +726,34 @@ CpuidExtendedTopology ( > UINT32 Edx; > UINT32 LevelNumber; >=20 > - if (CPUID_EXTENDED_TOPOLOGY > gMaximumBasicFunction) { > + if (LeafFunction > gMaximumBasicFunction) { > + return; > + } > + if ((LeafFunction !=3D CPUID_EXTENDED_TOPOLOGY) && (LeafFunction !=3D > + CPUID_V2_EXTENDED_TOPOLOGY)) { > return; > } >=20 > LevelNumber =3D 0; > - do { > + for (LevelNumber =3D 0; ; LevelNumber++) { > AsmCpuidEx ( > - CPUID_EXTENDED_TOPOLOGY, LevelNumber, > + LeafFunction, LevelNumber, > &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx > ); > - if (Eax.Bits.ApicIdShift !=3D 0) { > - Print (L"CPUID_EXTENDED_TOPOLOGY (Leaf %08x, Sub-Leaf %08x)\n", > CPUID_EXTENDED_TOPOLOGY, LevelNumber); > - Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, > Ebx.Uint32, Ecx.Uint32, Edx); > - PRINT_BIT_FIELD (Eax, ApicIdShift); > - PRINT_BIT_FIELD (Ebx, LogicalProcessors); > - PRINT_BIT_FIELD (Ecx, LevelNumber); > - PRINT_BIT_FIELD (Ecx, LevelType); > - PRINT_VALUE (Edx, x2APIC_ID); > + if (Ecx.Bits.LevelType =3D=3D > CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_INVALID) { > + break; > } > - LevelNumber++; > - } while (Eax.Bits.ApicIdShift !=3D 0); > + Print ( > + L"%a (Leaf %08x, Sub-Leaf %08x)\n", > + LeafFunction =3D=3D CPUID_EXTENDED_TOPOLOGY ? > "CPUID_EXTENDED_TOPOLOGY" : "CPUID_V2_EXTENDED_TOPOLOGY", > + LeafFunction, LevelNumber > + ); > + Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, > Ebx.Uint32, Ecx.Uint32, Edx); > + PRINT_BIT_FIELD (Eax, ApicIdShift); > + PRINT_BIT_FIELD (Ebx, LogicalProcessors); > + PRINT_BIT_FIELD (Ecx, LevelNumber); > + PRINT_BIT_FIELD (Ecx, LevelType); > + PRINT_VALUE (Edx, x2APIC_ID); > + } > } >=20 > /** > @@ -1385,39 +1392,6 @@ CpuidDeterministicAddressTranslationParameters > ( > PRINT_BIT_FIELD (Edx, MaximumNum); > } >=20 > -/** > - Display CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION main leaf and > sub-leafs. > - > -**/ > -VOID > -CpuidV2ExtendedTopologyEnumeration ( > - VOID > - ) > -{ > - CPUID_EXTENDED_TOPOLOGY_EAX Eax; > - CPUID_EXTENDED_TOPOLOGY_EBX Ebx; > - CPUID_EXTENDED_TOPOLOGY_ECX Ecx; > - UINT32 Edx; > - > - if (CPUID_V2_EXTENDED_TOPOLOGY > gMaximumBasicFunction) { > - return; > - } > - > - AsmCpuidEx ( > - CPUID_V2_EXTENDED_TOPOLOGY, > - 0, > - &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx > - ); > - Print (L"CPUID_V2_EXTENDED_TOPOLOGY (Leaf %08x, Sub-Leaf %08x)\n", > CPUID_V2_EXTENDED_TOPOLOGY, 0); > - Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, > Ebx.Uint32, Ecx.Uint32, Edx); > - > - PRINT_BIT_FIELD (Eax, ApicIdShift); > - PRINT_BIT_FIELD (Ebx, LogicalProcessors); > - PRINT_BIT_FIELD (Ecx, LevelNumber); > - PRINT_BIT_FIELD (Ecx, LevelType); > - PRINT_VALUE (Edx, x2APICID); > -} > - > /** > Display CPUID_EXTENDED_FUNCTION leaf. >=20 > @@ -1619,7 +1593,7 @@ UefiMain ( > CpuidStructuredExtendedFeatureFlags (); > CpuidDirectCacheAccessInfo(); > CpuidArchitecturalPerformanceMonitoring (); > - CpuidExtendedTopology (); > + CpuidExtendedTopology (CPUID_EXTENDED_TOPOLOGY); > CpuidExtendedStateMainLeaf (); > CpuidIntelRdtMonitoringEnumerationSubLeaf (); > CpuidIntelRdtMonitoringL3CacheCapabilitySubLeaf (); @@ -1630,7 +1604,= 7 > @@ UefiMain ( > CpuidProcessorFrequency (); > CpuidSocVendor (); > CpuidDeterministicAddressTranslationParameters (); > - CpuidV2ExtendedTopologyEnumeration (); > + CpuidExtendedTopology (CPUID_V2_EXTENDED_TOPOLOGY); > CpuidExtendedFunction (); > CpuidExtendedCpuSig (); > CpuidProcessorBrandString (); > -- > 2.21.0.windows.1 >=20 >=20 >=20