diff mbox series

[v2,3/9] target/arm: Introduce core_to_aa64_mmu_idx

Message ID 20200302175829.2183-4-richard.henderson@linaro.org
State Superseded
Headers show
Series target/arm: Misc cleanups surrounding TBI | expand

Commit Message

Richard Henderson March 2, 2020, 5:58 p.m. UTC
If by context we know that we're in AArch64 mode, we need not
test for M-profile when reconstructing the full ARMMMUIdx.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/internals.h     | 6 ++++++
 target/arm/translate-a64.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.20.1

Comments

Philippe Mathieu-Daudé March 2, 2020, 11:50 p.m. UTC | #1
On 3/2/20 6:58 PM, Richard Henderson wrote:
> If by context we know that we're in AArch64 mode, we need not

> test for M-profile when reconstructing the full ARMMMUIdx.

> 

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>   target/arm/internals.h     | 6 ++++++

>   target/arm/translate-a64.c | 2 +-

>   2 files changed, 7 insertions(+), 1 deletion(-)

> 

> diff --git a/target/arm/internals.h b/target/arm/internals.h

> index 9f96a2359f..e633aff36e 100644

> --- a/target/arm/internals.h

> +++ b/target/arm/internals.h

> @@ -783,6 +783,12 @@ static inline ARMMMUIdx core_to_arm_mmu_idx(CPUARMState *env, int mmu_idx)

>       }

>   }

>   

> +static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx)

> +{

> +    /* AArch64 is always a-profile. */

> +    return mmu_idx | ARM_MMU_IDX_A;


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


> +}

> +

>   int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);

>   

>   /*

> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c

> index 579180af0a..c910a49b4e 100644

> --- a/target/arm/translate-a64.c

> +++ b/target/arm/translate-a64.c

> @@ -14300,7 +14300,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase,

>       dc->condexec_mask = 0;

>       dc->condexec_cond = 0;

>       core_mmu_idx = FIELD_EX32(tb_flags, TBFLAG_ANY, MMUIDX);

> -    dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx);

> +    dc->mmu_idx = core_to_aa64_mmu_idx(core_mmu_idx);

>       dc->tbii = FIELD_EX32(tb_flags, TBFLAG_A64, TBII);

>       dc->tbid = FIELD_EX32(tb_flags, TBFLAG_A64, TBID);

>       dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx);

>
Peter Maydell March 5, 2020, 2:23 p.m. UTC | #2
On Mon, 2 Mar 2020 at 17:58, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> If by context we know that we're in AArch64 mode, we need not

> test for M-profile when reconstructing the full ARMMMUIdx.

>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/arm/internals.h     | 6 ++++++

>  target/arm/translate-a64.c | 2 +-

>  2 files changed, 7 insertions(+), 1 deletion(-)

>

> diff --git a/target/arm/internals.h b/target/arm/internals.h

> index 9f96a2359f..e633aff36e 100644

> --- a/target/arm/internals.h

> +++ b/target/arm/internals.h

> @@ -783,6 +783,12 @@ static inline ARMMMUIdx core_to_arm_mmu_idx(CPUARMState *env, int mmu_idx)

>      }

>  }

>

> +static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx)

> +{

> +    /* AArch64 is always a-profile. */

> +    return mmu_idx | ARM_MMU_IDX_A;

> +}

> +

>  int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


thanks
-- PMM
diff mbox series

Patch

diff --git a/target/arm/internals.h b/target/arm/internals.h
index 9f96a2359f..e633aff36e 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -783,6 +783,12 @@  static inline ARMMMUIdx core_to_arm_mmu_idx(CPUARMState *env, int mmu_idx)
     }
 }
 
+static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx)
+{
+    /* AArch64 is always a-profile. */
+    return mmu_idx | ARM_MMU_IDX_A;
+}
+
 int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);
 
 /*
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 579180af0a..c910a49b4e 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -14300,7 +14300,7 @@  static void aarch64_tr_init_disas_context(DisasContextBase *dcbase,
     dc->condexec_mask = 0;
     dc->condexec_cond = 0;
     core_mmu_idx = FIELD_EX32(tb_flags, TBFLAG_ANY, MMUIDX);
-    dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx);
+    dc->mmu_idx = core_to_aa64_mmu_idx(core_mmu_idx);
     dc->tbii = FIELD_EX32(tb_flags, TBFLAG_A64, TBII);
     dc->tbid = FIELD_EX32(tb_flags, TBFLAG_A64, TBID);
     dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx);