target/arm: Convert arm_mmu_idx_is_stage1_of_2 from switch to table
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20251008215613.300150-26-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
38e5e7018b
commit
346feee01c
3 changed files with 12 additions and 22 deletions
|
|
@ -1285,25 +1285,6 @@ ARMMMUIdx stage_1_mmu_idx(ARMMMUIdx mmu_idx);
|
|||
ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* arm_mmu_idx_is_stage1_of_2:
|
||||
* @mmu_idx: The ARMMMUIdx to test
|
||||
*
|
||||
* Return true if @mmu_idx is a NOTLB mmu_idx that is the
|
||||
* first stage of a two stage regime.
|
||||
*/
|
||||
static inline bool arm_mmu_idx_is_stage1_of_2(ARMMMUIdx mmu_idx)
|
||||
{
|
||||
switch (mmu_idx) {
|
||||
case ARMMMUIdx_Stage1_E0:
|
||||
case ARMMMUIdx_Stage1_E1:
|
||||
case ARMMMUIdx_Stage1_E1_PAN:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t aarch32_cpsr_valid_mask(uint64_t features,
|
||||
const ARMISARegisters *id)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ FIELD(MMUIDXINFO, RELVALID, 5, 1)
|
|||
FIELD(MMUIDXINFO, 2RANGES, 6, 1)
|
||||
FIELD(MMUIDXINFO, PAN, 7, 1)
|
||||
FIELD(MMUIDXINFO, USER, 8, 1)
|
||||
FIELD(MMUIDXINFO, STAGE1, 9, 1)
|
||||
|
||||
extern const uint32_t arm_mmuidx_table[ARM_MMU_IDX_M + 8];
|
||||
|
||||
|
|
@ -76,4 +77,11 @@ static inline bool regime_is_user(ARMMMUIdx idx)
|
|||
return FIELD_EX32(arm_mmuidx_table[idx], MMUIDXINFO, USER);
|
||||
}
|
||||
|
||||
/* Return true if this mmu index is stage 1 of a 2-stage translation. */
|
||||
static inline bool arm_mmu_idx_is_stage1_of_2(ARMMMUIdx idx)
|
||||
{
|
||||
tcg_debug_assert(arm_mmuidx_is_valid(idx));
|
||||
return FIELD_EX32(arm_mmuidx_table[idx], MMUIDXINFO, STAGE1);
|
||||
}
|
||||
|
||||
#endif /* TARGET_ARM_MMUIDX_INTERNAL_H */
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#define R2 R_MMUIDXINFO_2RANGES_MASK
|
||||
#define PAN R_MMUIDXINFO_PAN_MASK
|
||||
#define USER R_MMUIDXINFO_USER_MASK
|
||||
#define S1 R_MMUIDXINFO_STAGE1_MASK
|
||||
|
||||
const uint32_t arm_mmuidx_table[ARM_MMU_IDX_M + 8] = {
|
||||
/*
|
||||
|
|
@ -35,9 +36,9 @@ 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 | USER,
|
||||
[ARMMMUIdx_Stage1_E1] = REL(1) | R2,
|
||||
[ARMMMUIdx_Stage1_E1_PAN] = REL(1) | R2 | PAN,
|
||||
[ARMMMUIdx_Stage1_E0] = REL(1) | R2 | S1 | USER,
|
||||
[ARMMMUIdx_Stage1_E1] = REL(1) | R2 | S1,
|
||||
[ARMMMUIdx_Stage1_E1_PAN] = REL(1) | R2 | S1 | PAN,
|
||||
|
||||
/*
|
||||
* M-profile.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue