Message ID | 20250130182309.717346-2-peter.maydell@linaro.org |
---|---|
State | New |
Headers | show |
Series | target/arm: Clean up some corner cases of sysreg traps | expand |
Peter Maydell <peter.maydell@linaro.org> writes: > The access pseudocode for the CNTPS_TVAL_EL1, CNTPS_CTL_EL1 and > CNTPS_CVAL_EL1 secure timer registers says that they are UNDEFINED > from EL2 or NS EL1. We incorrectly return CP_ACCESS_TRAP from the > access function in these cases, which means that we report the wrong > syndrome value to the target EL. > > Use CP_ACCESS_TRAP_UNCATEGORIZED, which reports the correct syndrome > value for an UNDEFINED instruction. > > Cc: qemu-stable@nongnu.org > Fixes: b4d3978c2fd ("target-arm: Add the AArch64 view of the Secure physical timer") > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/target/arm/helper.c b/target/arm/helper.c index 40bdfc851a5..c5245a20aaf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2385,7 +2385,7 @@ static CPAccessResult gt_stimer_access(CPUARMState *env, switch (arm_current_el(env)) { case 1: if (!arm_is_secure(env)) { - return CP_ACCESS_TRAP; + return CP_ACCESS_TRAP_UNCATEGORIZED; } if (!(env->cp15.scr_el3 & SCR_ST)) { return CP_ACCESS_TRAP_EL3; @@ -2393,7 +2393,7 @@ static CPAccessResult gt_stimer_access(CPUARMState *env, return CP_ACCESS_OK; case 0: case 2: - return CP_ACCESS_TRAP; + return CP_ACCESS_TRAP_UNCATEGORIZED; case 3: return CP_ACCESS_OK; default:
The access pseudocode for the CNTPS_TVAL_EL1, CNTPS_CTL_EL1 and CNTPS_CVAL_EL1 secure timer registers says that they are UNDEFINED from EL2 or NS EL1. We incorrectly return CP_ACCESS_TRAP from the access function in these cases, which means that we report the wrong syndrome value to the target EL. Use CP_ACCESS_TRAP_UNCATEGORIZED, which reports the correct syndrome value for an UNDEFINED instruction. Cc: qemu-stable@nongnu.org Fixes: b4d3978c2fd ("target-arm: Add the AArch64 view of the Secure physical timer") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- target/arm/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)