[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/15] target/arm: Move arm_pamax out of line
From: |
Richard Henderson |
Subject: |
[PATCH v2 04/15] target/arm: Move arm_pamax out of line |
Date: |
Thu, 10 Feb 2022 15:04:12 +1100 |
We will shortly share parts of this function with other portions
of address translation.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/internals.h | 19 +------------------
target/arm/helper.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/target/arm/internals.h b/target/arm/internals.h
index ef6c25d8cb..fefd1fb8d8 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -243,24 +243,7 @@ static inline void update_spsel(CPUARMState *env, uint32_t
imm)
* Returns the implementation defined bit-width of physical addresses.
* The ARMv8 reference manuals refer to this as PAMax().
*/
-static inline unsigned int arm_pamax(ARMCPU *cpu)
-{
- static const unsigned int pamax_map[] = {
- [0] = 32,
- [1] = 36,
- [2] = 40,
- [3] = 42,
- [4] = 44,
- [5] = 48,
- };
- unsigned int parange =
- FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE);
-
- /* id_aa64mmfr0 is a read-only register so values outside of the
- * supported mappings can be considered an implementation error. */
- assert(parange < ARRAY_SIZE(pamax_map));
- return pamax_map[parange];
-}
+unsigned int arm_pamax(ARMCPU *cpu);
/* Return true if extended addresses are enabled.
* This is always the case if our translation regime is 64 bit,
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 14cc866d8d..fa0824e12c 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11150,6 +11150,28 @@ static uint8_t convert_stage2_attrs(CPUARMState *env,
uint8_t s2attrs)
}
#endif /* !CONFIG_USER_ONLY */
+/* The cpu-specific constant value of PAMax; also used by hw/arm/virt. */
+unsigned int arm_pamax(ARMCPU *cpu)
+{
+ static const unsigned int pamax_map[] = {
+ [0] = 32,
+ [1] = 36,
+ [2] = 40,
+ [3] = 42,
+ [4] = 44,
+ [5] = 48,
+ };
+ unsigned int parange =
+ FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE);
+
+ /*
+ * id_aa64mmfr0 is a read-only register so values outside of the
+ * supported mappings can be considered an implementation error.
+ */
+ assert(parange < ARRAY_SIZE(pamax_map));
+ return pamax_map[parange];
+}
+
static int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx)
{
if (regime_has_2_ranges(mmu_idx)) {
--
2.25.1
- [PATCH v2 00/15] target/arm: Implement LVA, LPA, LPA2 features, Richard Henderson, 2022/02/09
- [PATCH v2 01/15] hw/registerfields: Add FIELD_SEX<N> and FIELD_SDP<N>, Richard Henderson, 2022/02/09
- [PATCH v2 02/15] target/arm: Set TCR_EL1.TSZ for user-only, Richard Henderson, 2022/02/09
- [PATCH v2 04/15] target/arm: Move arm_pamax out of line,
Richard Henderson <=
- [PATCH v2 03/15] target/arm: Fault on invalid TCR_ELx.TxSZ, Richard Henderson, 2022/02/09
- [PATCH v2 05/15] target/arm: Pass outputsize down to check_s2_mmu_setup, Richard Henderson, 2022/02/09
- [PATCH v2 07/15] target/arm: Honor TCR_ELx.{I}PS, Richard Henderson, 2022/02/09
- [PATCH v2 08/15] target/arm: Prepare DBGBVR and DBGWVR for FEAT_LVA, Richard Henderson, 2022/02/09
- [PATCH v2 09/15] target/arm: Implement FEAT_LVA, Richard Henderson, 2022/02/09