public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: Abdul Lateef Attar <abdattar@amd.com>
Cc: devel@edk2.groups.io,
	Abdul Lateef Attar <AbdulLateef.Attar@amd.com>,
	 Ray Ni <ray.ni@intel.com>, Rahul Kumar <rahul1.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/BaseXApic[X2]ApicLib: Implements AMD extended cpu topology
Date: Wed, 17 Jan 2024 16:16:10 +0100	[thread overview]
Message-ID: <6n74ynm4bswoix5naeo4lcbsyled6b3ekirjtquyvup5y565fr@mnl3hqx4lkl3> (raw)
In-Reply-To: <64839533d33fb34b1568d78d26c5e7900c40cad5.1705484942.git.AbdulLateef.Attar@amd.com>

> +  /// Check if extended toplogy supported
> +  AsmCpuid (CPUID_EXTENDED_FUNCTION, &MaxExtendedCpuIdIndex, NULL, NULL, NULL);
> +  if (MaxExtendedCpuIdIndex >= AMD_CPUID_EXTENDED_TOPOLOGY) {
> +    do {
> +      AsmCpuidEx (
> +        AMD_CPUID_EXTENDED_TOPOLOGY,
> +        TopologyLevel,
> +        &ExtendedTopologyEax.Uint32,
> +        &ExtendedTopologyEbx.Uint32,
> +        &ExtendedTopologyEcx.Uint32,
> +        NULL
> +        );
> +
> +      if (ExtendedTopologyEbx.Bits.LogicalProcessors == CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_INVALID) {

Comparing LogicalProcessors with CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_*
looks wrong, even though it probably works due to
CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_INVALID being zero ...

> +        /// if this fails at first level
> +        /// then will fall back to non-extended topology
> +        break;
> +      }

> +    } while (ExtendedTopologyEbx.Bits.LogicalProcessors != CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_INVALID);

Same here.  Also this will never be false because the check above
already quits the loop in that case, so you can simplify this to
"while (true)".

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113954): https://edk2.groups.io/g/devel/message/113954
Mute This Topic: https://groups.io/mt/103782768/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      reply	other threads:[~2024-01-17 15:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17  9:55 [edk2-devel] [PATCH v2 0/2] AMD CPU extended topology Abdul Lateef Attar via groups.io
2024-01-17  9:55 ` [edk2-devel] [PATCH v2 1/2] MdePkg: Adds AMD Extended CPU topology CPUID Abdul Lateef Attar via groups.io
2024-01-17 15:17   ` Gerd Hoffmann
2024-01-17  9:55 ` [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/BaseXApic[X2]ApicLib: Implements AMD extended cpu topology Abdul Lateef Attar via groups.io
2024-01-17 15:16   ` Gerd Hoffmann [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=6n74ynm4bswoix5naeo4lcbsyled6b3ekirjtquyvup5y565fr@mnl3hqx4lkl3 \
    --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