Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Rework cavium support in preparation for MULTIPROCE...



details:   https://anonhg.NetBSD.org/src/rev/85683555e442
branches:  trunk
changeset: 808764:85683555e442
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jun 01 22:55:12 2015 +0000

description:
Rework cavium support in preparation for MULTIPROCESSOR support

diffstat:

 sys/arch/evbmips/cavium/mach_intr.c       |    7 +-
 sys/arch/evbmips/cavium/machdep.c         |   13 +-
 sys/arch/evbmips/conf/ERLITE              |   13 +-
 sys/arch/evbmips/conf/files.octeon        |    8 +-
 sys/arch/evbmips/malta/machdep.c          |    6 +-
 sys/arch/evbmips/rmixl/machdep.c          |   10 +-
 sys/arch/mips/cavium/dev/octeon_ciureg.h  |    8 +-
 sys/arch/mips/cavium/dev/octeon_corereg.h |    5 +-
 sys/arch/mips/cavium/dev/octeon_dwctwo.c  |    6 +-
 sys/arch/mips/cavium/dev/octeon_gmx.c     |    6 +-
 sys/arch/mips/cavium/dev/octeon_ipd.c     |    6 +-
 sys/arch/mips/cavium/dev/octeon_mpi.c     |    6 +-
 sys/arch/mips/cavium/dev/octeon_pci.c     |    6 +-
 sys/arch/mips/cavium/dev/octeon_pow.c     |    3 +-
 sys/arch/mips/cavium/dev/octeon_uart.c    |    6 +-
 sys/arch/mips/cavium/mainbus_octeon1p.c   |    8 +-
 sys/arch/mips/cavium/octeon_cpunode.c     |  242 ++++++++++++++
 sys/arch/mips/cavium/octeon_intr.c        |  486 +++++++++++++++++------------
 sys/arch/mips/cavium/octeon_iobus.c       |    6 +-
 sys/arch/mips/cavium/octeonvar.h          |   45 ++-
 sys/arch/mips/conf/files.octeon           |    9 +-
 sys/arch/mips/conf/std.octeon             |    6 +-
 sys/arch/mips/include/cpu.h               |   15 +-
 sys/arch/mips/include/cpuregs.h           |    9 +-
 sys/arch/mips/include/intr.h              |    4 +-
 sys/arch/mips/include/lock.h              |    7 +-
 sys/arch/mips/include/locore.h            |   10 +-
 sys/arch/mips/include/mips_opcode.h       |   16 +-
 sys/arch/mips/mips/cpu_subr.c             |   75 +++-
 sys/arch/mips/mips/locore.S               |    8 +-
 sys/arch/mips/mips/locore_mips3.S         |   35 +-
 sys/arch/mips/mips/locore_octeon.S        |   55 ++-
 sys/arch/mips/mips/mips_fixup.c           |   22 +-
 sys/arch/mips/mips/mips_machdep.c         |   20 +-
 sys/arch/mips/rmi/rmixl_cpu.c             |   11 +-
 35 files changed, 855 insertions(+), 343 deletions(-)

diffs (truncated from 2151 to 300 lines):

diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/evbmips/cavium/mach_intr.c
--- a/sys/arch/evbmips/cavium/mach_intr.c       Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/evbmips/cavium/mach_intr.c       Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mach_intr.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $     */
+/*     $NetBSD: mach_intr.c,v 1.2 2015/06/01 22:55:12 matt Exp $       */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,12 +38,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mach_intr.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mach_intr.c,v 1.2 2015/06/01 22:55:12 matt Exp $");
 
 #include "opt_ddb.h"
 
 #include <sys/param.h>
 #include <sys/bus.h>
+#include <sys/lwp.h>
 #include <sys/device.h>
 #include <sys/intr.h>
 #include <sys/kernel.h>
@@ -56,7 +57,7 @@
 void
 evbmips_intr_init(void)
 {
-       octeon_intr_init();
+       octeon_intr_init(curcpu());
 }
 
 void
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/evbmips/cavium/machdep.c
--- a/sys/arch/evbmips/cavium/machdep.c Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/evbmips/cavium/machdep.c Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.2 2015/05/18 01:32:18 matt Exp $ */
+/*     $NetBSD: machdep.c,v 1.3 2015/06/01 22:55:12 matt Exp $ */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2015/05/18 01:32:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.3 2015/06/01 22:55:12 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -318,6 +318,7 @@
 void
 mach_init_memory(u_quad_t memsize)
 {
+       extern char kernel_text[];
        extern char end[];
 
        physmem = btoc(memsize);
@@ -342,10 +343,16 @@
                mem_cluster_cnt = 3;
        }
 
+       
+#ifdef MULTIPROCESSOR
+       const u_int cores = mipsNN_cp0_ebase_read() & MIPS_EBASE_CPUNUM;
+       mem_clusters[0].start = cores * 4096;
+#endif
+
        /*
         * Load the rest of the available pages into the VM system.
         */
-       mips_page_physload(MIPS_KSEG0_START, mips_round_page(end),
+       mips_page_physload(mips_trunc_page(kernel_text), mips_round_page(end),
            mem_clusters, mem_cluster_cnt, NULL, 0);
 
        /*
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/evbmips/conf/ERLITE
--- a/sys/arch/evbmips/conf/ERLITE      Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/evbmips/conf/ERLITE      Mon Jun 01 22:55:12 2015 +0000
@@ -1,11 +1,11 @@
-#      $NetBSD: ERLITE,v 1.8 2015/05/21 09:53:05 jmcneill Exp $
+#      $NetBSD: ERLITE,v 1.9 2015/06/01 22:55:12 matt Exp $
 
 include        "arch/mips/conf/std.octeon"
 include        "arch/evbmips/conf/files.octeon"
 
 #options       INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "ERLITE-$Revision: 1.8 $"
+#ident                 "ERLITE-$Revision: 1.9 $"
 
 maxusers       32
 
@@ -24,9 +24,9 @@
 
 # Standard system options
 options        KTRACE          # system call tracing support
-#options       SYSVMSG         # System V message queues
-#options       SYSVSEM         # System V semaphores
-#options       SYSVSHM         # System V shared memory
+options        SYSVMSG         # System V message queues
+options        SYSVSEM         # System V semaphores
+options        SYSVSHM         # System V shared memory
 options        NTP             # network time protocol
 
 # Debugging options
@@ -119,7 +119,8 @@
 #config                netbsd  root on cnmac0 type nfs
 
 mainbus0       at root
-cpu0           at mainbus?
+cpunode0       at mainbus?
+cpu*           at cpunode? core ?
 
 iobus0         at mainbus?
 bootbus0       at mainbus?
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/evbmips/conf/files.octeon
--- a/sys/arch/evbmips/conf/files.octeon        Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/evbmips/conf/files.octeon        Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.octeon,v 1.3 2015/05/18 01:53:50 matt Exp $
+#      $NetBSD: files.octeon,v 1.4 2015/06/01 22:55:12 matt Exp $
 
 file   arch/evbmips/cavium/autoconf.c
 file   arch/evbmips/cavium/machdep.c
@@ -9,9 +9,9 @@
 
 file   kern/subr_disk_mbr.c
 
-device cpu
-attach cpu at mainbus
-file   arch/evbmips/evbmips/cpu.c              cpu
+#device        cpu
+#attach        cpu at mainbus
+#file  arch/evbmips/evbmips/cpu.c              cpu
 
 # Memory Disk
 file   dev/md_root.c                           memory_disk_hooks
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/evbmips/malta/machdep.c
--- a/sys/arch/evbmips/malta/machdep.c  Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/evbmips/malta/machdep.c  Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.43 2014/03/24 20:06:31 christos Exp $    */
+/*     $NetBSD: machdep.c,v 1.44 2015/06/01 22:55:12 matt Exp $        */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.43 2014/03/24 20:06:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.44 2015/06/01 22:55:12 matt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -282,7 +282,7 @@
        /*
         * We can never be running on more than one processor but we can dream.
         */
-       mips_fixup_exceptions(mips_fixup_zero_relative);
+       mips_fixup_exceptions(mips_fixup_zero_relative, NULL);
 #endif
 }
 
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/evbmips/rmixl/machdep.c
--- a/sys/arch/evbmips/rmixl/machdep.c  Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/evbmips/rmixl/machdep.c  Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.14 2014/03/24 20:06:32 christos Exp $    */
+/*     $NetBSD: machdep.c,v 1.15 2015/06/01 22:55:12 matt Exp $        */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2014/03/24 20:06:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.15 2015/06/01 22:55:12 matt Exp $");
 
 #define __INTR_PRIVATE
 
@@ -217,7 +217,7 @@
 
 
 #ifdef MULTIPROCESSOR
-static bool rmixl_fixup_cop0_oscratch(int32_t, uint32_t [2]);
+static bool rmixl_fixup_cop0_oscratch(int32_t, uint32_t [2], void *);
 void rmixl_get_wakeup_info(struct rmixl_config *);
 #ifdef MACHDEP_DEBUG
 static void rmixl_wakeup_info_print(volatile rmixlfw_cpu_wakeup_info_t *);
@@ -408,7 +408,7 @@
        __asm __volatile("dmtc0 %0,$%1"
                :: "r"(&cpu_info_store), "n"(MIPS_COP_0_OSSCRATCH));
 #ifdef MULTIPROCESSOR
-       mips_fixup_exceptions(rmixl_fixup_cop0_oscratch);
+       mips_fixup_exceptions(rmixl_fixup_cop0_oscratch, NULL);
 #endif
        rmixl_fixup_curcpu();
 }
@@ -451,7 +451,7 @@
 
 #ifdef MULTIPROCESSOR
 static bool
-rmixl_fixup_cop0_oscratch(int32_t load_addr, uint32_t new_insns[2])
+rmixl_fixup_cop0_oscratch(int32_t load_addr, uint32_t new_insns[2], void *arg)
 {
        size_t offset = load_addr - (intptr_t)&cpu_info_store;
 
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/mips/cavium/dev/octeon_ciureg.h
--- a/sys/arch/mips/cavium/dev/octeon_ciureg.h  Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_ciureg.h  Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_ciureg.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */
+/*     $NetBSD: octeon_ciureg.h,v 1.2 2015/06/01 22:55:12 matt Exp $   */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -74,6 +74,12 @@
 #define        CIU_SOFT_RST                            UINT64_C(0x0001070000000740)
 #define        CIU_SOFT_PRST                           UINT64_C(0x0001070000000748)
 #define        CIU_PCI_INTA                            UINT64_C(0x0001070000000750)
+#define        CIU_INT4_SUM0                           UINT64_C(0x0001070000000c00)
+#define        CIU_INT4_SUM1                           UINT64_C(0x0001070000000c08)
+#define        CIU_INT4_EN00                           UINT64_C(0x0001070000000c80)
+#define        CIU_INT4_EN01                           UINT64_C(0x0001070000000c88)
+#define        CIU_INT4_EN10                           UINT64_C(0x0001070000000c90)
+#define        CIU_INT4_EN11                           UINT64_C(0x0001070000000c98)
 
 #define        CIU_INT0_SUM0_OFFSET                    0x0000
 #define        CIU_INT1_SUM0_OFFSET                    0x0008
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/mips/cavium/dev/octeon_corereg.h
--- a/sys/arch/mips/cavium/dev/octeon_corereg.h Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_corereg.h Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_corereg.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $        */
+/*     $NetBSD: octeon_corereg.h,v 1.2 2015/06/01 22:55:12 matt Exp $  */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -446,7 +446,8 @@
 
 #define        CP0_CVMCTL_XXX_63_32                    UINT64_C(0xffffffff00000000)
 #define        CP0_CVMCTL_FUSE_STARTBIT                UINT64_C(0x0000000080000000)
-#define        CP0_CVMCTL_XXX_30_29                    UINT64_C(0x0000000060000000)
+#define        CP0_CVMCTL_XXX_30                       UINT64_C(0x0000000040000000)
+#define        CP0_CVMCTL_KASUMI                       UINT64_C(0x0000000020000000)
 #define        CP0_CVMCTL_NODFA_CP21                   UINT64_C(0x0000000010000000)
 #define        CP0_CVMCTL_NOMUL                        UINT64_C(0x0000000008000000)
 #define        CP0_CVMCTL_NOCRYPTO                     UINT64_C(0x0000000004000000)
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/mips/cavium/dev/octeon_dwctwo.c
--- a/sys/arch/mips/cavium/dev/octeon_dwctwo.c  Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_dwctwo.c  Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_dwctwo.c,v 1.1 2015/05/01 07:23:47 hikaru Exp $ */
+/*     $NetBSD: octeon_dwctwo.c,v 1.2 2015/06/01 22:55:12 matt Exp $   */
 
 /*
  * Copyright (c) 2015 Masao Uebayashi <uebayasi%tombiinc.com@localhost>
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.1 2015/05/01 07:23:47 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.2 2015/06/01 22:55:12 matt Exp $");
 
 #include "opt_octeon.h"
 #include "opt_usb.h"
@@ -308,7 +308,7 @@
            config_found(sc->sc_dwc2.sc_dev, &sc->sc_dwc2.sc_bus, usbctlprint);
 
        sc->sc_ih = octeon_intr_establish(ffs64(CIU_INTX_SUM0_USB) - 1,
-           0, IPL_BIO, dwc2_intr, sc);
+           IPL_BIO, dwc2_intr, sc);
        if (sc->sc_ih == NULL)
                panic("can't establish common interrupt\n");
 }
diff -r 5b63b57a6fbf -r 85683555e442 sys/arch/mips/cavium/dev/octeon_gmx.c
--- a/sys/arch/mips/cavium/dev/octeon_gmx.c     Mon Jun 01 20:47:59 2015 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_gmx.c     Mon Jun 01 22:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_gmx.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $    */
+/*     $NetBSD: octeon_gmx.c,v 1.2 2015/06/01 22:55:12 matt Exp $      */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.2 2015/06/01 22:55:12 matt Exp $");
 
 #include "opt_octeon.h"
 
@@ -241,7 +241,7 @@
        octeon_gmx_intr_evcnt_attach(sc);
        if (octeon_gmx_intr_drop_ih == NULL)



Home | Main Index | Thread Index | Old Index