hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10013 ---------------------------------------------- arch_cpu_idle_{enter,exit} is common code for all modules. Patch their own code to make it more refactorable. Signed-off-by: Yipeng Zou <zouyipeng@huawei.com> Reviewed-by: Liao Chang <liaochang1@huawei.com> --- arch/arm64/kernel/idle.c | 48 ++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/arch/arm64/kernel/idle.c b/arch/arm64/kernel/idle.c index 31d9bfbe10b8..a986bab39eb4 100644 --- a/arch/arm64/kernel/idle.c +++ b/arch/arm64/kernel/idle.c @@ -72,46 +72,36 @@ struct arm_cpuidle_xcall_xint_context { }; DEFINE_PER_CPU_ALIGNED(struct arm_cpuidle_xcall_xint_context, contexts); +#endif void arch_cpu_idle_enter(void) { +#ifdef CONFIG_ACTLR_XCALL_XINT struct arm_cpuidle_xcall_xint_context *context; + if (system_uses_xcall_xint()) { + context = &get_cpu_var(contexts); + context->actlr_el1 = read_sysreg(actlr_el1); + if (read_sysreg(CurrentEL) == CurrentEL_EL2) + context->actlr_el2 = read_sysreg(actlr_el2); + put_cpu_var(contexts); + } +#endif smt_measurement_begin(); - - if (!system_uses_xcall_xint()) - return; - - context = &get_cpu_var(contexts); - context->actlr_el1 = read_sysreg(actlr_el1); - if (read_sysreg(CurrentEL) == CurrentEL_EL2) - context->actlr_el2 = read_sysreg(actlr_el2); - put_cpu_var(contexts); } void arch_cpu_idle_exit(void) { +#ifdef CONFIG_ACTLR_XCALL_XINT struct arm_cpuidle_xcall_xint_context *context; - smt_measurement_done(); - - if (!system_uses_xcall_xint()) - return; - - context = &get_cpu_var(contexts); - write_sysreg(context->actlr_el1, actlr_el1); - if (read_sysreg(CurrentEL) == CurrentEL_EL2) - write_sysreg(context->actlr_el2, actlr_el2); - put_cpu_var(contexts); -} -#else -void arch_cpu_idle_enter(void) -{ - smt_measurement_begin(); -} - -void arch_cpu_idle_exit(void) -{ + if (system_uses_xcall_xint()) { + context = &get_cpu_var(contexts); + write_sysreg(context->actlr_el1, actlr_el1); + if (read_sysreg(CurrentEL) == CurrentEL_EL2) + write_sysreg(context->actlr_el2, actlr_el2); + put_cpu_var(contexts); + } +#endif smt_measurement_done(); } -#endif -- 2.34.1