arm: gic: Change GIC_DEBUG_SPURIOUS to TUNABLE

On armv6 default to 1 if INVARIANTS is set
On arm64 always default to 0

Discussed with: andrew, ian, mmel
This commit is contained in:
manu 2017-07-03 18:01:58 +00:00
parent de1115eaf6
commit 1aaa174dd2
2 changed files with 14 additions and 12 deletions

View File

@ -145,6 +145,14 @@ static struct resource_spec arm_gic_spec[] = {
{ -1, 0 } { -1, 0 }
}; };
#if defined(__arm__) && defined(INVARIANTS)
static int gic_debug_spurious = 1;
#else
static int gic_debug_spurious = 0;
#endif
TUNABLE_INT("hw.gic.debug_spurious", &gic_debug_spurious);
static u_int arm_gic_map[MAXCPU]; static u_int arm_gic_map[MAXCPU];
static struct arm_gic_softc *gic_sc = NULL; static struct arm_gic_softc *gic_sc = NULL;
@ -671,11 +679,10 @@ arm_gic_intr(void *arg)
*/ */
if (irq >= sc->nirqs) { if (irq >= sc->nirqs) {
#ifdef GIC_DEBUG_SPURIOUS if (gic_debug_spurious)
device_printf(sc->gic_dev, device_printf(sc->gic_dev,
"Spurious interrupt detected: last irq: %d on CPU%d\n", "Spurious interrupt detected: last irq: %d on CPU%d\n",
sc->last_irq[PCPU_GET(cpuid)], PCPU_GET(cpuid)); sc->last_irq[PCPU_GET(cpuid)], PCPU_GET(cpuid));
#endif
return (FILTER_HANDLED); return (FILTER_HANDLED);
} }
@ -700,9 +707,8 @@ dispatch_irq:
#endif #endif
} }
#ifdef GIC_DEBUG_SPURIOUS if (gic_debug_spurious)
sc->last_irq[PCPU_GET(cpuid)] = irq; sc->last_irq[PCPU_GET(cpuid)] = irq;
#endif
if ((gi->gi_flags & GI_FLAG_EARLY_EOI) == GI_FLAG_EARLY_EOI) if ((gi->gi_flags & GI_FLAG_EARLY_EOI) == GI_FLAG_EARLY_EOI)
gic_c_write_4(sc, GICC_EOIR, irq_active_reg); gic_c_write_4(sc, GICC_EOIR, irq_active_reg);

View File

@ -39,8 +39,6 @@
#ifndef _ARM_GIC_H_ #ifndef _ARM_GIC_H_
#define _ARM_GIC_H_ #define _ARM_GIC_H_
#define GIC_DEBUG_SPURIOUS
#define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ #define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */
#define GIC_LAST_SGI 15 #define GIC_LAST_SGI 15
#define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */ #define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */
@ -70,9 +68,7 @@ struct arm_gic_softc {
struct mtx mutex; struct mtx mutex;
uint32_t nirqs; uint32_t nirqs;
uint32_t typer; uint32_t typer;
#ifdef GIC_DEBUG_SPURIOUS
uint32_t last_irq[MAXCPU]; uint32_t last_irq[MAXCPU];
#endif
#ifdef INTRNG #ifdef INTRNG
uint32_t gic_iidr; uint32_t gic_iidr;