Re: [PATCH v2 29/66] target/arm: Introduce arm_hcr_el2_eff_secstate
On 9/20/22 08:52, Peter Maydell wrote: On Mon, 22 Aug 2022 at 17:22, Richard Henderson wrote: For page walking, we may require HCR for a security state that is not "current". Signed-off-by: Richard Henderson --- target/arm/cpu.h| 20 +--- target/arm/helper.c | 11 --- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index cea2121f67..a08e546de4 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2401,15 +2401,15 @@ 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() */ +static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure) +{ +return (arm_feature(env, ARM_FEATURE_EL2) +&& (!secure || (env->cp15.scr_el3 & SCR_EEL2))); This doesn't need the outermost set of (). Oh, that's an emacs alignment thing. r~ Otherwise Reviewed-by: Peter Maydell thanks -- PMM
Re: [PATCH v2 29/66] target/arm: Introduce arm_hcr_el2_eff_secstate
On Mon, 22 Aug 2022 at 17:22, Richard Henderson wrote: > > For page walking, we may require HCR for a security state > that is not "current". > > Signed-off-by: Richard Henderson > --- > target/arm/cpu.h| 20 +--- > target/arm/helper.c | 11 --- > 2 files changed, 21 insertions(+), 10 deletions(-) > > diff --git a/target/arm/cpu.h b/target/arm/cpu.h > index cea2121f67..a08e546de4 100644 > --- a/target/arm/cpu.h > +++ b/target/arm/cpu.h > @@ -2401,15 +2401,15 @@ 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() > */ > +static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure) > +{ > +return (arm_feature(env, ARM_FEATURE_EL2) > +&& (!secure || (env->cp15.scr_el3 & SCR_EEL2))); This doesn't need the outermost set of (). Otherwise Reviewed-by: Peter Maydell thanks -- PMM