[PATCH v2 2/8] target/arm: Handle NSACR.NSASEDIS in HCPTR accesses
Peter Maydell <[email protected]>
| Newsgroups | org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
In cptr_el2_read() and cptr_el2_write() we have code that implements the
"HCPTR.{TCP10,TCP11} behave as RAO/WI from NonSecure when NSACR.cp10 is
0" behaviour. There is a similar requirement for HCPTR.TASE: if
NSACR.NSASEDIS is 1 then CPACR.ASEDIS behaves as RAO/WI in NS.
This doesn't matter to us yet because we don't currently implement
ASEDIS or NSASEDIS. But we're about to do that, so add the handling
to cptr_el2_read() and cptr_el2_write().
Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
---
target/arm/helper.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index c33de9c5d4..e6d269b09d 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -4117,11 +4117,18 @@ static void cptr_el2_write(CPUARMState *env, const ARMCPRegInfo *ri,
/*
* For A-profile AArch32 EL3, if NSACR.CP10
* is 0 then HCPTR.{TCP11,TCP10} ignore writes and read as 1.
+ * Similarly, if NSACR.NSASEDIS is 1 then HCPTR.TASE behaves as RAO/WI.
*/
if (arm_feature(env, ARM_FEATURE_EL3) && !arm_el_is_aa64(env, 3) &&
- !arm_is_secure(env) && !FIELD_EX32(env->cp15.nsacr, NSACR, CP10)) {
- uint64_t mask = R_HCPTR_TCP11_MASK | R_HCPTR_TCP10_MASK;
- value = (value & ~mask) | (env->cp15.cptr_el[2] & mask);
+ !arm_is_secure(env)) {
+ if (!FIELD_EX32(env->cp15.nsacr, NSACR, CP10)) {
+ uint64_t mask = R_HCPTR_TCP11_MASK | R_HCPTR_TCP10_MASK;
+ value = (value & ~mask) | (env->cp15.cptr_el[2] & mask);
+ }
+ if (FIELD_EX32(env->cp15.nsacr, NSACR, NSASEDIS)) {
+ uint64_t mask = R_HCPTR_TASE_MASK;
+ value = (value & ~mask) | (env->cp15.cptr_el[2] & mask);
+ }
}
env->cp15.cptr_el[2] = value;
}
@@ -4131,12 +4138,18 @@ static uint64_t cptr_el2_read(CPUARMState *env, const ARMCPRegInfo *ri)
/*
* For A-profile AArch32 EL3, if NSACR.CP10
* is 0 then HCPTR.{TCP11,TCP10} ignore writes and read as 1.
+ * Similarly, if NSACR.NSASEDIS is 1 then HCPTR.TASE behaves as RAO/WI.
*/
uint64_t value = env->cp15.cptr_el[2];
if (arm_feature(env, ARM_FEATURE_EL3) && !arm_el_is_aa64(env, 3) &&
- !arm_is_secure(env) && !FIELD_EX32(env->cp15.nsacr, NSACR, CP10)) {
- value |= R_HCPTR_TCP11_MASK | R_HCPTR_TCP10_MASK;
+ !arm_is_secure(env)) {
+ if (!FIELD_EX32(env->cp15.nsacr, NSACR, CP10)) {
+ value |= R_HCPTR_TCP11_MASK | R_HCPTR_TCP10_MASK;
+ }
+ if (!FIELD_EX32(env->cp15.nsacr, NSACR, NSASEDIS)) {
+ value |= R_HCPTR_TASE_MASK;
+ }
}
return value;
}
--
2.43.0