[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/28] target/arm: Make the final stage1+2 write to secure be unco
From: |
Peter Maydell |
Subject: |
[PULL 05/28] target/arm: Make the final stage1+2 write to secure be unconditional |
Date: |
Mon, 10 Oct 2022 15:27:07 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
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>
---
target/arm/ptw.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index b8c494ad9f0..7d763a58477 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 {
/*
--
2.25.1
- [PULL 00/28] target-arm queue, Peter Maydell, 2022/10/10
- [PULL 02/28] target/arm: allow setting SCR_EL3.EnTP2 when FEAT_SME is implemented, Peter Maydell, 2022/10/10
- [PULL 01/28] target/arm/kvm: Retry KVM_CREATE_VM call if it fails EINTR, Peter Maydell, 2022/10/10
- [PULL 03/28] docs/nuvoton: Update URL for images, Peter Maydell, 2022/10/10
- [PULL 04/28] target/arm: Split s2walk_secure from ipa_secure in get_phys_addr, Peter Maydell, 2022/10/10
- [PULL 05/28] target/arm: Make the final stage1+2 write to secure be unconditional,
Peter Maydell <=
- [PULL 06/28] target/arm: Add is_secure parameter to get_phys_addr_lpae, Peter Maydell, 2022/10/10
- [PULL 07/28] target/arm: Fix S2 disabled check in S1_ptw_translate, Peter Maydell, 2022/10/10
- [PULL 08/28] target/arm: Add is_secure parameter to regime_translation_disabled, Peter Maydell, 2022/10/10
- [PULL 09/28] target/arm: Split out get_phys_addr_with_secure, Peter Maydell, 2022/10/10
- [PULL 10/28] target/arm: Add is_secure parameter to v7m_read_half_insn, Peter Maydell, 2022/10/10
- [PULL 11/28] target/arm: Add TBFLAG_M32.SECURE, Peter Maydell, 2022/10/10
- [PULL 16/28] target/arm: Drop secure check for HCR.TGE vs SCTLR_EL1.M, Peter Maydell, 2022/10/10
- [PULL 23/28] target/arm: Fix cacheattr in get_phys_addr_disabled, Peter Maydell, 2022/10/10
- [PULL 12/28] target/arm: Merge regime_is_secure into get_phys_addr, Peter Maydell, 2022/10/10
- [PULL 13/28] target/arm: Add is_secure parameter to do_ats_write, Peter Maydell, 2022/10/10