Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jul 2017 18:01:59 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320606 - head/sys/arm/arm
Message-ID:  <201707031801.v63I1xCf029077@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Mon Jul  3 18:01:58 2017
New Revision: 320606
URL: https://svnweb.freebsd.org/changeset/base/320606

Log:
  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

Modified:
  head/sys/arm/arm/gic.c
  head/sys/arm/arm/gic.h

Modified: head/sys/arm/arm/gic.c
==============================================================================
--- head/sys/arm/arm/gic.c	Mon Jul  3 16:40:05 2017	(r320605)
+++ head/sys/arm/arm/gic.c	Mon Jul  3 18:01:58 2017	(r320606)
@@ -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 @@ dispatch_irq:
 #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);
 

Modified: head/sys/arm/arm/gic.h
==============================================================================
--- head/sys/arm/arm/gic.h	Mon Jul  3 16:40:05 2017	(r320605)
+++ head/sys/arm/arm/gic.h	Mon Jul  3 18:01:58 2017	(r320606)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707031801.v63I1xCf029077>