From: "Ni, Ray" <ray.ni@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly
Date: Wed, 3 Apr 2019 08:09:45 +0000 [thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C0C82C1@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <ED077930C258884BBCB450DB737E662259DF8935@shsmsx102.ccr.corp.intel.com>
> -----Original Message-----
> From: Dong, Eric <eric.dong@intel.com>
> Sent: Wednesday, April 3, 2019 2:40 PM
> To: Ni, Ray <ray.ni@intel.com>; edk2-devel@lists.01.org
> Subject: RE: [PATCH] UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly
>
> Hi Ray,
>
> > -----Original Message-----
> > From: Ni, Ray
> > Sent: Friday, March 29, 2019 4:42 PM
> > To: edk2-devel@lists.01.org
> > Cc: Dong, Eric <eric.dong@intel.com>
> > Subject: [PATCH] UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly
> >
> > Leaf 1FH is very similar to leaf 0BH. Both return the CPU topology
> information.
> > 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.
> >
> > But today's logic to handle 1FH is completely wrong.
> > The patch combines them together to fix the 1FH issue.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ray Ni <ray.ni@intel.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > ---
> > UefiCpuPkg/Application/Cpuid/Cpuid.c | 83
> > ++++++++++------------------
> > 1 file changed, 28 insertions(+), 55 deletions(-)
> >
> > diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c
> > b/UefiCpuPkg/Application/Cpuid/Cpuid.c
> > index 67cacf2714..3d242a0cbf 100644
> > --- a/UefiCpuPkg/Application/Cpuid/Cpuid.c
> > +++ b/UefiCpuPkg/Application/Cpuid/Cpuid.c
> > @@ -1,7 +1,7 @@
> > /** @file
> > UEFI Application to display CPUID leaf information.
> >
> > - Copyright (c) 2016 - 2018, Intel Corporation. All rights
> > reserved.<BR>
> > + Copyright (c) 2016 - 2019, Intel Corporation. All rights
> > + reserved.<BR>
> > This program and the accompanying materials
> > are licensed and made available under the terms and conditions of
> > the BSD License
> > which accompanies this distribution. The full text of the license
> > may be found at @@ -717,36 +717,42 @@
> > CpuidArchitecturalPerformanceMonitoring ( **/ VOID
> > CpuidExtendedTopology (
> > - VOID
> > + UINT32 LeafFunction
> > )
> > {
> > - CPUID_EXTENDED_TOPOLOGY_EAX Eax;
> > - CPUID_EXTENDED_TOPOLOGY_EBX Ebx;
> > - CPUID_EXTENDED_TOPOLOGY_ECX Ecx;
> > - UINT32 Edx;
> > - UINT32 LevelNumber;
> > + CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX Eax;
> > + CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX Ebx;
> > + CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX Ecx;
> > + UINT32 Edx;
> > + UINT32 LevelNumber;
> >
> > - if (CPUID_EXTENDED_TOPOLOGY > gMaximumBasicFunction) {
> > + if (LeafFunction > gMaximumBasicFunction) {
> > + return;
> > + }
> > + if ((LeafFunction != CPUID_EXTENDED_TOPOLOGY) && (LeafFunction !=
> > + CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION)) {
> > return;
> > }
> >
> > LevelNumber = 0;
> > - do {
> > + for (LevelNumber = 0; ; LevelNumber++) {
> > AsmCpuidEx (
> > - CPUID_EXTENDED_TOPOLOGY, LevelNumber,
> > + LeafFunction, LevelNumber,
> > &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx
> > );
> > - if (Eax.Bits.ApicIdShift != 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 ==
> > CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_INVALID)
> {
> > + break;
> > }
> > - LevelNumber++;
> > - } while (Eax.Bits.ApicIdShift != 0);
> > + Print (
> > + L"%a (Leaf %08x, Sub-Leaf %08x)\n",
> > + LeafFunction == CPUID_EXTENDED_TOPOLOGY ?
> > "CPUID_EXTENDED_TOPOLOGY" :
> > "CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION-2",
> > + LeafFunction, LevelNumber);
> > + Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32,
> > Ebx.Uint32, Ecx.Uint32, Edx);
> > + PRINT_BIT_FIELD (Eax, BitsNum);
> > + PRINT_BIT_FIELD (Ebx, ProcessorsNum);
> > + PRINT_BIT_FIELD (Ecx, LevelNum);
> > + PRINT_BIT_FIELD (Ecx, LevelType);
> > + PRINT_VALUE (Edx, x2APIC_ID);
>
> The name for above fields are different in CPUID_EXTENDED_TOPOLOGY and
> CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION,
> So I think above print are not correct for CPUID_EXTENDED_TOPOLOGY, right?
>
Per IA32 SDM, CPUID leaf 0BH and 1FH are very similar except 1FH returns more
level types than that of 0BH.
If you compare the accordingly output EAX/EBX, ECX, EDX, the structure definitions
are the same except the field names are different.
I don't know why the field names are different when the new structure definitions
were added for 1FH.
prev parent reply other threads:[~2019-04-03 8:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 8:41 [PATCH] UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly Ray Ni
2019-04-03 6:39 ` Dong, Eric
2019-04-03 8:09 ` Ni, Ray [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=734D49CCEBEEF84792F5B80ED585239D5C0C82C1@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox