Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Added MSI/MSI-X and interrupt_distribute(9) support...



details:   https://anonhg.NetBSD.org/src/rev/3d3f1851b773
branches:  trunk
changeset: 348446:3d3f1851b773
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Wed Oct 19 00:08:41 2016 +0000

description:
Added MSI/MSI-X and interrupt_distribute(9) support for powerpc.

diffstat:

 sys/arch/bebox/pci/pci_machdep.c          |   14 +-
 sys/arch/evbppc/pmppc/pci/pci_machdep.c   |   14 +-
 sys/arch/ibmnws/pci/pci_machdep.c         |   12 +-
 sys/arch/macppc/pci/pci_machdep.c         |   15 +-
 sys/arch/mvmeppc/pci/pci_machdep.c        |   14 +-
 sys/arch/ofppc/pci/ofwpci.c               |   15 +-
 sys/arch/powerpc/booke/e500_intr.c        |  412 ++++++++++++++++++++++-
 sys/arch/powerpc/booke/pci/pq3pci.c       |  538 ++++++++++++++++++++---------
 sys/arch/powerpc/ibm4xx/dev/ibm405gp.c    |   11 +-
 sys/arch/powerpc/include/booke/intr.h     |    7 +-
 sys/arch/powerpc/include/cpu.h            |    4 +-
 sys/arch/powerpc/include/intr.h           |    7 +-
 sys/arch/powerpc/include/pci_machdep.h    |  236 +++++++-----
 sys/arch/powerpc/marvell/pci_machdep.c    |   20 +-
 sys/arch/powerpc/pci/pci_machdep_common.c |  148 ++++---
 sys/arch/powerpc/pic/intr.c               |  169 +++++++++-
 sys/arch/powerpc/powerpc/intr_stubs.c     |   18 +-
 sys/arch/prep/pci/pci_machdep.c           |   11 +-
 sys/arch/prep/pci/prep_pciconf_direct.c   |   15 +-
 sys/arch/sandpoint/include/pci_machdep.h  |   37 ++-
 sys/arch/sandpoint/pci/pci_machdep.c      |   86 ++++-
 21 files changed, 1408 insertions(+), 395 deletions(-)

diffs (truncated from 2821 to 300 lines):

diff -r 53e6c2347dfe -r 3d3f1851b773 sys/arch/bebox/pci/pci_machdep.c
--- a/sys/arch/bebox/pci/pci_machdep.c  Tue Oct 18 23:24:48 2016 +0000
+++ b/sys/arch/bebox/pci/pci_machdep.c  Wed Oct 19 00:08:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.21 2011/07/01 20:34:53 dyoung Exp $  */
+/*     $NetBSD: pci_machdep.c,v 1.22 2016/10/19 00:08:41 nonaka Exp $  */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.21 2011/07/01 20:34:53 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.22 2016/10/19 00:08:41 nonaka Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -87,6 +87,16 @@
        pc->pc_intr_establish = genppc_pci_intr_establish;
        pc->pc_intr_disestablish = genppc_pci_intr_disestablish;
        pc->pc_intr_setattr = genppc_pci_intr_setattr;
+       pc->pc_intr_type = genppc_pci_intr_type;
+       pc->pc_intr_alloc = genppc_pci_intr_alloc;
+       pc->pc_intr_release = genppc_pci_intr_release;
+       pc->pc_intx_alloc = genppc_pci_intx_alloc;
+
+       pc->pc_msi_v = (void *)pc;
+       genppc_pci_chipset_msi_init(pc);
+
+       pc->pc_msix_v = (void *)pc;
+       genppc_pci_chipset_msix_init(pc);
 
        pc->pc_conf_interrupt = bebox_pci_conf_interrupt;
        pc->pc_decompose_tag = genppc_pci_indirect_decompose_tag;
diff -r 53e6c2347dfe -r 3d3f1851b773 sys/arch/evbppc/pmppc/pci/pci_machdep.c
--- a/sys/arch/evbppc/pmppc/pci/pci_machdep.c   Tue Oct 18 23:24:48 2016 +0000
+++ b/sys/arch/evbppc/pmppc/pci/pci_machdep.c   Wed Oct 19 00:08:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.5 2011/06/30 00:52:56 matt Exp $     */
+/*     $NetBSD: pci_machdep.c,v 1.6 2016/10/19 00:08:41 nonaka Exp $   */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.5 2011/06/30 00:52:56 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.6 2016/10/19 00:08:41 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -104,6 +104,16 @@
        pc->pc_intr_establish = genppc_pci_intr_establish;
        pc->pc_intr_disestablish = genppc_pci_intr_disestablish;
        pc->pc_intr_setattr = genppc_pci_intr_setattr;
+       pc->pc_intr_type = genppc_pci_intr_type;
+       pc->pc_intr_alloc = genppc_pci_intr_alloc;
+       pc->pc_intr_release = genppc_pci_intr_release;
+       pc->pc_intx_alloc = genppc_pci_intx_alloc;
+
+       pc->pc_msi_v = (void *)pc;
+       genppc_pci_chipset_msi_init(pc);
+
+       pc->pc_msix_v = (void *)pc;
+       genppc_pci_chipset_msix_init(pc);
 
        pc->pc_conf_interrupt = pmppc_pci_conf_interrupt;
        pc->pc_decompose_tag = genppc_pci_indirect_decompose_tag;
diff -r 53e6c2347dfe -r 3d3f1851b773 sys/arch/ibmnws/pci/pci_machdep.c
--- a/sys/arch/ibmnws/pci/pci_machdep.c Tue Oct 18 23:24:48 2016 +0000
+++ b/sys/arch/ibmnws/pci/pci_machdep.c Wed Oct 19 00:08:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.9 2011/07/01 20:47:43 dyoung Exp $   */
+/*     $NetBSD: pci_machdep.c,v 1.10 2016/10/19 00:08:41 nonaka Exp $  */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -79,6 +79,16 @@
        pc->pc_intr_establish = genppc_pci_intr_establish;
        pc->pc_intr_disestablish = genppc_pci_intr_disestablish;
        pc->pc_intr_setattr = genppc_pci_intr_setattr;
+       pc->pc_intr_type = genppc_pci_intr_type;
+       pc->pc_intr_alloc = genppc_pci_intr_alloc;
+       pc->pc_intr_release = genppc_pci_intr_release;
+       pc->pc_intx_alloc = genppc_pci_intx_alloc;
+
+       pc->pc_msi_v = (void *)pc;
+       genppc_pci_chipset_msi_init(pc);
+
+       pc->pc_msix_v = (void *)pc;
+       genppc_pci_chipset_msix_init(pc);
 
        pc->pc_conf_interrupt = genppc_pci_conf_interrupt;
        pc->pc_decompose_tag = genppc_pci_indirect_decompose_tag;
diff -r 53e6c2347dfe -r 3d3f1851b773 sys/arch/macppc/pci/pci_machdep.c
--- a/sys/arch/macppc/pci/pci_machdep.c Tue Oct 18 23:24:48 2016 +0000
+++ b/sys/arch/macppc/pci/pci_machdep.c Wed Oct 19 00:08:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.40 2011/07/01 18:43:05 dyoung Exp $  */
+/*     $NetBSD: pci_machdep.c,v 1.41 2016/10/19 00:08:41 nonaka Exp $  */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.40 2011/07/01 18:43:05 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.41 2016/10/19 00:08:41 nonaka Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -123,6 +123,17 @@
        pc->pc_intr_evcnt = genppc_pci_intr_evcnt;
        pc->pc_intr_establish = genppc_pci_intr_establish;
        pc->pc_intr_disestablish = genppc_pci_intr_disestablish;
+       pc->pc_intr_setattr = genppc_pci_intr_setattr;
+       pc->pc_intr_type = genppc_pci_intr_type;
+       pc->pc_intr_alloc = genppc_pci_intr_alloc;
+       pc->pc_intr_release = genppc_pci_intr_release;
+       pc->pc_intx_alloc = genppc_pci_intx_alloc;
+
+       pc->pc_msi_v = (void *)pc;
+       genppc_pci_chipset_msi_init(pc);
+
+       pc->pc_msix_v = (void *)pc;
+       genppc_pci_chipset_msix_init(pc);
 
        pc->pc_conf_interrupt = genppc_pci_conf_interrupt;
        pc->pc_conf_hook = genppc_pci_conf_hook;
diff -r 53e6c2347dfe -r 3d3f1851b773 sys/arch/mvmeppc/pci/pci_machdep.c
--- a/sys/arch/mvmeppc/pci/pci_machdep.c        Tue Oct 18 23:24:48 2016 +0000
+++ b/sys/arch/mvmeppc/pci/pci_machdep.c        Wed Oct 19 00:08:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.10 2011/07/01 20:49:38 dyoung Exp $  */
+/*     $NetBSD: pci_machdep.c,v 1.11 2016/10/19 00:08:41 nonaka Exp $  */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.10 2011/07/01 20:49:38 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.11 2016/10/19 00:08:41 nonaka Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -88,6 +88,16 @@
        pc->pc_intr_establish = genppc_pci_intr_establish;
        pc->pc_intr_disestablish = genppc_pci_intr_disestablish;
        pc->pc_intr_setattr = genppc_pci_intr_setattr;
+       pc->pc_intr_type = genppc_pci_intr_type;
+       pc->pc_intr_alloc = genppc_pci_intr_alloc;
+       pc->pc_intr_release = genppc_pci_intr_release;
+       pc->pc_intx_alloc = genppc_pci_intx_alloc;
+
+       pc->pc_msi_v = (void *)pc;
+       genppc_pci_chipset_msi_init(pc);
+
+       pc->pc_msix_v = (void *)pc;
+       genppc_pci_chipset_msix_init(pc);
 
        pc->pc_conf_interrupt = mvmeppc_pci_conf_interrupt;
        pc->pc_decompose_tag = genppc_pci_indirect_decompose_tag;
diff -r 53e6c2347dfe -r 3d3f1851b773 sys/arch/ofppc/pci/ofwpci.c
--- a/sys/arch/ofppc/pci/ofwpci.c       Tue Oct 18 23:24:48 2016 +0000
+++ b/sys/arch/ofppc/pci/ofwpci.c       Wed Oct 19 00:08:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwpci.c,v 1.12 2014/02/28 05:50:27 matt Exp $ */
+/* $NetBSD: ofwpci.c,v 1.13 2016/10/19 00:08:41 nonaka Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofwpci.c,v 1.12 2014/02/28 05:50:27 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwpci.c,v 1.13 2016/10/19 00:08:41 nonaka Exp $");
 
 #include "opt_pci.h"
 
@@ -83,6 +83,17 @@
        pc->pc_intr_evcnt = genppc_pci_intr_evcnt;
        pc->pc_intr_establish = genppc_pci_intr_establish;
        pc->pc_intr_disestablish = genppc_pci_intr_disestablish;
+       pc->pc_intr_setattr = genppc_pci_intr_setattr;
+       pc->pc_intr_type = genppc_pci_intr_type;
+       pc->pc_intr_alloc = genppc_pci_intr_alloc;
+       pc->pc_intr_release = genppc_pci_intr_release;
+       pc->pc_intx_alloc = genppc_pci_intx_alloc;
+
+       pc->pc_msi_v = (void *)pc;
+       genppc_pci_chipset_msi_init(pc);
+
+       pc->pc_msix_v = (void *)pc;
+       genppc_pci_chipset_msix_init(pc);
 
        pc->pc_conf_interrupt = genppc_pci_conf_interrupt;
        pc->pc_decompose_tag = genppc_pci_ofmethod_decompose_tag;
diff -r 53e6c2347dfe -r 3d3f1851b773 sys/arch/powerpc/booke/e500_intr.c
--- a/sys/arch/powerpc/booke/e500_intr.c        Tue Oct 18 23:24:48 2016 +0000
+++ b/sys/arch/powerpc/booke/e500_intr.c        Wed Oct 19 00:08:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: e500_intr.c,v 1.33 2015/04/14 22:36:54 jmcneill Exp $  */
+/*     $NetBSD: e500_intr.c,v 1.34 2016/10/19 00:08:41 nonaka Exp $    */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -41,7 +41,7 @@
 #define __INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.33 2015/04/14 22:36:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.34 2016/10/19 00:08:41 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -53,6 +53,7 @@
 #include <sys/xcall.h>
 #include <sys/ipi.h>
 #include <sys/bitops.h>
+#include <sys/interrupt.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -88,11 +89,14 @@
        uint8_t is_refcnt;
        bus_size_t is_vpr;
        bus_size_t is_dr;
+       char is_source[INTRIDBUF];
+       char is_xname[INTRDEVNAMEBUF];
 };
 
 #define        INTR_SOURCE_INITIALIZER \
        { .is_func = e500_intr_spurious, .is_arg = NULL, \
-       .is_irq = -1, .is_ipl = IPL_NONE, .is_ist = IST_NONE, }
+       .is_irq = -1, .is_ipl = IPL_NONE, .is_ist = IST_NONE, \
+       .is_source = "", .is_xname = "", }
 
 struct e500_intr_name {
        uint8_t in_irq;
@@ -403,7 +407,8 @@
 static struct intr_source *e500_intr_sources;
 static const struct intr_source *e500_intr_last_source;
 
-static void    *e500_intr_establish(int, int, int, int (*)(void *), void *);
+static void    *e500_intr_establish(int, int, int, int (*)(void *), void *,
+                   const char *);
 static void    e500_intr_disestablish(void *);
 static void    e500_intr_cpu_attach(struct cpu_info *ci);
 static void    e500_intr_cpu_hatch(struct cpu_info *ci);
@@ -420,6 +425,7 @@
 static void    e500_spl0(void);
 static int     e500_splraise(int);
 static void    e500_splx(int);
+static const char *e500_intr_all_name_lookup(int, int);
 
 const struct intrsw e500_intrsw = {
        .intrsw_establish = e500_intr_establish,
@@ -724,7 +730,7 @@
 
 static void *
 e500_intr_cpu_establish(struct cpu_info *ci, int irq, int ipl, int ist,
-       int (*handler)(void *), void *arg)
+       int (*handler)(void *), void *arg, const char *xname)
 {
        struct cpu_softc * const cpu = ci->ci_softc;
        struct e500_intr_irq_info ii;
@@ -738,6 +744,12 @@
                return NULL;
        }
 
+       if (xname == NULL) {
+               xname = e500_intr_all_name_lookup(irq, ist);
+               if (xname == NULL)
+                       xname = "unknown";
+       }
+
        struct intr_source * const is = &e500_intr_sources[ii.irq_vector];
        mutex_enter(&e500_intr_lock);
        if (is->is_ipl != IPL_NONE) {
@@ -761,6 +773,34 @@
        is->is_refcnt++;
        is->is_vpr = ii.irq_vpr;
        is->is_dr = ii.irq_dr;
+       switch (ist) {
+       case IST_EDGE:
+       case IST_LEVEL_LOW:
+       case IST_LEVEL_HIGH:
+               snprintf(is->is_source, sizeof(is->is_source), "extirq %d",
+                   irq);
+               break;
+       case IST_ONCHIP:
+               snprintf(is->is_source, sizeof(is->is_source), "irq %d", irq);
+               break;
+       case IST_MSIGROUP:



Home | Main Index | Thread Index | Old Index