Skip to content

Commit

Permalink
target/arm: Pass an ARMSecuritySpace to arm_is_el2_enabled_secstate()
Browse files Browse the repository at this point in the history
Pass an ARMSecuritySpace instead of a bool secure to
arm_is_el2_enabled_secstate(). This doesn't change behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230807141514.19075-8-peter.maydell@linaro.org
  • Loading branch information
pm215 committed Aug 22, 2023
1 parent 2d12bb9 commit 4477020
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions target/arm/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -2504,17 +2504,19 @@ static inline bool arm_is_secure(CPUARMState *env)

/*
* Return true if the current security state has AArch64 EL2 or AArch32 Hyp.
* This corresponds to the pseudocode EL2Enabled()
* This corresponds to the pseudocode EL2Enabled().
*/
static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure)
static inline bool arm_is_el2_enabled_secstate(CPUARMState *env,
ARMSecuritySpace space)
{
assert(space != ARMSS_Root);
return arm_feature(env, ARM_FEATURE_EL2)
&& (!secure || (env->cp15.scr_el3 & SCR_EEL2));
&& (space != ARMSS_Secure || (env->cp15.scr_el3 & SCR_EEL2));
}

static inline bool arm_is_el2_enabled(CPUARMState *env)
{
return arm_is_el2_enabled_secstate(env, arm_is_secure_below_el3(env));
return arm_is_el2_enabled_secstate(env, arm_security_space_below_el3(env));
}

#else
Expand All @@ -2538,7 +2540,8 @@ static inline bool arm_is_secure(CPUARMState *env)
return false;
}

static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure)
static inline bool arm_is_el2_enabled_secstate(CPUARMState *env,
ARMSecuritySpace space)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion target/arm/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -5778,7 +5778,7 @@ uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, ARMSecuritySpace space)

assert(space != ARMSS_Root);

if (!arm_is_el2_enabled_secstate(env, arm_space_is_secure(space))) {
if (!arm_is_el2_enabled_secstate(env, space)) {
/*
* "This register has no effect if EL2 is not enabled in the
* current Security state". This is ARMv8.4-SecEL2 speak for
Expand Down

0 comments on commit 4477020

Please sign in to comment.