summaryrefslogtreecommitdiffstats
path: root/target/arm/internals.h
diff options
context:
space:
mode:
authorPeter Maydell2022-07-18 17:29:32 +0200
committerPeter Maydell2022-07-18 17:29:32 +0200
commit782378973121addeb11b13fd12a6ac2e69faa33f (patch)
treedbb9f368e6e40347dd41d0a981ac533409e7dae7 /target/arm/internals.h
parentMerge tag 'qga-win32-pull-2022-07-18' of github.com:kostyanf14/qemu into staging (diff)
parentAlign Raspberry Pi DMA interrupts with Linux DTS (diff)
downloadqemu-782378973121addeb11b13fd12a6ac2e69faa33f.tar.gz
qemu-782378973121addeb11b13fd12a6ac2e69faa33f.tar.xz
qemu-782378973121addeb11b13fd12a6ac2e69faa33f.zip
Merge tag 'pull-target-arm-20220718' of https://git.linaro.org/people/pmaydell/qemu-arm into staging
target-arm queue: * hw/intc/armv7m_nvic: ICPRn must not unpend an IRQ that is being held high * target/arm: Fill in VL for tbflags when SME enabled and SVE disabled * target/arm: Fix aarch64_sve_change_el for SME * linux-user/aarch64: Do not clear PROT_MTE on mprotect * target/arm: Honour VTCR_EL2 bits in Secure EL2 * hw/adc: Fix CONV bit in NPCM7XX ADC CON register * hw/adc: Make adci[*] R/W in NPCM7XX ADC * target/arm: Don't set syndrome ISS for loads and stores with writeback * Align Raspberry Pi DMA interrupts with Linux DTS # gpg: Signature made Mon 18 Jul 2022 14:58:26 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate] # gpg: aka "Peter Maydell <peter@archaic.org.uk>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * tag 'pull-target-arm-20220718' of https://git.linaro.org/people/pmaydell/qemu-arm: Align Raspberry Pi DMA interrupts with Linux DTS target/arm: Don't set syndrome ISS for loads and stores with writeback hw/adc: Make adci[*] R/W in NPCM7XX ADC hw/adc: Fix CONV bit in NPCM7XX ADC CON register target/arm: Honour VTCR_EL2 bits in Secure EL2 target/arm: Store TCR_EL* registers as uint64_t target/arm: Store VTCR_EL2, VSTCR_EL2 registers as uint64_t target/arm: Fix big-endian host handling of VTCR target/arm: Fold regime_tcr() and regime_tcr_value() together target/arm: Calculate mask/base_mask in get_level1_table_address() target/arm: Define and use new regime_tcr_value() function linux-user/aarch64: Do not clear PROT_MTE on mprotect target/arm: Fix aarch64_sve_change_el for SME target/arm: Fill in VL for tbflags when SME enabled and SVE disabled hw/intc/armv7m_nvic: ICPRn must not unpend an IRQ that is being held high Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/internals.h')
-rw-r--r--target/arm/internals.h34
1 files changed, 25 insertions, 9 deletions
diff --git a/target/arm/internals.h b/target/arm/internals.h
index 00e2e710f6..b8fefdff67 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -252,9 +252,9 @@ unsigned int arm_pamax(ARMCPU *cpu);
*/
static inline bool extended_addresses_enabled(CPUARMState *env)
{
- TCR *tcr = &env->cp15.tcr_el[arm_is_secure(env) ? 3 : 1];
+ uint64_t tcr = env->cp15.tcr_el[arm_is_secure(env) ? 3 : 1];
return arm_el_is_aa64(env, 1) ||
- (arm_feature(env, ARM_FEATURE_LPAE) && (tcr->raw_tcr & TTBCR_EAE));
+ (arm_feature(env, ARM_FEATURE_LPAE) && (tcr & TTBCR_EAE));
}
/* Update a QEMU watchpoint based on the information the guest has set in the
@@ -777,20 +777,36 @@ static inline uint64_t regime_sctlr(CPUARMState *env, ARMMMUIdx mmu_idx)
return env->cp15.sctlr_el[regime_el(env, mmu_idx)];
}
-/* Return the TCR controlling this translation regime */
-static inline TCR *regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
+/*
+ * These are the fields in VTCR_EL2 which affect both the Secure stage 2
+ * and the Non-Secure stage 2 translation regimes (and hence which are
+ * not present in VSTCR_EL2).
+ */
+#define VTCR_SHARED_FIELD_MASK \
+ (R_VTCR_IRGN0_MASK | R_VTCR_ORGN0_MASK | R_VTCR_SH0_MASK | \
+ R_VTCR_PS_MASK | R_VTCR_VS_MASK | R_VTCR_HA_MASK | R_VTCR_HD_MASK | \
+ R_VTCR_DS_MASK)
+
+/* Return the value of the TCR controlling this translation regime */
+static inline uint64_t regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
{
if (mmu_idx == ARMMMUIdx_Stage2) {
- return &env->cp15.vtcr_el2;
+ return env->cp15.vtcr_el2;
}
if (mmu_idx == ARMMMUIdx_Stage2_S) {
/*
- * Note: Secure stage 2 nominally shares fields from VTCR_EL2, but
- * those are not currently used by QEMU, so just return VSTCR_EL2.
+ * Secure stage 2 shares fields from VTCR_EL2. We merge those
+ * in with the VSTCR_EL2 value to synthesize a single VTCR_EL2 format
+ * value so the callers don't need to special case this.
+ *
+ * If a future architecture change defines bits in VSTCR_EL2 that
+ * overlap with these VTCR_EL2 fields we may need to revisit this.
*/
- return &env->cp15.vstcr_el2;
+ uint64_t v = env->cp15.vstcr_el2 & ~VTCR_SHARED_FIELD_MASK;
+ v |= env->cp15.vtcr_el2 & VTCR_SHARED_FIELD_MASK;
+ return v;
}
- return &env->cp15.tcr_el[regime_el(env, mmu_idx)];
+ return env->cp15.tcr_el[regime_el(env, mmu_idx)];
}
/**