Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 Updates to pmap_bootstrap() for sun4v - par...
details: https://anonhg.NetBSD.org/src/rev/4ca5d38c3dec
branches: trunk
changeset: 325287:4ca5d38c3dec
user: palle <palle%NetBSD.org@localhost>
date: Mon Dec 16 20:17:34 2013 +0000
description:
Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
diffstat:
sys/arch/sparc64/conf/GENERIC | 5 ++-
sys/arch/sparc64/conf/files.sparc64 | 3 +-
sys/arch/sparc64/dev/ebus_mainbus.c | 17 ++++++++++-----
sys/arch/sparc64/include/cpu.h | 5 +++-
sys/arch/sparc64/include/ctlreg.h | 4 ++-
sys/arch/sparc64/include/param.h | 8 ++++++-
sys/arch/sparc64/include/pte.h | 6 +++-
sys/arch/sparc64/sparc64/cpu.c | 38 +++++++++++++++++++++++++++++++++-
sys/arch/sparc64/sparc64/pmap.c | 40 +++++++++++++++++++++++++++++-------
9 files changed, 102 insertions(+), 24 deletions(-)
diffs (truncated from 351 to 300 lines):
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/conf/GENERIC
--- a/sys/arch/sparc64/conf/GENERIC Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/conf/GENERIC Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.169 2013/09/24 18:12:59 jdc Exp $
+# $NetBSD: GENERIC,v 1.170 2013/12/16 20:17:34 palle Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.169 $"
+#ident "GENERIC-$Revision: 1.170 $"
maxusers 64
@@ -31,6 +31,7 @@
# Options for variants of the Sun SPARC architecure.
options SUN4U # sun4u - UltraSPARC
+options SUN4V # sun4v - UltraSPARC T1/T2+/T3/T4/T5
#options BLINK # blink the system LED
#### System options that are the same for all ports
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/conf/files.sparc64
--- a/sys/arch/sparc64/conf/files.sparc64 Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/conf/files.sparc64 Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.sparc64,v 1.142 2013/08/27 13:11:12 macallan Exp $
+# $NetBSD: files.sparc64,v 1.143 2013/12/16 20:17:34 palle Exp $
# @(#)files.sparc64 8.1 (Berkeley) 7/19/93
# sparc64-specific configuration info
@@ -248,6 +248,7 @@
file arch/sparc64/sparc64/vm_machdep.c
file arch/sparc64/sparc64/ipifuncs.c multiprocessor
file arch/sparc64/sparc64/lock_stubs.s
+file arch/sparc64/sparc64/hvcall.S sun4v
file arch/sparc64/sparc64/db_interface.c ddb | kgdb
file arch/sparc64/sparc64/db_machdep.c ddb
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/dev/ebus_mainbus.c
--- a/sys/arch/sparc64/dev/ebus_mainbus.c Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/dev/ebus_mainbus.c Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ebus_mainbus.c,v 1.11 2013/09/12 19:51:09 martin Exp $ */
+/* $NetBSD: ebus_mainbus.c,v 1.12 2013/12/16 20:17:35 palle Exp $ */
/* $OpenBSD: ebus_mainbus.c,v 1.7 2010/11/11 17:58:23 miod Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus_mainbus.c,v 1.11 2013/09/12 19:51:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus_mainbus.c,v 1.12 2013/12/16 20:17:35 palle Exp $");
#ifdef DEBUG
#define EDB_PROM 0x01
@@ -69,9 +69,11 @@
static bus_space_tag_t ebus_mainbus_alloc_bus_tag(struct ebus_softc *,
bus_space_tag_t, int);
#ifdef SUN4V
+#if 0
+XXX
static void ebus_mainbus_intr_ack(struct intrhand *);
#endif
-
+#endif
int
ebus_mainbus_match(device_t parent, cfdata_t cf, void *aux)
{
@@ -280,6 +282,8 @@
int ino;
#ifdef SUN4V
+#if 0
+XXX
if (CPU_ISSUN4V) {
struct upa_reg reg;
u_int64_t devhandle, devino = INTINO(ihandle);
@@ -329,7 +333,7 @@
return (ih);
}
#endif
-
+#endif
ihandle |= sc->sc_ign;
ino = INTINO(ihandle);
@@ -372,11 +376,12 @@
}
#ifdef SUN4V
-
+#if 0
+XXX
static void
ebus_mainbus_intr_ack(struct intrhand *ih)
{
hv_intr_setstate(ih->ih_number, INTR_IDLE);
}
-
#endif
+#endif
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/include/cpu.h
--- a/sys/arch/sparc64/include/cpu.h Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/include/cpu.h Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.105 2013/11/10 00:50:13 christos Exp $ */
+/* $NetBSD: cpu.h,v 1.106 2013/12/16 20:17:35 palle Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -348,6 +348,9 @@
void sparc_softintr_schedule(void *);
void sparc_softintr_disestablish(void *);
+/* cpu.c */
+int cpu_myid(void);
+
/* disksubr.c */
struct dkbad;
int isbad(struct dkbad *bt, int, int, int);
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/include/ctlreg.h
--- a/sys/arch/sparc64/include/ctlreg.h Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/include/ctlreg.h Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctlreg.h,v 1.59 2012/11/08 16:36:53 nakayama Exp $ */
+/* $NetBSD: ctlreg.h,v 1.60 2013/12/16 20:17:35 palle Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath
@@ -663,6 +663,8 @@
SPARC64_LD_DEF(lduha, uint16_t, uint32_t)
/* load unsigned int from alternate address space */
SPARC64_LD_DEF(lda, uint32_t, uint32_t)
+/* load unsigned word from alternate address space */
+SPARC64_LD_DEF(lduwa, uint32_t, uint32_t)
/* load signed int from alternate address space */
SPARC64_LD_DEF(ldswa, int, int)
/* load 64-bit unsigned int from alternate address space */
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/include/param.h
--- a/sys/arch/sparc64/include/param.h Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/include/param.h Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.51 2013/01/03 09:40:55 martin Exp $ */
+/* $NetBSD: param.h,v 1.52 2013/12/16 20:17:35 palle Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -230,9 +230,15 @@
extern int cputyp;
+#if defined (SUN4US) || defined (SUN4V)
#define CPU_ISSUN4U (cputyp == CPU_SUN4U)
#define CPU_ISSUN4US (cputyp == CPU_SUN4US)
#define CPU_ISSUN4V (cputyp == CPU_SUN4V)
+#else
+#define CPU_ISSUN4U (1)
+#define CPU_ISSUN4US (0)
+#define CPU_ISSUN4V (0)
+#endif
#endif /* _LOCORE */
#endif /* _KERNEL */
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/include/pte.h
--- a/sys/arch/sparc64/include/pte.h Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/include/pte.h Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.23 2013/12/08 14:41:28 palle Exp $ */
+/* $NetBSD: pte.h,v 1.24 2013/12/16 20:17:35 palle Exp $ */
/*
* Copyright (c) 1996-1999 Eduardo Horvath
@@ -176,7 +176,7 @@
#define TLB_REAL_W 0x0000000000000400LL
/* #define TLB_TSB_LOCK 0x0000000000000200LL */
#define TLB_TSB_LOCK 0x0000000000001000LL
-#define TLB_EXEC 0x0000000000000100LL
+#define SUN4U_TLB_EXEC 0x0000000000000100LL
#define TLB_EXEC_ONLY 0x0000000000000080LL
/* H/W bits */
#define TLB_L 0x0000000000000040LL
@@ -268,6 +268,8 @@
((ie)?SUN4V_TLB_IE:0LL))
+#define TLB_EXEC (CPU_ISSUN4V ? SUN4V_TLB_EXEC : SUN4U_TLB_EXEC)
+
#define MMU_CACHE_VIRT 0x3
#define MMU_CACHE_PHYS 0x2
#define MMU_CACHE_NONE 0x0
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/sparc64/cpu.c
--- a/sys/arch/sparc64/sparc64/cpu.c Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/sparc64/cpu.c Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.105 2013/11/08 15:44:26 nakayama Exp $ */
+/* $NetBSD: cpu.c,v 1.106 2013/12/16 20:17:35 palle Exp $ */
/*
* Copyright (c) 1996
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2013/11/08 15:44:26 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.106 2013/12/16 20:17:35 palle Exp $");
#include "opt_multiprocessor.h"
@@ -73,6 +73,9 @@
#include <machine/openfirm.h>
#include <sparc64/sparc64/cache.h>
+#ifdef SUN4V
+#include <sparc64/hypervisor.h>
+#endif
int ecache_min_line_size;
@@ -412,6 +415,37 @@
}
+int
+cpu_myid(void)
+{
+ char buf[32];
+ int impl;
+
+#ifdef SUN4V
+ if (CPU_ISSUN4V) {
+ uint64_t myid;
+ hv_cpu_myid(&myid);
+ return myid;
+ }
+#endif
+ if (OF_getprop(findroot(), "name", buf, sizeof(buf)) > 0 &&
+ strcmp(buf, "SUNW,Ultra-Enterprise-10000") == 0)
+ return lduwa(0x1fff40000d0UL, ASI_PHYS_NON_CACHED);
+ impl = (getver() & VER_IMPL) >> VER_IMPL_SHIFT;
+ switch (impl) {
+ case IMPL_OLYMPUS_C:
+ case IMPL_JUPITER:
+ return CPU_JUPITERID;
+ case IMPL_CHEETAH:
+ case IMPL_CHEETAH_PLUS:
+ case IMPL_JAGUAR:
+ case IMPL_PANTHER:
+ return CPU_FIREPLANEID;
+ default:
+ return CPU_UPAID;
+ }
+}
+
#if defined(MULTIPROCESSOR)
vaddr_t cpu_spinup_trampoline;
diff -r 30e15ea95b7f -r 4ca5d38c3dec sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c Mon Dec 16 19:06:41 2013 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c Mon Dec 16 20:17:34 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.281 2013/09/11 18:27:44 martin Exp $ */
+/* $NetBSD: pmap.c,v 1.282 2013/12/16 20:17:35 palle Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.281 2013/09/11 18:27:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.282 2013/12/16 20:17:35 palle Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
@@ -60,6 +60,9 @@
#include <machine/bootinfo.h>
#include <sparc64/sparc64/cache.h>
+#ifdef SUN4V
+#include <sparc64/hypervisor.h>
+#endif
#ifdef DDB
#include <machine/db_machdep.h>
@@ -146,6 +149,10 @@
#define TSBENTS (512<<tsbsize)
#define TSBSIZE (TSBENTS * 16)
+#ifdef SUN4V
+struct tsb_desc *tsb_desc;
+#endif
+
static struct pmap kernel_pmap_;
struct pmap *const kernel_pmap_ptr = &kernel_pmap_;
Home |
Main Index |
Thread Index |
Old Index