target/arm: Rearrange ARMMMUIdxBit

Define via macro expansion, so that renumbering of the base ARMMMUIdx
symbols is automatically reflected in the bit definitions.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200206105448.4726-18-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2020-02-07 14:04:23 +00:00 committed by Peter Maydell
parent 506f149815
commit 5f09a6dfbf

View file

@ -2927,27 +2927,34 @@ typedef enum ARMMMUIdx {
ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB, ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB,
} ARMMMUIdx; } ARMMMUIdx;
/* Bit macros for the core-mmu-index values for each index, /*
* Bit macros for the core-mmu-index values for each index,
* for use when calling tlb_flush_by_mmuidx() and friends. * for use when calling tlb_flush_by_mmuidx() and friends.
*/ */
#define TO_CORE_BIT(NAME) \
ARMMMUIdxBit_##NAME = 1 << (ARMMMUIdx_##NAME & ARM_MMU_IDX_COREIDX_MASK)
typedef enum ARMMMUIdxBit { typedef enum ARMMMUIdxBit {
ARMMMUIdxBit_E10_0 = 1 << 0, TO_CORE_BIT(E10_0),
ARMMMUIdxBit_E10_1 = 1 << 1, TO_CORE_BIT(E10_1),
ARMMMUIdxBit_E2 = 1 << 2, TO_CORE_BIT(E2),
ARMMMUIdxBit_SE3 = 1 << 3, TO_CORE_BIT(SE10_0),
ARMMMUIdxBit_SE10_0 = 1 << 4, TO_CORE_BIT(SE10_1),
ARMMMUIdxBit_SE10_1 = 1 << 5, TO_CORE_BIT(SE3),
ARMMMUIdxBit_Stage2 = 1 << 6, TO_CORE_BIT(Stage2),
ARMMMUIdxBit_MUser = 1 << 0,
ARMMMUIdxBit_MPriv = 1 << 1, TO_CORE_BIT(MUser),
ARMMMUIdxBit_MUserNegPri = 1 << 2, TO_CORE_BIT(MPriv),
ARMMMUIdxBit_MPrivNegPri = 1 << 3, TO_CORE_BIT(MUserNegPri),
ARMMMUIdxBit_MSUser = 1 << 4, TO_CORE_BIT(MPrivNegPri),
ARMMMUIdxBit_MSPriv = 1 << 5, TO_CORE_BIT(MSUser),
ARMMMUIdxBit_MSUserNegPri = 1 << 6, TO_CORE_BIT(MSPriv),
ARMMMUIdxBit_MSPrivNegPri = 1 << 7, TO_CORE_BIT(MSUserNegPri),
TO_CORE_BIT(MSPrivNegPri),
} ARMMMUIdxBit; } ARMMMUIdxBit;
#undef TO_CORE_BIT
#define MMU_USER_IDX 0 #define MMU_USER_IDX 0
static inline int arm_to_core_mmu_idx(ARMMMUIdx mmu_idx) static inline int arm_to_core_mmu_idx(ARMMMUIdx mmu_idx)