Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/pic Support MPSAFE interrupts.



details:   https://anonhg.NetBSD.org/src/rev/d1d18667480c
branches:  trunk
changeset: 794418:d1d18667480c
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Mar 13 23:47:53 2014 +0000

description:
Support MPSAFE interrupts.

diffstat:

 sys/arch/arm/pic/pic.c    |  31 ++++++++++++++++++++++++++-----
 sys/arch/arm/pic/picvar.h |  14 +++++++++-----
 2 files changed, 35 insertions(+), 10 deletions(-)

diffs (115 lines):

diff -r 931593ebb3c8 -r d1d18667480c sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c    Thu Mar 13 23:45:32 2014 +0000
+++ b/sys/arch/arm/pic/pic.c    Thu Mar 13 23:47:53 2014 +0000
@@ -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 @@
 #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 @@
        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 @@
 #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 @@
        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)
diff -r 931593ebb3c8 -r d1d18667480c sys/arch/arm/pic/picvar.h
--- a/sys/arch/arm/pic/picvar.h Thu Mar 13 23:45:32 2014 +0000
+++ b/sys/arch/arm/pic/picvar.h Thu Mar 13 23:47:53 2014 +0000
@@ -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 @@
 #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 @@
 #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 *);



Home | Main Index | Thread Index | Old Index