[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 03/25] target/arm: Diagnose incorrect usage of arm_is_secure s
From: |
Richard Henderson |
Subject: |
[PATCH v3 03/25] target/arm: Diagnose incorrect usage of arm_is_secure subroutines |
Date: |
Tue, 21 Feb 2023 16:33:14 -1000 |
In several places we use arm_is_secure_below_el3 and
arm_is_el3_or_mon separately from arm_is_secure.
These functions make no sense for m-profile, and
would indicate prior incorrect feature testing.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpu.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 7a2f804aeb..cb4e405f04 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2389,7 +2389,8 @@ static inline int arm_feature(CPUARMState *env, int
feature)
void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp);
#if !defined(CONFIG_USER_ONLY)
-/* Return true if exception levels below EL3 are in secure state,
+/*
+ * Return true if exception levels below EL3 are in secure state,
* or would be following an exception return to that level.
* Unlike arm_is_secure() (which is always a question about the
* _current_ state of the CPU) this doesn't care about the current
@@ -2397,6 +2398,7 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp);
*/
static inline bool arm_is_secure_below_el3(CPUARMState *env)
{
+ assert(!arm_feature(env, ARM_FEATURE_M));
if (arm_feature(env, ARM_FEATURE_EL3)) {
return !(env->cp15.scr_el3 & SCR_NS);
} else {
@@ -2410,6 +2412,7 @@ static inline bool arm_is_secure_below_el3(CPUARMState
*env)
/* Return true if the CPU is AArch64 EL3 or AArch32 Mon */
static inline bool arm_is_el3_or_mon(CPUARMState *env)
{
+ assert(!arm_feature(env, ARM_FEATURE_M));
if (arm_feature(env, ARM_FEATURE_EL3)) {
if (is_a64(env) && extract32(env->pstate, 2, 2) == 3) {
/* CPU currently in AArch64 state and EL3 */
--
2.34.1
- [PATCH v3 00/25] target/arm: Implement FEAT_RME, Richard Henderson, 2023/02/21
- [PATCH v3 02/25] target/arm: Stub arm_hcr_el2_eff for m-profile, Richard Henderson, 2023/02/21
- [PATCH v3 03/25] target/arm: Diagnose incorrect usage of arm_is_secure subroutines,
Richard Henderson <=
- [PATCH v3 01/25] target/arm: Handle m-profile in arm_is_secure, Richard Henderson, 2023/02/21
- [PATCH v3 04/25] target/arm: Rewrite check_s2_mmu_setup, Richard Henderson, 2023/02/21
- [PATCH v3 10/25] include/exec/memattrs: Add two bits of space to MemTxAttrs, Richard Henderson, 2023/02/21
- [PATCH v3 08/25] target/arm: Add RME cpregs, Richard Henderson, 2023/02/21
- [PATCH v3 07/25] target/arm: SCR_EL3.NS may be RES1, Richard Henderson, 2023/02/21