Skip to content

Commit 9aa8818

Browse files
maddy-kerneldevmpe
authored andcommitted
powerpc: Add new kconfig CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
New Kconfig is added "CONFIG_PPC_IRQ_SOFT_MASK_DEBUG" to add WARN_ON to alert the invalid transitions. Also moved the code under the CONFIG_TRACE_IRQFLAGS in arch_local_irq_restore() to new Kconfig. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> [mpe: Fix name of CONFIG option in change log] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent f442d00 commit 9aa8818

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎arch/powerpc/Kconfig.debug‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ config MSI_BITMAP_SELFTEST
9090
depends on DEBUG_KERNEL
9191
default n
9292

93+
config PPC_IRQ_SOFT_MASK_DEBUG
94+
bool "Include extra checks for powerpc irq soft masking"
95+
default n
96+
9397
config XMON
9498
bool "Include xmon kernel debugger"
9599
depends on DEBUG_KERNEL

‎arch/powerpc/include/asm/hw_irq.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static inline notrace unsigned long irq_soft_mask_return(void)
7171
*/
7272
static inline notrace void irq_soft_mask_set(unsigned long mask)
7373
{
74-
#ifdef CONFIG_TRACE_IRQFLAGS
74+
#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
7575
/*
7676
* The irq mask must always include the STD bit if any are set.
7777
*
@@ -101,7 +101,7 @@ static inline notrace unsigned long irq_soft_mask_set_return(unsigned long mask)
101101
{
102102
unsigned long flags;
103103

104-
#ifdef CONFIG_TRACE_IRQFLAGS
104+
#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
105105
WARN_ON(mask && !(mask & IRQS_DISABLED));
106106
#endif
107107

‎arch/powerpc/kernel/entry_64.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
128128
* of irq tracing is used, we additionally check that condition
129129
* is correct
130130
*/
131-
#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG)
131+
#if defined(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG) && defined(CONFIG_BUG)
132132
lbz r10,PACAIRQSOFTMASK(r13)
133133
1: tdnei r10,IRQS_ENABLED
134134
EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING
@@ -911,7 +911,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
911911
rlwinm r7,r7,0,~PACA_IRQ_HARD_DIS
912912
stb r7,PACAIRQHAPPENED(r13)
913913
1:
914-
#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG)
914+
#if defined(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG) && defined(CONFIG_BUG)
915915
/* The interrupt should not have soft enabled. */
916916
lbz r7,PACAIRQSOFTMASK(r13)
917917
1: tdeqi r7,IRQS_ENABLED

‎arch/powerpc/kernel/irq.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ notrace void arch_local_irq_restore(unsigned long mask)
264264
*/
265265
if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
266266
__hard_irq_disable();
267-
#ifdef CONFIG_TRACE_IRQFLAGS
267+
#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
268268
else {
269269
/*
270270
* We should already be hard disabled here. We had bugs
@@ -275,7 +275,7 @@ notrace void arch_local_irq_restore(unsigned long mask)
275275
if (WARN_ON(mfmsr() & MSR_EE))
276276
__hard_irq_disable();
277277
}
278-
#endif /* CONFIG_TRACE_IRQFLAGS */
278+
#endif
279279

280280
irq_soft_mask_set(IRQS_ALL_DISABLED);
281281
trace_hardirqs_off();

0 commit comments

Comments
 (0)