[edk2-devel] [PATCH v4 04/10] ArmPkg: Add helper to read the Memory Model Features Register 2

Leif Lindholm leif at nuviainc.com
Thu Dec 17 18:04:29 UTC 2020


On Thu, Dec 17, 2020 at 14:47:48 +0100, Ard Biesheuvel wrote:
> >> ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c:  if (ArmReadIdPfr0 () & AARCH64_PFR0_GIC) {
> >> ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c:  if (ArmReadIdPfr1 () & ARM_PFR1_GIC) {
> >>
> >> I would propose that since the high-level abstraction serve only to
> >> confuse things, we change existing (and new) accessors to ID registers
> >> to be explicit:
> >>
> >> - ArmReadIdAArch64Mmfr0
> >> - ArmReadIdAArch64Pfr0
> >> - ArmReadIdAArch64Pfr1
> > 
> > I can follow until here... (and yes, using the concrete register names
> > in the function names makes sense)
> > 
> >>
> >> The question is whether we should make the AArch32 aspect explicit or
> >> implicit? My instinctive reaction is the latter. This matches the
> >> native naming scheme used in the ARM ARM, and we don't support mixing
> >> instruction set widths in UEFI.
> > 
> > I lost you here, sorry.
> > 
> 
> So did I :-)
> 
> But I think that we should raise the level of abstraction here:
> something like
> 
> if (ArmReadIdPfr0 () & AARCH64_PFR0_GIC) {
> 
> should not exist in code that is shared between AArch64 and AArch32, I'd
> much rather have a helper
> 
> ArmHasGicSre()
> 
> that encapsulates whatever is needed on each respective architecture,
> and which may or may not end up using the same ID register or mask value.

Yeah, agreed. In the end, that's what Rebecca's set does in patch 6/10
- so I'll whip something together to replicate this for the GIC case.

I like the ArmHas* format though - Rebecca, could you use that for
your v5?

> 
> >>
> >> The AArch64 prototypes should then only be made available to AARCH64
> >> code, and the AArch32 ones only to ARM.
> > 
> > But this again makes sense to me.
> > 
> > I guess what confuses me is your interpretation of "implicit" vs.
> > "explicit". I'm missing what the "AArch32 aspect" means, probably.
> > 
> > Thanks
> > laszlo
> > 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69145): https://edk2.groups.io/g/devel/message/69145
Mute This Topic: https://groups.io/mt/78784065/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list