On 7/31/25 8:53 PM, Richard Henderson wrote:
On 7/31/25 07:21, Pierrick Bouvier wrote:
   #include "mmuidx-internal.h"
-#define EL(X)  ((X << R_MMUIDXINFO_EL_SHIFT) | R_MMUIDXINFO_ELVALID_MASK)
+#define EL(X)  ((X << R_MMUIDXINFO_EL_SHIFT) | R_MMUIDXINFO_ELVALID_MASK | \
+                ((X == 0) << R_MMUIDXINFO_USER_SHIFT))
   #define REL(X) ((X << R_MMUIDXINFO_REL_SHIFT) | R_MMUIDXINFO_RELVALID_MASK)
   #define R2     R_MMUIDXINFO_2RANGES_MASK
   #define PAN    R_MMUIDXINFO_PAN_MASK
+#define USER   R_MMUIDXINFO_USER_MASK
   const uint32_t arm_mmuidx_table[ARM_MMU_IDX_M + 8] = {
       /*
@@ -33,7 +35,7 @@ const uint32_t arm_mmuidx_table[ARM_MMU_IDX_M + 8] = {
       [ARMMMUIdx_Stage2_S]        = REL(2),
       [ARMMMUIdx_Stage2]          = REL(2),
-    [ARMMMUIdx_Stage1_E0]       = REL(1) | R2,
+    [ARMMMUIdx_Stage1_E0]       = REL(1) | R2 | USER,
       [ARMMMUIdx_Stage1_E1]       = REL(1) | R2,
       [ARMMMUIdx_Stage1_E1_PAN]   = REL(1) | R2 | PAN,

Maybe I missed something, but what about other entries that were initially 
treated in the
switch?
- ARMMMUIdx_E.0_0
- ARMMMUIdx_M*User

See the change to EL().


Ok.

I'm not sure why ARMMMUIdx_Stage1_* is excluded from arm_mmu_idx_to_el(), but I 
don't
change that in this patch series.


Maybe it could be more explicit to either tag all concerned entries with USER, than rely on EL(0) adding the magic, since this fails to apply for ARMMMUIdx_Stage1_E0. It's just a suggestion for readability though.

Reviewed-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>


r~


Reply via email to