Hi Leif, It isn't required for correctness?
i.e. To be consistent with other places?
i.e. To be like TranslationRegimeIsDual in 
UefiCpuPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c?
 
https://github.com/tianocore/edk2/blob/2cfd432ac92f58a14331fec2d2b885c795f684db/UefiCpuPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c#L42

Something like this: ARM: TT_XN_MASK vs. TT_UXN_MASK | TT_PXN_MASK for E2H by 
jaykrell · Pull Request #12775 · 
tianocore/edk2<https://github.com/tianocore/edk2/pull/12775> ?


  *
Jay

________________________________
From: Leif Lindholm <[email protected]>
Sent: Friday, July 3, 2026 8:14 AM
To: [email protected] <[email protected]>; Jay Krell 
<[email protected]>
Subject: [EXTERNAL] Re: [edk2-devel] ArmReadCurrentEL () == AARCH64_EL2

Hi Jay,

On Tue, 30 Jun 2026 at 03:48, Jay Krell via groups.io
<[email protected]> wrote:
> I have a multi-part question.
>
> 1. ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c(378):
>       if (ArmReadCurrentEL () == AARCH64_EL2) {
>
> This should also check E2H, right?

Umm, why?

Best Regards,

Leif

> 2. More broadly:
> What about all other EL checks, primarily in EL1_OR_EL2 macro.
> Mainly with mrs use, but also tlbi.
>
> 2a Leave them generally alone, let them trap, etc. and let hardware or 
> hypervisor virtualize (i.e. if E2H; they are already correct in preexisting 
> contexts).
> 2b Change the macro to also check E2H, leaving the name asis?
> 2c Make a new macro and gradually/rapidly convert many/all uses?
>         EL1LIKE_OR_EL2?
>         EL1orE2H_OR_EL2?
> 2d Other?
>
> If decision is to have it check also E2H, people building physical-only (or 
> E2H==0 only) might object to the code size growth? So have the definition of 
> EL1_OR_EL2 itself guided by another ifdef?
>
> e.g.
>   #ifdef SUPPORT_E2H
>   #defi ne EL1_OR_EL2 ... new way
>   #else
>   #define EL1_OR_EL2 ... old way
>   #endif
>
>  And then, there *might* be cases that need old way unconditionally?
>   #define EL1_OR_EL2_IGNORE_E2H ?
>
> Even if EL1_OR_EL2 is left alone to be trapped/emulated, maybe the multiple 
> (2?) places in C that check EL==2 should share a "helper" function? 
> ArmCurrentELBehavior() == 1 or 2?
> ArmEL1OrE2H()?
> Or even, redefine ArmReadCurrentEL to return AARCH64_EL1 for E2H?
> Maybe changing ArmReadCurrentEL is too heavy handed and confusing.
> You'll need some other function to read the "real" EL, ignoring E2H.
>
> Anyway, surely there are many options, but the main question is to do 
> something at all, or leave it mostly asis.
>
> Thank you,
>   - Jay
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#122034): https://edk2.groups.io/g/devel/message/122034
Mute This Topic: https://groups.io/mt/120041798/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to