public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nhi Pham" <nhi@os.amperecomputing.com>
To: Leif Lindholm <quic_llindhol@quicinc.com>, devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@nuviainc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Wenyi Xie <xiewenyi2@huawei.com>,
	Peng Xie <xiepeng@phytium.com.cn>,
	Ling Jia <jialing@phytium.com.cn>,
	Yiqi Shu <shuyiqi@phytium.com.cn>,
	Vu Nguyen <vunguyen@os.amperecomputing.com>,
	Thang Nguyen <thang@os.amperecomputing.com>,
	Chuong Tran <chuong@os.amperecomputing.com>,
	Pete Batard <pete@akeo.ie>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Graeme Gregory <graeme@nuviainc.com>,
	Radoslaw Biernacki <rad@semihalf.com>,
	Marcin Wojtas <mw@semihalf.com>
Subject: Re: [edk2-devel] [PATCH v2 14/17] Silicon/Ampere: Update ArmPlatformLib to work with changed ARM_CORE_INFO
Date: Sat, 26 Mar 2022 16:12:07 +0700	[thread overview]
Message-ID: <c1192174-cabc-5e2d-ad4e-3c18c1aa3d1d@os.amperecomputing.com> (raw)
In-Reply-To: <Yj3uHmit+pj1ZsPL@qc-i7.hemma.eciton.net>

Hi Leif,

On 25/03/2022 23:30, Leif Lindholm wrote:
> Hi Nhi,
>
> On Sun, Dec 19, 2021 at 10:35:41 +0700, Nhi Pham via groups.io wrote:
>> Hi Rebecca,
>>
>> Leif is merging the rest of Altra port to the edk2-platforms which has SRAT
>> ACPI table consuming the CPU Core Info table. Therefore, we will need to fix
>> the SRAT too. I would defer the fix until the Altra port is fully merged.
>>
>> On 17/12/2021 05:07, Rebecca Cran wrote:
>>> The ARM_CORE_INFO struct has been updated so the MPIDR is now a single
>>> field instead of separate cluster/core fields. Update ArmPlatformLib.
>>>
>>> Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
>>> ---
>>>    Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c | 5 ++---
>>>    1 file changed, 2 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c
>>> index 5b4be0e55516..f2ec923d6f8d 100644
>>> --- a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c
>>> +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c
>>> @@ -108,9 +108,8 @@ PrePeiCoreGetMpCoreInfo (
>>>        }
>>>        SocketId = SOCKET_ID (Index);
>>>        ClusterId = CLUSTER_ID (Index);
>>> -    mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].ClusterId = SocketId;
>>> -    mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].CoreId =
>>> -      (ClusterId << 8) | (Index % PLATFORM_CPU_NUM_CORES_PER_CPM);
>>> +    mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].Mpidr = GET_MPID (
>>> +      SocketId, (ClusterId << 8) | (Index % PLATFORM_CPU_NUM_CORES_PER_CPM));
>> For Ampere Altra, the correct MPIDR encoding is SocketId << 32 | ClusterId
>> << 16 | (Index % PLATFORM_CPU_NUM_CORES_PER_CPM) << 8
>>
>> It would be the same what
>> Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMadt.c (not available
>> yet - being merged in) is describing.
> This patch already got merged, so if you feel it is wrong, could you
> submit a fix please?
>
> The next patch for me to push from your set otherwise also requires
> some changes. My naïve attempt would look something like:
>
> diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c
> index 906b771a250c..d5bc732b08bb 100644
> --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c
> +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c
> @@ -7,6 +7,7 @@
>   **/
>   
>   #include <Guid/ArmMpCoreInfo.h>
> +#include <Library/ArmLib.h>
>   #include "AcpiPlatform.h"
>   
>   EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER SRATTableHeaderTemplate = {
> @@ -119,6 +120,7 @@ SratAddGiccAffinity (
>     UINTN               Count, NumNode, Idx;
>     UINT32              AcpiProcessorUid;
>     UINT8               Socket;
> +  UINT8               Core;
>     UINT8               Cpm;
>   
>     for (Idx = 0; Idx < gST->NumberOfTableEntries; Idx++) {
> @@ -137,14 +139,14 @@ SratAddGiccAffinity (
>     NumNode = 0;
>     while (Count != ArmProcessorTable->NumberOfEntries) {
>       for (Idx = 0; Idx < ArmProcessorTable->NumberOfEntries; Idx++ ) {
> -      Socket = ArmCoreInfoTable[Idx].ClusterId;
> -      Cpm = (ArmCoreInfoTable[Idx].CoreId >> PLATFORM_CPM_UID_BIT_OFFSET);
> +      Socket = GET_MPIDR_AFF1 (ArmCoreInfoTable[Idx].Mpidr);
> +      Core   = GET_MPIDR_AFF0 (ArmCoreInfoTable[Idx].Mpidr);
> +      Cpm = Core >> PLATFORM_CPM_UID_BIT_OFFSET;
>         if (CpuGetSubNumNode (Socket, Cpm) != NumNode) {
>           /* We add nodes based on ProximityDomain order */
>           continue;
>         }
> -      AcpiProcessorUid = (ArmCoreInfoTable[Idx].ClusterId << PLATFORM_SOCKET_UID_BIT_OFFSET) +
> -                         ArmCoreInfoTable[Idx].CoreId;
> +      AcpiProcessorUid = (Socket << PLATFORM_SOCKET_UID_BIT_OFFSET) + Core;
>         ZeroMem ((VOID *)&SratGiccAffinity[Count], sizeof (SratGiccAffinity[Count]));
>         SratGiccAffinity[Count].AcpiProcessorUid = AcpiProcessorUid;
>         SratGiccAffinity[Count].Flags = 1;
>
> Would you be happy for me to fold that into
> "AmpereAltraPkg, JadePkg: Add ACPI support", or would you be able to
> submit a v6 of that patch only?
>
> Best Regards,
>
> Leif

Thanks much for the patch. The MPIDR decoding matches with Rebecca's 
update for the ArmPlatformLib earlier and the ARM_CORE_INFO is just 
consumed in the AcpiSrat.c. So, that is good for now. Please help fold 
that into the ACPI patch when merging the rest of the Mt. Jade support 
patchset.

In the future, I will follow up with a patch that makes the 
representation of MPIDR in the ARM_CORE_INFO the same as in MADT table.

Thanks,

Nhi


  reply	other threads:[~2022-03-26  9:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 22:07 [PATCH v2 00/17] Update Arm platforms following addition of EFI_MP_SERVICES_PROTOCOL support in edk2 Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 01/17] Platform/ARM: Add MpInitLib instance Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 02/17] Platform/Socionext: Add instance of MpInitLib Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 03/17] Silicon/Marvell: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 04/17] Platform/Qemu: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 05/17] Platform/ARM: Update ARM_CORE_INFO initializer for MPIDR field change Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 06/17] Silicon/Marvell: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 07/17] Silicon/Socionext: " Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 08/17] Silicon/Qemu: " Rebecca Cran
2021-12-21 14:34   ` Graeme Gregory
2021-12-16 22:07 ` [PATCH v2 09/17] Platform/AMD: Add instance of MpInitLib to OverdriveBoard.dsc Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 10/17] Platform/SoftIron: Add instance of MpInitLib to Overdrive1000Board.dsc Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 11/17] Platform/RaspberryPi: Add instance of MpInitLib to RPi3.dsc and RPi4.dsc Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 12/17] Silicon/AMD: Update Styx code to work with changes ARM_CORE_INFO struct Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 13/17] Silicon/Ampere: Add instance of MpInitLib to AmpereAltraPkg.dsc Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 14/17] Silicon/Ampere: Update ArmPlatformLib to work with changed ARM_CORE_INFO Rebecca Cran
2021-12-19  3:35   ` Nhi Pham
2022-01-30 10:36     ` Ard Biesheuvel
2022-01-31 12:08       ` Leif Lindholm
2022-02-08  3:41         ` Nhi Pham
2022-02-08  3:45       ` Nhi Pham
2022-03-25 16:30     ` [edk2-devel] " Leif Lindholm
2022-03-26  9:12       ` Nhi Pham [this message]
2022-03-26 22:00         ` Leif Lindholm
2022-03-29  2:57           ` Nhi Pham
2021-12-16 22:07 ` [PATCH v2 15/17] Silicon/Phytium: Add instance of MpInitLib to PhytiumCommonPkg.dsc.inf Rebecca Cran
2021-12-16 22:07 ` [PATCH v2 16/17] Silicon/Phytium: Update FT2000-4Pkg PlatformLib for ARM_CORE_INFO change Rebecca Cran
2021-12-16 22:08 ` [PATCH v2 17/17] Silicon/Hisilicon: Add instance of MpInitLib to Hisilicon.dsc.inc Rebecca Cran
2022-01-30 11:01 ` [PATCH v2 00/17] Update Arm platforms following addition of EFI_MP_SERVICES_PROTOCOL support in edk2 Ard Biesheuvel
2022-01-31  9:07   ` Sami Mujawar

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=c1192174-cabc-5e2d-ad4e-3c18c1aa3d1d@os.amperecomputing.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