public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, jiaxin.wu@intel.com
Cc: Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Rahul Kumar <rahul1.kumar@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Star Zeng <star.zeng@intel.com>
Subject: Re: [edk2-devel] [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Use processor extended information
Date: Mon, 13 Nov 2023 16:38:54 +0100	[thread overview]
Message-ID: <fbd7da51-7294-090d-cc94-c3d16b2c40c7@redhat.com> (raw)
In-Reply-To: <4414f894-42c6-9c4b-df6d-ee5cbddc791a@redhat.com>

On 11/13/23 16:38, Laszlo Ersek wrote:
> On 11/7/23 03:43, Wu, Jiaxin wrote:
>> Processor extended information is filled when
>> CPU_V2_EXTENDED_TOPOLOGY is set in parameter ProcessorNumber
>> from GetProcessorInfo() (See commit: 1fadd18d).
>>
>> This filed value is retrieved from CPUID leaf 1FH, which is
>> a preferred superset to leaf 0BH.
>>
>> Since Intel recommends first use the CPUID leaf 1FH instead of
>> leaf 0BH, this patch change to use the processor extended
>> information, which can reflect the value from CPUID leaf 1FH.
>>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Cc: Star Zeng <star.zeng@intel.com>
>> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
>> ---
>>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c | 10 ++++++++++
>>  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  6 +++---
>>  2 files changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
>> index 391b64e9f2..c0485b0519 100644
>> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
>> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c
>> @@ -169,10 +169,20 @@ SmmAddProcessor (
>>          &gSmmCpuPrivate->ProcessorInfo[Index].Location.Package,
>>          &gSmmCpuPrivate->ProcessorInfo[Index].Location.Core,
>>          &gSmmCpuPrivate->ProcessorInfo[Index].Location.Thread
>>          );
>>  
>> +      GetProcessorLocation2ByApicId (
>> +        (UINT32)ProcessorId,
>> +        &gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Package,
>> +        &gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Die,
>> +        &gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Tile,
>> +        &gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Module,
>> +        &gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Core,
>> +        &gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Thread
>> +        );
>> +
>>        *ProcessorNumber                 = Index;
>>        gSmmCpuPrivate->Operation[Index] = SmmCpuAdd;
>>        return EFI_SUCCESS;
>>      }
>>    }
>> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
>> index 25d058c5b9..c61562c867 100644
>> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
>> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
>> @@ -177,11 +177,11 @@ IsPackageFirstThread (
>>    IN UINTN  CpuIndex
>>    )
>>  {
>>    UINT32  PackageIndex;
>>  
>> -  PackageIndex =  gSmmCpuPrivate->ProcessorInfo[CpuIndex].Location.Package;
>> +  PackageIndex =  gSmmCpuPrivate->ProcessorInfo[CpuIndex].ExtendedInformation.Location2.Package;
>>  
>>    ASSERT (mPackageFirstThreadIndex != NULL);
>>  
>>    //
>>    // Set the value of mPackageFirstThreadIndex[PackageIndex].
>> @@ -1834,12 +1834,12 @@ InitPackageFirstThreadIndexInfo (
>>  
>>    //
>>    // Count the number of package, set to max PackageId + 1
>>    //
>>    for (Index = 0; Index < mNumberOfCpus; Index++) {
>> -    if (PackageId < gSmmCpuPrivate->ProcessorInfo[Index].Location.Package) {
>> -      PackageId = gSmmCpuPrivate->ProcessorInfo[Index].Location.Package;
>> +    if (PackageId < gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Package) {
>> +      PackageId = gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Package;
>>      }
>>    }
>>  
>>    PackageCount = PackageId + 1;
>>  
> 
> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
> 

also

Reviewed-by: Laszlo Ersek <lersek@redhat.com>



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



      reply	other threads:[~2023-11-13 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  2:43 [edk2-devel] [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Use processor extended information Wu, Jiaxin
2023-11-07 18:40 ` Laszlo Ersek
2023-11-07 18:44   ` Laszlo Ersek
2023-11-08  4:11     ` Wu, Jiaxin
2023-11-13 11:31       ` Laszlo Ersek
2023-11-13 15:38 ` Laszlo Ersek
2023-11-13 15:38   ` Laszlo Ersek [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=fbd7da51-7294-090d-cc94-c3d16b2c40c7@redhat.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