public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <quic_llindhol@quicinc.com>
To: <devel@edk2.groups.io>, <nhi@os.amperecomputing.com>
Cc: Rebecca Cran <rebecca@bsdio.com>, <ardb@kernel.org>,
	Rebecca Cran <rebecca@quicinc.com>, <patches@amperecomputing.com>,
	<ardb+tianocore@kernel.org>,
	Tinh Nguyen <tinhnguyen@os.amperecomputing.com>,
	<harb@amperecomputing.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] AmpereAltraPkg: Update ArmPlatformLib to work with changed ARM_CORE_INFO
Date: Wed, 15 Feb 2023 11:28:40 +0000	[thread overview]
Message-ID: <Y+zB6NpgBNDx+BbO@qc-i7.hemma.eciton.net> (raw)
In-Reply-To: <3b16465b-6f2a-8bda-98b5-ddfbef68aa41@amperemail.onmicrosoft.com>

On Tue, Jan 31, 2023 at 13:35:50 +0700, Nhi Pham via groups.io wrote:
> Hi Rebecca,
> 
> ++ Harb who can give more insights on this. FYI, the original concern is
> https://edk2.groups.io/g/devel/message/98482
> 
> On 1/18/2023 1:21 AM, Rebecca Cran wrote:
> > On 1/17/23 09:40, Ard Biesheuvel wrote:
> > > On Tue, 17 Jan 2023 at 13:55, Rebecca Cran<rebecca@quicinc.com>  wrote:
> > > > I was under the impression that this is becoming a more standard format?
> > > > 
> > > If this is not defined in an ARM spec somewhere, we shouldn't add it
> > > to ArmPkg at this point.
> > 
> > From what I've found, the ARM specs such as the Arm Architecture
> > Reference Manual for A-profile architecture don't define the meaning of
> > the affinity fields? That appears to be left up to the individual Arm
> > core TRMs.
> 
> I think so. This might be silicon specific implementation.
> 
> Per Arm Armv8-A Architecture Registers (https://developer.arm.com/documentation/ddi0595/2021-12/AArch64-Registers/MPIDR-EL1--Multiprocessor-Affinity-Register),
> if I interpret correctly, the AFF0 will give core ID or thread ID based on
> the MT bit in the MPIDR register.
> 
> I think we should remove the following definitions particularly for getting
> core id and cluster in ArmPkg/Include/Library/ArmLib.h to avoid the
> confusion to others
> 
> #define ARM_CORE_MASK         ARM_CORE_AFF0
> #define ARM_CLUSTER_MASK      ARM_CORE_AFF1
> #define GET_CORE_ID(MpId)     ((MpId) & ARM_CORE_MASK)
> #define GET_CLUSTER_ID(MpId)  (((MpId) & ARM_CLUSTER_MASK) >> 8)
> #define GET_MPID(ClusterId, CoreId)   (((ClusterId) << 8) | (CoreId))
> #define PRIMARY_CORE_ID       (PcdGet32(PcdArmPrimaryCore) & ARM_CORE_MASK)
> 
> And, should support GET_AFFx like
> 
> #define ARM_MPIDR_GET_AFF0(Mpid) ((Mpid) & ARM_CORE_AFF0)
> 
> For silicon specific usage, it can abstract them to proper IDs like
> 
> #define XXX_GET_CORE_ID(Mpid) ARM_MPIDR_GET_AFF0(Mpid)

And we could hide that selection behind a Pcd.
Then we'd not need anything platform-specific other than overriding
the default Pcd value.

/
    Leif

      reply	other threads:[~2023-02-15 11:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  4:21 [edk2-platforms][PATCH 1/1] AmpereAltraPkg: Update ArmPlatformLib to work with changed ARM_CORE_INFO Nhi Pham
2023-01-13 14:40 ` [edk2-devel] " Rebecca Cran
2023-01-17  9:53   ` Nhi Pham
2023-01-17 12:55     ` Rebecca Cran
2023-01-17 16:40       ` Ard Biesheuvel
2023-01-17 18:21         ` Rebecca Cran
2023-01-31  6:35           ` Nhi Pham
2023-02-15 11:28             ` Leif Lindholm [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=Y+zB6NpgBNDx+BbO@qc-i7.hemma.eciton.net \
    --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