Source-Changes-HG archive

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

[src/trunk]: src/sys Implement MI IPI interface with cross-call support.



details:   https://anonhg.NetBSD.org/src/rev/3515a747f896
branches:  trunk
changeset: 329331:3515a747f896
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon May 19 22:47:53 2014 +0000

description:
Implement MI IPI interface with cross-call support.

diffstat:

 sys/arch/alpha/alpha/ipifuncs.c            |   59 ++++--
 sys/arch/alpha/include/intr.h              |    5 +-
 sys/arch/arm/arm32/arm32_machdep.c         |   15 +-
 sys/arch/arm/cortex/gic.c                  |    7 +-
 sys/arch/arm/pic/pic.c                     |   12 +-
 sys/arch/arm/pic/picvar.h                  |   10 +-
 sys/arch/hppa/hppa/ipifuncs.c              |   41 +++-
 sys/arch/hppa/include/intrdefs.h           |    5 +-
 sys/arch/mips/include/intr.h               |    5 +-
 sys/arch/mips/mips/cpu_subr.c              |   12 +-
 sys/arch/mips/mips/ipifuncs.c              |   10 +-
 sys/arch/powerpc/booke/e500_intr.c         |    6 +-
 sys/arch/powerpc/include/booke/intr.h      |    3 +-
 sys/arch/powerpc/pic/ipi.c                 |    8 +-
 sys/arch/powerpc/pic/ipivar.h              |    5 +-
 sys/arch/powerpc/powerpc/powerpc_machdep.c |   19 ++-
 sys/arch/sparc/sparc/cpu.c                 |   21 ++-
 sys/arch/sparc64/sparc64/ipifuncs.c        |   13 +-
 sys/arch/vax/include/cpu.h                 |    3 +-
 sys/arch/vax/vax/multicpu.c                |   24 ++-
 sys/arch/x86/include/intrdefs.h            |    6 +-
 sys/arch/x86/x86/ipi.c                     |   39 ++++-
 sys/arch/xen/include/intrdefs.h            |    6 +-
 sys/arch/xen/x86/xen_ipi.c                 |   36 +++-
 sys/conf/files                             |    3 +-
 sys/kern/init_main.c                       |    6 +-
 sys/kern/subr_ipi.c                        |  238 +++++++++++++++++++++++++++++
 sys/sys/ipi.h                              |   62 +++++++
 28 files changed, 586 insertions(+), 93 deletions(-)

diffs (truncated from 1464 to 300 lines):

diff -r 4fbe6de88e27 -r 3515a747f896 sys/arch/alpha/alpha/ipifuncs.c
--- a/sys/arch/alpha/alpha/ipifuncs.c   Mon May 19 22:09:58 2014 +0000
+++ b/sys/arch/alpha/alpha/ipifuncs.c   Mon May 19 22:47:53 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.47 2011/06/14 15:34:22 matt Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.48 2014/05/19 22:47:53 rmind Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.47 2011/06/14 15:34:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.48 2014/05/19 22:47:53 rmind Exp $");
 
 /*
  * Interprocessor interrupt handlers.
@@ -45,6 +45,7 @@
 #include <sys/reboot.h>
 #include <sys/atomic.h>
 #include <sys/cpu.h>
+#include <sys/ipi.h>
 #include <sys/intr.h>
 #include <sys/xcall.h>
 #include <sys/bitops.h>
@@ -59,12 +60,13 @@
 
 typedef void (*ipifunc_t)(struct cpu_info *, struct trapframe *);
 
-void   alpha_ipi_halt(struct cpu_info *, struct trapframe *);
-void   alpha_ipi_microset(struct cpu_info *, struct trapframe *);
-void   alpha_ipi_imb(struct cpu_info *, struct trapframe *);
-void   alpha_ipi_ast(struct cpu_info *, struct trapframe *);
-void   alpha_ipi_pause(struct cpu_info *, struct trapframe *);
-void   alpha_ipi_xcall(struct cpu_info *, struct trapframe *);
+static void    alpha_ipi_halt(struct cpu_info *, struct trapframe *);
+static void    alpha_ipi_microset(struct cpu_info *, struct trapframe *);
+static void    alpha_ipi_imb(struct cpu_info *, struct trapframe *);
+static void    alpha_ipi_ast(struct cpu_info *, struct trapframe *);
+static void    alpha_ipi_pause(struct cpu_info *, struct trapframe *);
+static void    alpha_ipi_xcall(struct cpu_info *, struct trapframe *);
+static void    alpha_ipi_generic(struct cpu_info *, struct trapframe *);
 
 /*
  * NOTE: This table must be kept in order with the bit definitions
@@ -77,7 +79,8 @@
        [ilog2(ALPHA_IPI_IMB)] =        alpha_ipi_imb,
        [ilog2(ALPHA_IPI_AST)] =        alpha_ipi_ast,
        [ilog2(ALPHA_IPI_PAUSE)] =      alpha_ipi_pause,
-       [ilog2(ALPHA_IPI_XCALL)] =      alpha_ipi_xcall
+       [ilog2(ALPHA_IPI_XCALL)] =      alpha_ipi_xcall,
+       [ilog2(ALPHA_IPI_GENERIC)] =    alpha_ipi_generic
 };
 
 const char * const ipinames[ALPHA_NIPIS] = {
@@ -87,7 +90,8 @@
        [ilog2(ALPHA_IPI_IMB)] =        "imb ipi",
        [ilog2(ALPHA_IPI_AST)] =        "ast ipi",
        [ilog2(ALPHA_IPI_PAUSE)] =      "pause ipi",
-       [ilog2(ALPHA_IPI_XCALL)] =      "xcall ipi"
+       [ilog2(ALPHA_IPI_XCALL)] =      "xcall ipi",
+       [ilog2(ALPHA_IPI_GENERIC)] =    "generic ipi",
 };
 
 /*
@@ -208,7 +212,7 @@
        }
 }
 
-void
+static void
 alpha_ipi_halt(struct cpu_info *ci, struct trapframe *framep)
 {
        u_long cpu_id = ci->ci_cpuid;
@@ -241,21 +245,21 @@
        /* NOTREACHED */
 }
 
-void
+static void
 alpha_ipi_microset(struct cpu_info *ci, struct trapframe *framep)
 {
 
        cc_calibrate_cpu(ci);
 }
 
-void
+static void
 alpha_ipi_imb(struct cpu_info *ci, struct trapframe *framep)
 {
 
        alpha_pal_imb();
 }
 
-void
+static void
 alpha_ipi_ast(struct cpu_info *ci, struct trapframe *framep)
 {
 
@@ -263,7 +267,7 @@
                aston(ci->ci_curlwp);
 }
 
-void
+static void
 alpha_ipi_pause(struct cpu_info *ci, struct trapframe *framep)
 {
        u_long cpumask = (1UL << ci->ci_cpuid);
@@ -295,17 +299,15 @@
  * MD support for xcall(9) interface.
  */
 
-void
+static void
 alpha_ipi_xcall(struct cpu_info *ci, struct trapframe *framep)
 {
-
        xc_ipi_handler();
 }
 
 void
 xc_send_ipi(struct cpu_info *ci)
 {
-
        KASSERT(kpreempt_disabled());
        KASSERT(curcpu() != ci);
 
@@ -317,3 +319,24 @@
                alpha_broadcast_ipi(ALPHA_IPI_XCALL);
        }
 }
+
+static void
+alpha_ipi_generic(struct cpu_info *ci, struct trapframe *framep)
+{
+       ipi_cpu_handler();
+}
+
+void
+cpu_ipi(struct cpu_info *ci)
+{
+       KASSERT(kpreempt_disabled());
+       KASSERT(curcpu() != ci);
+
+       if (ci) {
+               /* Unicast: remote CPU. */
+               alpha_send_ipi(ci->ci_cpuid, ALPHA_IPI_GENERIC);
+       } else {
+               /* Broadcast: all, but local CPU (caller will handle it). */
+               alpha_broadcast_ipi(ALPHA_IPI_GENERIC);
+       }
+}
diff -r 4fbe6de88e27 -r 3515a747f896 sys/arch/alpha/include/intr.h
--- a/sys/arch/alpha/include/intr.h     Mon May 19 22:09:58 2014 +0000
+++ b/sys/arch/alpha/include/intr.h     Mon May 19 22:47:53 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.70 2012/02/06 02:14:13 matt Exp $ */
+/* $NetBSD: intr.h,v 1.71 2014/05/19 22:47:53 rmind Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -164,8 +164,9 @@
 #define        ALPHA_IPI_AST                   (1UL << 4)
 #define        ALPHA_IPI_PAUSE                 (1UL << 5)
 #define        ALPHA_IPI_XCALL                 (1UL << 6)
+#define        ALPHA_IPI_GENERIC               (1UL << 7)
 
-#define        ALPHA_NIPIS             7       /* must not exceed 64 */
+#define        ALPHA_NIPIS                     8       /* must not exceed 64 */
 
 struct cpu_info;
 struct trapframe;
diff -r 4fbe6de88e27 -r 3515a747f896 sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c        Mon May 19 22:09:58 2014 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c        Mon May 19 22:47:53 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm32_machdep.c,v 1.104 2014/04/11 04:19:47 matt Exp $ */
+/*     $NetBSD: arm32_machdep.c,v 1.105 2014/05/19 22:47:53 rmind Exp $        */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.104 2014/04/11 04:19:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.105 2014/05/19 22:47:53 rmind Exp $");
 
 #include "opt_modular.h"
 #include "opt_md.h"
@@ -65,6 +65,7 @@
 #include <sys/module.h>
 #include <sys/atomic.h>
 #include <sys/xcall.h>
+#include <sys/ipi.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -706,6 +707,16 @@
 
        intr_ipi_send(ci != NULL ? ci->ci_kcpuset : NULL, IPI_XCALL);
 }
+
+void
+cpu_ipi(struct cpu_info *ci)
+{
+       KASSERT(kpreempt_disabled());
+       KASSERT(curcpu() != ci);
+
+       intr_ipi_send(ci != NULL ? ci->ci_kcpuset : NULL, IPI_GENERIC);
+}
+
 #endif /* MULTIPROCESSOR */
 
 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
diff -r 4fbe6de88e27 -r 3515a747f896 sys/arch/arm/cortex/gic.c
--- a/sys/arch/arm/cortex/gic.c Mon May 19 22:09:58 2014 +0000
+++ b/sys/arch/arm/cortex/gic.c Mon May 19 22:47:53 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gic.c,v 1.9 2014/04/27 16:22:13 matt Exp $     */
+/*     $NetBSD: gic.c,v 1.10 2014/05/19 22:47:53 rmind Exp $   */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #define _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.9 2014/04/27 16:22:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.10 2014/05/19 22:47:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -42,7 +42,6 @@
 #include <sys/intr.h>
 #include <sys/cpu.h>
 #include <sys/proc.h>
-#include <sys/xcall.h>         /* for xc_ipi_handler */
 
 #include <arm/armreg.h>
 #include <arm/cpufunc.h>
@@ -612,6 +611,8 @@
            pic_ipi_nop, (void *)-1);
        intr_establish(ARMGIC_SGI_IPIBASE + IPI_XCALL, IPL_VM, IST_EDGE,
            pic_ipi_xcall, (void *)-1);
+       intr_establish(ARMGIC_SGI_IPIBASE + IPI_GENERIC, IPL_VM, IST_EDGE,
+           pic_ipi_generic, (void *)-1);
        intr_establish(ARMGIC_SGI_IPIBASE + IPI_NOP, IPL_VM, IST_EDGE,
            pic_ipi_nop, (void *)-1);
        intr_establish(ARMGIC_SGI_IPIBASE + IPI_SHOOTDOWN, IPL_VM, IST_EDGE,
diff -r 4fbe6de88e27 -r 3515a747f896 sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c    Mon May 19 22:09:58 2014 +0000
+++ b/sys/arch/arm/pic/pic.c    Mon May 19 22:47:53 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pic.c,v 1.21 2014/03/13 23:47:53 matt Exp $    */
+/*     $NetBSD: pic.c,v 1.22 2014/05/19 22:47:53 rmind Exp $   */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
 #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 $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.22 2014/05/19 22:47:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -42,6 +42,7 @@
 #include <sys/kernel.h>
 #include <sys/kmem.h>
 #include <sys/xcall.h>
+#include <sys/ipi.h>
 
 #include <arm/armreg.h>
 #include <arm/cpufunc.h>
@@ -107,6 +108,13 @@
        return 1;
 }
 
+int
+pic_ipi_generic(void *arg)
+{
+       ipi_cpu_handler();
+       return 1;
+}
+
 #ifdef DDB
 int
 pic_ipi_ddb(void *arg)
diff -r 4fbe6de88e27 -r 3515a747f896 sys/arch/arm/pic/picvar.h
--- a/sys/arch/arm/pic/picvar.h Mon May 19 22:09:58 2014 +0000
+++ b/sys/arch/arm/pic/picvar.h Mon May 19 22:47:53 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: picvar.h,v 1.9 2014/03/13 23:47:53 matt Exp $  */
+/*     $NetBSD: picvar.h,v 1.10 2014/05/19 22:47:53 rmind Exp $        */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.



Home | Main Index | Thread Index | Old Index