Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2009 16:11:14 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r190078 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb sparc64/include sparc64/sparc64
Message-ID:  <200903191611.n2JGBEh4068394@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Thu Mar 19 16:11:14 2009
New Revision: 190078
URL: http://svn.freebsd.org/changeset/base/190078

Log:
  MFC: r185109
  
  Use the interrupt level right below PIL_FAST for executing interrupt
  filters instead of PIL_FAST and allow special filters and handlers
  for interrupts which need to be able to interrupt even filters, f.e.
  bus error interrupts, to be registered with the revived INTR_FAST
  at PIL_FAST.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/sparc64/include/intr_machdep.h
  stable/7/sys/sparc64/sparc64/intr_machdep.c

Modified: stable/7/sys/sparc64/include/intr_machdep.h
==============================================================================
--- stable/7/sys/sparc64/include/intr_machdep.h	Thu Mar 19 16:03:21 2009	(r190077)
+++ stable/7/sys/sparc64/include/intr_machdep.h	Thu Mar 19 16:11:14 2009	(r190078)
@@ -47,8 +47,9 @@
 #define	PIL_AST		4	/* ast ipi */
 #define	PIL_STOP	5	/* stop cpu ipi */
 #define	PIL_PREEMPT	6	/* preempt idle thread cpu ipi */
+#define	PIL_FILTER	12	/* filter interrupts */
 #define	PIL_FAST	13	/* fast interrupts */
-#define	PIL_TICK	14
+#define	PIL_TICK	14	/* tick interrupts */
 
 #ifndef LOCORE
 

Modified: stable/7/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- stable/7/sys/sparc64/sparc64/intr_machdep.c	Thu Mar 19 16:03:21 2009	(r190077)
+++ stable/7/sys/sparc64/sparc64/intr_machdep.c	Thu Mar 19 16:11:14 2009	(r190078)
@@ -89,7 +89,7 @@ struct intr_vector intr_vectors[IV_MAX];
 uint16_t intr_countp[IV_MAX];
 static u_long intr_stray_count[IV_MAX];
 
-static const char *pil_names[] = {
+static const char *const pil_names[] = {
 	"stray",
 	"low",		/* PIL_LOW */
 	"ithrd",	/* PIL_ITHREAD */
@@ -97,7 +97,8 @@ static const char *pil_names[] = {
 	"ast",		/* PIL_AST */
 	"stop",		/* PIL_STOP */
 	"preempt",	/* PIL_PREEMPT */
-	"stray", "stray", "stray", "stray", "stray", "stray",
+	"stray", "stray", "stray", "stray", "stray",
+	"filter",	/* PIL_FILTER */
 	"fast",		/* PIL_FAST */
 	"tick",		/* PIL_TICK */
 };
@@ -374,10 +375,16 @@ inthand_add(const char *name, int vec, d
 	struct intr_event *ie;
 	struct intr_handler *ih;
 	struct intr_vector *iv;
-	int error, fast;
+	int error, filter;
 
 	if (vec < 0 || vec >= IV_MAX)
 		return (EINVAL);
+	/*
+	 * INTR_FAST filters/handlers are special purpose only, allowing
+	 * them to be shared just would complicate things unnecessarily.
+	 */
+	if ((flags & INTR_FAST) != 0 && (flags & INTR_EXCL) == 0)
+		return (EINVAL);
 	sx_xlock(&intr_table_lock);
 	iv = &intr_vectors[vec];
 	ic = iv->iv_ic;
@@ -394,24 +401,25 @@ inthand_add(const char *name, int vec, d
 	ic->ic_disable(iv);
 	iv->iv_refcnt++;
 	if (iv->iv_refcnt == 1)
-		intr_setup(filt != NULL ? PIL_FAST : PIL_ITHREAD, intr_fast,
+		intr_setup((flags & INTR_FAST) != 0 ? PIL_FAST :
+		    filt != NULL ? PIL_FILTER : PIL_ITHREAD, intr_fast,
 		    vec, intr_execute_handlers, iv);
 	else if (filt != NULL) {
 		/*
-		 * Check if we need to upgrade from PIL_ITHREAD to PIL_FAST.
+		 * Check if we need to upgrade from PIL_ITHREAD to PIL_FILTER.
 		 * Given that apart from the on-board SCCs and UARTs shared
 		 * interrupts are rather uncommon on sparc64 this sould be
 		 * pretty rare in practice.
 		 */
-		fast = 0;
+		filter = 0;
 		TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
 			if (ih->ih_filter != NULL && ih->ih_filter != filt) {
-				fast = 1;
+				filter = 1;
 				break;
 			}
 		}
-		if (fast == 0)
-			intr_setup(PIL_FAST, intr_fast, vec,
+		if (filter == 0)
+			intr_setup(PIL_FILTER, intr_fast, vec,
 			    intr_execute_handlers, iv);
 	}
 	intr_stray_count[vec] = 0;



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