Skip to content

Commit afd05e2

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: entry: fold el1_inv() into el1h_64_sync_handler()
An unexpected synchronous exception from EL1h could happen at any time, and for robustness we should treat this as an NMI, making minimal assumptions about the context the exception was taken from. Currently el1_inv() assumes we can use enter_from_kernel_mode(), and also assumes that we should inherit the original DAIF value. Neither of these are desireable when we take an unexpected exception. Further, after el1_inv() calls __panic_unhandled(), the remainder of the function is unreachable, and therefore superfluous. Let's address this and simplify things by having el1h_64_sync_handler() call __panic_unhandled() directly, without any of the redundant logic. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Marc Zyngier <maz@kernel.org> Reported-by: Joey Gouly <joey.gouly@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20210607094624.34689-16-mark.rutland@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent ec841aa commit afd05e2

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

arch/arm64/kernel/entry-common.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,6 @@ static void noinstr el1_undef(struct pt_regs *regs)
264264
exit_to_kernel_mode(regs);
265265
}
266266

267-
static void noinstr el1_inv(struct pt_regs *regs, unsigned long esr)
268-
{
269-
enter_from_kernel_mode(regs);
270-
local_daif_inherit(regs);
271-
__panic_unhandled(regs, "64-bit el1h sync", esr);
272-
local_daif_mask();
273-
exit_to_kernel_mode(regs);
274-
}
275-
276267
static void noinstr arm64_enter_el1_dbg(struct pt_regs *regs)
277268
{
278269
regs->lockdep_hardirqs = lockdep_hardirqs_enabled();
@@ -346,7 +337,7 @@ asmlinkage void noinstr el1h_64_sync_handler(struct pt_regs *regs)
346337
el1_fpac(regs, esr);
347338
break;
348339
default:
349-
el1_inv(regs, esr);
340+
__panic_unhandled(regs, "64-bit el1h sync", esr);
350341
}
351342
}
352343

0 commit comments

Comments
 (0)