aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2020-02-07 14:04:24 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-02-07 14:04:24 +0000
commit6003d9800ee38aa11eefb5cd64ae55abb64bef16 (patch)
tree32c6edcd0cd46b93c1d093502ffaad642f8d99c1
parent339370b90d067345b69585ddf4b668fa01f41d67 (diff)
downloadqemu-6003d9800ee38aa11eefb5cd64ae55abb64bef16.zip
qemu-6003d9800ee38aa11eefb5cd64ae55abb64bef16.tar.gz
qemu-6003d9800ee38aa11eefb5cd64ae55abb64bef16.tar.bz2
target/arm: Update arm_mmu_idx for VHE
Return the indexes for the EL2&0 regime when the appropriate bits are set within HCR_EL2. Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200206105448.4726-22-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target/arm/helper.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/target/arm/helper.c b/target/arm/helper.c
index f7bc7f1..9f8d7ca 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11318,12 +11318,16 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el)
return arm_v7m_mmu_idx_for_secstate(env, env->v7m.secure);
}
+ /* See ARM pseudo-function ELIsInHost. */
switch (el) {
case 0:
- /* TODO: ARMv8.1-VHE */
if (arm_is_secure_below_el3(env)) {
return ARMMMUIdx_SE10_0;
}
+ if ((env->cp15.hcr_el2 & (HCR_E2H | HCR_TGE)) == (HCR_E2H | HCR_TGE)
+ && arm_el_is_aa64(env, 2)) {
+ return ARMMMUIdx_E20_0;
+ }
return ARMMMUIdx_E10_0;
case 1:
if (arm_is_secure_below_el3(env)) {
@@ -11331,8 +11335,11 @@ ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el)
}
return ARMMMUIdx_E10_1;
case 2:
- /* TODO: ARMv8.1-VHE */
/* TODO: ARMv8.4-SecEL2 */
+ /* Note that TGE does not apply at EL2. */
+ if ((env->cp15.hcr_el2 & HCR_E2H) && arm_el_is_aa64(env, 2)) {
+ return ARMMMUIdx_E20_2;
+ }
return ARMMMUIdx_E2;
case 3:
return ARMMMUIdx_SE3;