diff options
author | Mark Rutland <mark.rutland@arm.com> | 2021-06-07 12:46:09 +0300 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-06-07 13:35:55 +0300 |
commit | 101a5b665dcdff169ae7ad90556604c483d9027e (patch) | |
tree | 3af16cc4b68d4afac25582ea6fda7b4c9e7ace0b /arch/arm64/kernel/entry-common.c | |
parent | 33a3581a76f3a36c7dcc9864120ce681bcfbcff1 (diff) | |
download | linux-101a5b665dcdff169ae7ad90556604c483d9027e.tar.xz |
arm64: entry: move NMI preempt logic to C
Currently portions of our preempt logic are written in C while other
parts are written in assembly. Let's clean this up a little bit by
moving the NMI preempt checks to C. For now, the preempt count (and
need_resched) checking is left in assembly, and will be converted
with the body of the IRQ handler in subsequent patches.
Other than the increased lockdep coverage there should be no functional
change as a result of this patch.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Reviewed-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-6-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/kernel/entry-common.c')
-rw-r--r-- | arch/arm64/kernel/entry-common.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 1fe60578e556..08d17eb0ce13 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -122,6 +122,15 @@ asmlinkage void __sched arm64_preempt_schedule_irq(void) lockdep_assert_irqs_disabled(); /* + * DAIF.DA are cleared at the start of IRQ/FIQ handling, and when GIC + * priority masking is used the GIC irqchip driver will clear DAIF.IF + * using gic_arch_enable_irqs() for normal IRQs. If anything is set in + * DAIF we must have handled an NMI, so skip preemption. + */ + if (system_uses_irq_prio_masking() && read_sysreg(daif)) + return; + + /* * Preempting a task from an IRQ means we leave copies of PSTATE * on the stack. cpufeature's enable calls may modify PSTATE, but * resuming one of these preempted tasks would undo those changes. |