Module Name:    src
Committed By:   matt
Date:           Thu Mar 13 23:47:53 UTC 2014

Modified Files:
        src/sys/arch/arm/pic: pic.c picvar.h

Log Message:
Support MPSAFE interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/pic/pic.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/pic/picvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.20 src/sys/arch/arm/pic/pic.c:1.21
--- src/sys/arch/arm/pic/pic.c:1.20	Mon Mar  3 08:50:48 2014
+++ src/sys/arch/arm/pic/pic.c	Thu Mar 13 23:47:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.20 2014/03/03 08:50:48 matt Exp $	*/
+/*	$NetBSD: pic.c,v 1.21 2014/03/13 23:47:53 matt Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -27,10 +27,13 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.20 2014/03/03 08:50:48 matt Exp $");
 
 #define _INTR_PRIVATE
+#include "opt_ddb.h"
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.21 2014/03/13 23:47:53 matt Exp $");
+
 #include <sys/param.h>
 #include <sys/atomic.h>
 #include <sys/cpu.h>
@@ -43,6 +46,10 @@ __KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.20
 #include <arm/armreg.h>
 #include <arm/cpufunc.h>
 
+#ifdef DDB
+#include <arm/db_machdep.h>
+#endif
+
 #include <arm/pic/picvar.h>
 
 static uint32_t
@@ -100,6 +107,16 @@ pic_ipi_xcall(void *arg)
 	return 1;
 }
 
+#ifdef DDB
+int
+pic_ipi_ddb(void *arg)
+{
+	printf("%s: %s: tf=%p\n", __func__, curcpu()->ci_cpuname, arg);
+	kdb_trap(-1, arg);
+	return 1;
+}
+#endif
+
 void
 intr_cpu_init(struct cpu_info *ci)
 {
@@ -269,7 +286,11 @@ pic_dispatch(struct intrsource *is, void
 #ifdef MULTIPROCESSOR
 	if (!is->is_mpsafe) {
 		KERNEL_LOCK(1, NULL);
+		const u_int ci_blcnt __diagused = curcpu()->ci_biglock_count;
+		const u_int l_blcnt __diagused = curlwp->l_blcnt;
 		(void)(*func)(arg);
+		KASSERT(ci_blcnt == curcpu()->ci_biglock_count);
+		KASSERT(l_blcnt == curlwp->l_blcnt);
 		KERNEL_UNLOCK_ONE(NULL);
 	} else
 #endif
@@ -613,11 +634,11 @@ pic_establish_intr(struct pic_softc *pic
 	is->is_pic = pic;
 	is->is_irq = irq;
 	is->is_ipl = ipl;
-	is->is_type = type;
+	is->is_type = type & 0xff;
 	is->is_func = func;
 	is->is_arg = arg;
 #ifdef MULTIPROCESSOR
-	is->is_mpsafe = false;
+	is->is_mpsafe = (type & IST_MPSAFE);
 #endif
 
 	if (pic->pic_ops->pic_source_name)

Index: src/sys/arch/arm/pic/picvar.h
diff -u src/sys/arch/arm/pic/picvar.h:1.8 src/sys/arch/arm/pic/picvar.h:1.9
--- src/sys/arch/arm/pic/picvar.h:1.8	Mon Mar  3 08:50:48 2014
+++ src/sys/arch/arm/pic/picvar.h	Thu Mar 13 23:47:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: picvar.h,v 1.8 2014/03/03 08:50:48 matt Exp $	*/
+/*	$NetBSD: picvar.h,v 1.9 2014/03/13 23:47:53 matt Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,11 +47,13 @@ struct cpu_info;
 #define	IPI_AST			0	/* just get an interrupt */
 #define	IPI_XCALL		1	/* xcall */
 #define	IPI_NOP			2	/* just get an interrupt (armv6) */
-#ifndef __HAVE_PREEMPTION
-#define	NIPI			3
+#define	IPI_SHOOTDOWN		3	/* cause a tlb shootdown */
+#define	IPI_DDB			4	/* enter DDB */
+#ifdef __HAVE_PREEMPTION
+#define	IPI_KPREEMPT		5	/* cause a preemption */
+#define	NIPI			6
 #else
-#define	IPI_KPREEMPT		4	/* cause a preemption */
-#define	NIPI			4
+#define	NIPI			5
 #endif
 
 int	pic_handle_intr(void *);
@@ -158,6 +160,8 @@ void	pic_do_pending_int(void);
 #ifdef MULTIPROCESSOR
 int	pic_ipi_nop(void *);
 int	pic_ipi_xcall(void *);
+int	pic_ipi_shootdown(void *);
+int	pic_ipi_ddb(void *);
 #endif
 #ifdef __HAVE_PIC_FAST_SOFTINTS
 int	pic_handle_softint(void *);

Reply via email to