From c33f3f1e318a737fea28b9c21fd1f30a4fa3c792 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Mon, 3 Jul 2017 18:01:58 +0000 Subject: [PATCH] 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 --- sys/arm/arm/gic.c | 22 ++++++++++++++-------- sys/arm/arm/gic.h | 4 ---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index 211a40450a00..66af88027f18 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -145,6 +145,14 @@ static struct resource_spec arm_gic_spec[] = { { -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 struct arm_gic_softc *gic_sc = NULL; @@ -671,11 +679,10 @@ arm_gic_intr(void *arg) */ if (irq >= sc->nirqs) { -#ifdef GIC_DEBUG_SPURIOUS - device_printf(sc->gic_dev, - "Spurious interrupt detected: last irq: %d on CPU%d\n", - sc->last_irq[PCPU_GET(cpuid)], PCPU_GET(cpuid)); -#endif + if (gic_debug_spurious) + device_printf(sc->gic_dev, + "Spurious interrupt detected: last irq: %d on CPU%d\n", + sc->last_irq[PCPU_GET(cpuid)], PCPU_GET(cpuid)); return (FILTER_HANDLED); } @@ -700,9 +707,8 @@ arm_gic_intr(void *arg) #endif } -#ifdef GIC_DEBUG_SPURIOUS - sc->last_irq[PCPU_GET(cpuid)] = irq; -#endif + if (gic_debug_spurious) + sc->last_irq[PCPU_GET(cpuid)] = irq; if ((gi->gi_flags & GI_FLAG_EARLY_EOI) == GI_FLAG_EARLY_EOI) gic_c_write_4(sc, GICC_EOIR, irq_active_reg); diff --git a/sys/arm/arm/gic.h b/sys/arm/arm/gic.h index d6d0db143e18..c1b7d532ca90 100644 --- a/sys/arm/arm/gic.h +++ b/sys/arm/arm/gic.h @@ -39,8 +39,6 @@ #ifndef _ARM_GIC_H_ #define _ARM_GIC_H_ -#define GIC_DEBUG_SPURIOUS - #define GIC_FIRST_SGI 0 /* Irqs 0-15 are SGIs/IPIs. */ #define GIC_LAST_SGI 15 #define GIC_FIRST_PPI 16 /* Irqs 16-31 are private (per */ @@ -70,9 +68,7 @@ struct arm_gic_softc { struct mtx mutex; uint32_t nirqs; uint32_t typer; -#ifdef GIC_DEBUG_SPURIOUS uint32_t last_irq[MAXCPU]; -#endif #ifdef INTRNG uint32_t gic_iidr;