Commit 653311eecd for qemu.org
commit 653311eecdcbeae672bace9039b8c65745d1693c
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Mon Aug 17 13:38:32 2026 +0100
target/arm: Handle NSACR.NSASEDIS in HCPTR accesses
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 <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260817123838.1578060-3-peter.maydell@linaro.org
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 6a707b80cf..d582eeba57 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;
}