[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/9] target/arm: Optimize cpu_mmu_index
From: |
Richard Henderson |
Subject: |
[PATCH v2 2/9] target/arm: Optimize cpu_mmu_index |
Date: |
Mon, 2 Mar 2020 09:58:22 -0800 |
We now cache the core mmu_idx in env->hflags. Rather than recompute
from scratch, extract the field. All of the uses of cpu_mmu_index
within target/arm are within helpers, and env->hflags is always stable
within a translation block from whence helpers are called.
Signed-off-by: Richard Henderson <address@hidden>
---
target/arm/cpu.h | 23 +++++++++++++----------
target/arm/helper.c | 5 -----
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 0b84742b66..8f1b949c88 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2936,16 +2936,6 @@ typedef enum ARMMMUIdxBit {
#define MMU_USER_IDX 0
-/**
- * cpu_mmu_index:
- * @env: The cpu environment
- * @ifetch: True for code access, false for data access.
- *
- * Return the core mmu index for the current translation regime.
- * This function is used by generic TCG code paths.
- */
-int cpu_mmu_index(CPUARMState *env, bool ifetch);
-
/* Indexes used when registering address spaces with cpu_address_space_init */
typedef enum ARMASIdx {
ARMASIdx_NS = 0,
@@ -3225,6 +3215,19 @@ FIELD(TBFLAG_A64, BTYPE, 10, 2) /* Not cached. */
FIELD(TBFLAG_A64, TBID, 12, 2)
FIELD(TBFLAG_A64, UNPRIV, 14, 1)
+/**
+ * cpu_mmu_index:
+ * @env: The cpu environment
+ * @ifetch: True for code access, false for data access.
+ *
+ * Return the core mmu index for the current translation regime.
+ * This function is used by generic TCG code paths.
+ */
+static inline int cpu_mmu_index(CPUARMState *env, bool ifetch)
+{
+ return FIELD_EX32(env->hflags, TBFLAG_ANY, MMUIDX);
+}
+
static inline bool bswap_code(bool sctlr_b)
{
#ifdef CONFIG_USER_ONLY
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 37ffe06c05..addbec91d8 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -12128,11 +12128,6 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env)
return arm_mmu_idx_el(env, arm_current_el(env));
}
-int cpu_mmu_index(CPUARMState *env, bool ifetch)
-{
- return arm_to_core_mmu_idx(arm_mmu_idx(env));
-}
-
#ifndef CONFIG_USER_ONLY
ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env)
{
--
2.20.1
- [PATCH v2 1/9] target/arm: Replicate TBI/TBID bits for single range regimes, (continued)
- [PATCH v2 1/9] target/arm: Replicate TBI/TBID bits for single range regimes, Richard Henderson, 2020/03/02
- [PATCH v2 7/9] target/arm: Clean address for DC ZVA, Richard Henderson, 2020/03/02
- [PATCH v2 6/9] target/arm: Use DEF_HELPER_FLAGS for helper_dc_zva, Richard Henderson, 2020/03/02
- [PATCH v2 4/9] target/arm: Apply TBI to ESR_ELx in helper_exception_return, Richard Henderson, 2020/03/02
- [PATCH v2 9/9] target/arm: Disable clean_data_tbi for system mode, Richard Henderson, 2020/03/02
- [PATCH v2 5/9] target/arm: Move helper_dc_zva to helper-a64.c, Richard Henderson, 2020/03/02
- [PATCH v2 2/9] target/arm: Optimize cpu_mmu_index,
Richard Henderson <=
- [PATCH v2 3/9] target/arm: Introduce core_to_aa64_mmu_idx, Richard Henderson, 2020/03/02
- [PATCH v2 8/9] target/arm: Check addresses for disabled regimes, Richard Henderson, 2020/03/02
- Re: [PATCH v2 0/9] target/arm: Misc cleanups surrounding TBI, Peter Maydell, 2020/03/05