aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2023-10-23 16:30:33 +0100
committerMark Rutland <mark.rutland@arm.com>2024-01-24 14:09:33 +0000
commit60bd474fb8de8d124a81dc7719547907a749f13e (patch)
tree6b33fa25533cf845eda29b6c8d38e0375f05264d
parenteecac312a4ae9d22612271f97381a002280aa41b (diff)
downloadlinux-arm64/entry/unhandled-rework.tar.gz
arm64: entry: avoid compat ifdefferyarm64/entry/unhandled-rework
For historical reasons we have separate functions bodies for the el0t exception handlers depending on whether CONFIG_COMPAT is selected. We can avoid this duplication by replacing the ifdeffery with IS_ENABLED() checks within the exception handlers. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org>
-rw-r--r--arch/arm64/kernel/entry-common.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index a7d4467ba53858..33acd722e92892 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -826,7 +826,6 @@ asmlinkage void noinstr el0t_64_error_handler(struct pt_regs *regs)
__el0_error_handler_common(regs);
}
-#ifdef CONFIG_COMPAT
static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr)
{
enter_from_user_mode(regs);
@@ -844,7 +843,7 @@ static void noinstr el0_svc_compat(struct pt_regs *regs)
exit_to_user_mode(regs);
}
-asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs)
+static __always_inline void __el0_sync_handler_compat(struct pt_regs *regs)
{
unsigned long esr = read_sysreg(esr_el1);
@@ -888,41 +887,36 @@ asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs)
}
}
-asmlinkage void noinstr el0t_32_irq_handler(struct pt_regs *regs)
-{
- __el0_irq_handler_common(regs);
-}
-
-asmlinkage void noinstr el0t_32_fiq_handler(struct pt_regs *regs)
-{
- __el0_fiq_handler_common(regs);
-}
-
-asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs)
-{
- __el0_error_handler_common(regs);
-}
-#else /* CONFIG_COMPAT */
asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs)
{
- panic_unhandled_vector(el0t, 32, sync, regs);
-}
+ if (!IS_ENABLED(CONFIG_COMPAT))
+ panic_unhandled_vector(el0t, 32, sync, regs);
+ __el0_sync_handler_compat(regs);
+}
asmlinkage void noinstr el0t_32_irq_handler(struct pt_regs *regs)
{
- panic_unhandled_vector(el0t, 32, irq, regs);
+ if (!IS_ENABLED(CONFIG_COMPAT))
+ panic_unhandled_vector(el0t, 32, irq, regs);
+
+ __el0_irq_handler_common(regs);
}
asmlinkage void noinstr el0t_32_fiq_handler(struct pt_regs *regs)
{
- panic_unhandled_vector(el0t, 32, fiq, regs);
+ if (!IS_ENABLED(CONFIG_COMPAT))
+ panic_unhandled_vector(el0t, 32, fiq, regs);
+
+ __el0_fiq_handler_common(regs);
}
asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs)
{
- panic_unhandled_vector(el0t, 32, error, regs);
+ if (!IS_ENABLED(CONFIG_COMPAT))
+ panic_unhandled_vector(el0t, 32, error, regs);
+
+ __el0_error_handler_common(regs);
}
-#endif /* CONFIG_COMPAT */
#ifdef CONFIG_VMAP_STACK
asmlinkage void noinstr __noreturn handle_bad_stack(struct pt_regs *regs)