[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/21] target/arm: Diagnose incorrect usage of arm_is_secure subro
From: |
Peter Maydell |
Subject: |
[PULL 17/21] target/arm: Diagnose incorrect usage of arm_is_secure subroutines |
Date: |
Mon, 6 Mar 2023 15:34:31 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
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.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230227225832.816605-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@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 ab187012770..c097cae9882 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2384,7 +2384,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
@@ -2392,6 +2393,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 {
@@ -2405,6 +2407,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
- [PULL 09/21] target/arm: Simplify iteration over bit widths, (continued)
- [PULL 09/21] target/arm: Simplify iteration over bit widths, Peter Maydell, 2023/03/06
- [PULL 04/21] target/arm: Split out output_vector_union_type, Peter Maydell, 2023/03/06
- [PULL 03/21] target/arm: Move arm_gen_dynamic_svereg_xml to gdbstub64.c, Peter Maydell, 2023/03/06
- [PULL 07/21] target/arm: Fix svep width in arm_gen_dynamic_svereg_xml, Peter Maydell, 2023/03/06
- [PULL 08/21] target/arm: Add name argument to output_vector_union_type, Peter Maydell, 2023/03/06
- [PULL 10/21] target/arm: Create pauth_ptr_mask, Peter Maydell, 2023/03/06
- [PULL 06/21] target/arm: Hoist pred_width in arm_gen_dynamic_svereg_xml, Peter Maydell, 2023/03/06
- [PULL 12/21] target/arm: Export arm_v7m_mrs_control, Peter Maydell, 2023/03/06
- [PULL 15/21] target/arm: Handle m-profile in arm_is_secure, Peter Maydell, 2023/03/06
- [PULL 13/21] target/arm: Export arm_v7m_get_sp_ptr, Peter Maydell, 2023/03/06
- [PULL 17/21] target/arm: Diagnose incorrect usage of arm_is_secure subroutines,
Peter Maydell <=
- [PULL 11/21] target/arm: Implement gdbstub pauth extension, Peter Maydell, 2023/03/06
- [PULL 14/21] target/arm: Implement gdbstub m-profile systemreg and secext, Peter Maydell, 2023/03/06
- [PULL 16/21] target/arm: Stub arm_hcr_el2_eff for m-profile, Peter Maydell, 2023/03/06
- [PULL 21/21] hw: arm: allwinner-h3: Fix and complete H3 i2c devices, Peter Maydell, 2023/03/06
- [PULL 18/21] target/arm: Rewrite check_s2_mmu_setup, Peter Maydell, 2023/03/06
- [PULL 19/21] hw: arm: Support direct boot for Linux/arm64 EFI zboot images, Peter Maydell, 2023/03/06
- [PULL 20/21] hw: allwinner-i2c: Fix TWI_CNTR_INT_FLAG on SUN6i SoCs, Peter Maydell, 2023/03/06
- Re: [PULL 00/21] target-arm queue, Peter Maydell, 2023/03/07