diff options
author | Julien Thierry <julien.thierry@arm.com> | 2019-06-11 11:38:11 +0200 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2019-06-21 16:50:23 +0200 |
commit | 48ce8f80f5901f1f031b00be66d659d39f33b0a1 (patch) | |
tree | cc0a9df40912c904f658cc063c2e2f230eb80489 /arch/arm64/include/asm/daifflags.h | |
parent | arm64: Fix incorrect irqflag restore for priority masking (diff) | |
download | linux-48ce8f80f5901f1f031b00be66d659d39f33b0a1.tar.xz linux-48ce8f80f5901f1f031b00be66d659d39f33b0a1.zip |
arm64: irqflags: Introduce explicit debugging for IRQ priorities
Using IRQ priority masking to enable/disable interrupts is a bit
sensitive as it requires to deal with both ICC_PMR_EL1 and PSR.I.
Introduce some validity checks to both highlight the states in which
functions dealing with IRQ enabling/disabling can (not) be called, and
bark a warning when called in an unexpected state.
Since these checks are done on hotpaths, introduce a build option to
choose whether to do the checking.
Cc: Will Deacon <will.deacon@arm.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/include/asm/daifflags.h')
-rw-r--r-- | arch/arm64/include/asm/daifflags.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/daifflags.h b/arch/arm64/include/asm/daifflags.h index f93204f319da..eca5bee1d85b 100644 --- a/arch/arm64/include/asm/daifflags.h +++ b/arch/arm64/include/asm/daifflags.h @@ -28,6 +28,10 @@ /* mask/save/unmask/restore all exceptions, including interrupts. */ static inline void local_daif_mask(void) { + WARN_ON(system_has_prio_mask_debugging() && + (read_sysreg_s(SYS_ICC_PMR_EL1) == (GIC_PRIO_IRQOFF | + GIC_PRIO_PSR_I_SET))); + asm volatile( "msr daifset, #0xf // local_daif_mask\n" : @@ -62,6 +66,9 @@ static inline void local_daif_restore(unsigned long flags) { bool irq_disabled = flags & PSR_I_BIT; + WARN_ON(system_has_prio_mask_debugging() && + !(read_sysreg(daif) & PSR_I_BIT)); + if (!irq_disabled) { trace_hardirqs_on(); |