aboutsummaryrefslogtreecommitdiff
path: root/target/arm
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-10-07 08:21:59 -0700
committerPeter Maydell <peter.maydell@linaro.org>2022-10-10 14:52:24 +0100
commit9b5ba97ac77889b9bf7d27d40da232ee8ff40b09 (patch)
tree932ae7a981d6808d4ac351aa5760aaed73663fe5 /target/arm
parentc7637be307d36ad8c51bd0e9852e09115969bc29 (diff)
downloadqemu-9b5ba97ac77889b9bf7d27d40da232ee8ff40b09.zip
qemu-9b5ba97ac77889b9bf7d27d40da232ee8ff40b09.tar.gz
qemu-9b5ba97ac77889b9bf7d27d40da232ee8ff40b09.tar.bz2
target/arm: Make the final stage1+2 write to secure be unconditional
While the stage2 call to get_phys_addr_lpae should never set attrs.secure when given a non-secure input, it's just as easy to make the final update to attrs.secure be unconditional and false in the case of non-secure input. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20221007152159.1414065-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm')
-rw-r--r--target/arm/ptw.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index b8c494a..7d763a5 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -2365,17 +2365,16 @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
result->cacheattrs = combine_cacheattrs(env, cacheattrs1,
result->cacheattrs);
- /* Check if IPA translates to secure or non-secure PA space. */
- if (is_secure) {
- if (ipa_secure) {
- result->attrs.secure =
- !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW));
- } else {
- result->attrs.secure =
- !((env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))
- || (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)));
- }
- }
+ /*
+ * Check if IPA translates to secure or non-secure PA space.
+ * Note that VSTCR overrides VTCR and {N}SW overrides {N}SA.
+ */
+ result->attrs.secure =
+ (is_secure
+ && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
+ && (ipa_secure
+ || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))));
+
return 0;
} else {
/*