Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc When an OEA kernel is configured for multip...



details:   https://anonhg.NetBSD.org/src/rev/cae8d0a0c31b
branches:  trunk
changeset: 761978:cae8d0a0c31b
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Feb 12 18:23:09 2011 +0000

description:
When an OEA kernel is configured for multiple MMU types, use the new
powerpc fixup mechanism to bind the kernel to a particular MMU.  This
avoids an indirect call for every pmap call.

diffstat:

 sys/arch/powerpc/booke/booke_stubs.c |    4 +-
 sys/arch/powerpc/conf/files.powerpc  |    4 +-
 sys/arch/powerpc/conf/kern.ldscript  |    5 +-
 sys/arch/powerpc/include/instr.h     |    4 +-
 sys/arch/powerpc/include/oea/pmap.h  |   61 +------
 sys/arch/powerpc/oea/pmap.c          |   27 +--
 sys/arch/powerpc/oea/pmap_kernel.c   |  288 ++++++++++++++++++++++++++++++++++-
 sys/arch/powerpc/powerpc/fixup.c     |   23 ++-
 sys/arch/powerpc/powerpc/pmap_subr.c |    8 +-
 9 files changed, 333 insertions(+), 91 deletions(-)

diffs (truncated from 659 to 300 lines):

diff -r 3f64fa0e9841 -r cae8d0a0c31b sys/arch/powerpc/booke/booke_stubs.c
--- a/sys/arch/powerpc/booke/booke_stubs.c      Sat Feb 12 18:14:21 2011 +0000
+++ b/sys/arch/powerpc/booke/booke_stubs.c      Sat Feb 12 18:23:09 2011 +0000
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.2 2011/01/18 01:02:52 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.3 2011/02/12 18:23:09 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -270,5 +270,5 @@
        extern uint32_t _ftext[];
        extern uint32_t _etext[];
 
-       powerpc_fixup_stubs(_ftext, _etext);
+       powerpc_fixup_stubs(_ftext, _etext, NULL, NULL);
 }
diff -r 3f64fa0e9841 -r cae8d0a0c31b sys/arch/powerpc/conf/files.powerpc
--- a/sys/arch/powerpc/conf/files.powerpc       Sat Feb 12 18:14:21 2011 +0000
+++ b/sys/arch/powerpc/conf/files.powerpc       Sat Feb 12 18:23:09 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.powerpc,v 1.73 2011/01/18 01:02:53 matt Exp $
+#      $NetBSD: files.powerpc,v 1.74 2011/02/12 18:23:09 matt Exp $
 
 defflag        opt_altivec.h   ALTIVEC K_ALTIVEC PPC_HAVE_SPE
 defflag        opt_openpic.h   OPENPIC OPENPIC_SERIAL_MODE
@@ -9,7 +9,7 @@
 
 file   arch/powerpc/powerpc/copystr.c
 file   arch/powerpc/powerpc/core_machdep.c             coredump
-file   arch/powerpc/powerpc/fixup.c                    ppc_booke
+file   arch/powerpc/powerpc/fixup.c                    ppc_booke | (ppc_oea & ppc_oea64) | (ppc_oea & ppc_oea64_bridge) | (ppc_oea64 & ppc_oea64_bridge)
 file   arch/powerpc/powerpc/fubyte.c
 file   arch/powerpc/powerpc/fuswintr.c
 file   arch/powerpc/powerpc/ipkdb_glue.c               ipkdb
diff -r 3f64fa0e9841 -r cae8d0a0c31b sys/arch/powerpc/conf/kern.ldscript
--- a/sys/arch/powerpc/conf/kern.ldscript       Sat Feb 12 18:14:21 2011 +0000
+++ b/sys/arch/powerpc/conf/kern.ldscript       Sat Feb 12 18:23:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern.ldscript,v 1.3 2011/01/23 17:38:37 matt Exp $ */
+/* $NetBSD: kern.ldscript,v 1.4 2011/02/12 18:23:09 matt Exp $ */
 
 /*  ldscript for NetBSD/powerpc kernels and LKMs */
 OUTPUT_ARCH(powerpc)
@@ -18,6 +18,9 @@
     __stub_start = .;
     *(.stub)
     __stub_end = .;
+    __stub_pmap_start = .;
+    *(.stub.pmap)
+    __stub_pmap_end = .;
     *(.gnu.warning)
   } =0
   _etext = .;
diff -r 3f64fa0e9841 -r cae8d0a0c31b sys/arch/powerpc/include/instr.h
--- a/sys/arch/powerpc/include/instr.h  Sat Feb 12 18:14:21 2011 +0000
+++ b/sys/arch/powerpc/include/instr.h  Sat Feb 12 18:23:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: instr.h,v 1.5 2011/01/18 01:02:54 matt Exp $ */
+/*     $NetBSD: instr.h,v 1.6 2011/02/12 18:23:09 matt Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -438,7 +438,7 @@
        uint32_t jfi_real;
 };
  
-void   powerpc_fixup_stubs(uint32_t *, uint32_t *);
+void   powerpc_fixup_stubs(uint32_t *, uint32_t *, uint32_t *, uint32_t *);
 
 
 #endif /* !_POWERPC_INSTR_H_ */
diff -r 3f64fa0e9841 -r cae8d0a0c31b sys/arch/powerpc/include/oea/pmap.h
--- a/sys/arch/powerpc/include/oea/pmap.h       Sat Feb 12 18:14:21 2011 +0000
+++ b/sys/arch/powerpc/include/oea/pmap.h       Sat Feb 12 18:23:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.20 2011/01/18 01:02:55 matt Exp $   */
+/*     $NetBSD: pmap.h,v 1.21 2011/02/12 18:23:10 matt Exp $   */
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -130,12 +130,9 @@
 }
 
 #if (defined(PPC_OEA) + defined(PPC_OEA64) + defined(PPC_OEA64_BRIDGE)) != 1
-#define        PMAP_EXCLUDE_DECLS
+#define        PMAP_NEEDS_FIXUP
 #endif
 
-#ifndef PMAP_NOOPNAMES
-
-#if !defined(PMAP_EXCLUDE_DECLS)
 void pmap_bootstrap(vaddr_t, vaddr_t);
 bool pmap_extract(pmap_t, vaddr_t, paddr_t *);
 bool pmap_query_bit(struct vm_page *, int);
@@ -145,45 +142,6 @@
 int pmap_pte_spill(pmap_t, vaddr_t, bool);
 void pmap_pinit(pmap_t);
 
-#else
-#define        PMAPOPNAME(name) (*pmapops->pmapop_##name)
-extern const struct pmap_ops *pmapops;
-#define        pmap_pte_spill          PMAPOPNAME(pte_spill)
-#define        pmap_real_memory        PMAPOPNAME(real_memory)
-#define        pmap_init               PMAPOPNAME(init)
-#define        pmap_virtual_space      PMAPOPNAME(virtual_space)
-#define        pmap_create             PMAPOPNAME(create)
-#define        pmap_reference          PMAPOPNAME(reference)
-#define        pmap_destroy            PMAPOPNAME(destroy)
-#define        pmap_copy               PMAPOPNAME(copy)
-#define        pmap_update             PMAPOPNAME(update)
-#define        pmap_enter              PMAPOPNAME(enter)
-#define        pmap_remove             PMAPOPNAME(remove)
-#define        pmap_kenter_pa          PMAPOPNAME(kenter_pa)
-#define        pmap_kremove            PMAPOPNAME(kremove)
-#define        pmap_extract            PMAPOPNAME(extract)
-#define        pmap_protect            PMAPOPNAME(protect)
-#define        pmap_unwire             PMAPOPNAME(unwire)
-#define        pmap_page_protect       PMAPOPNAME(page_protect)
-#define        pmap_query_bit          PMAPOPNAME(query_bit)
-#define        pmap_clear_bit          PMAPOPNAME(clear_bit)
-
-#define        pmap_activate           PMAPOPNAME(activate)
-#define        pmap_deactivate         PMAPOPNAME(deactivate)
-
-#define        pmap_pinit              PMAPOPNAME(pinit)
-#define        pmap_procwr             PMAPOPNAME(procwr)
-
-#define        pmap_pte_print          PMAPOPNAME(pte_print)
-#define        pmap_pteg_check         PMAPOPNAME(pteg_check)
-#define        pmap_print_mmuregs      PMAPOPNAME(print_mmuregs)
-#define        pmap_print_pte          PMAPOPNAME(print_pte)
-#define        pmap_pteg_dist          PMAPOPNAME(pteg_dist)
-#define        pmap_pvo_verify         PMAPOPNAME(pvo_verify)
-#define        pmap_steal_memory       PMAPOPNAME(steal_memory)
-#define        pmap_bootstrap          PMAPOPNAME(bootstrap)
-#endif /* PMAP_EXCLUDE_DECLS */
-
 static inline paddr_t vtophys (vaddr_t);
 
 /*
@@ -206,34 +164,37 @@
 
        if (pmap_extract(pmap_kernel(), va, &pa))
                return pa;
-       KASSERT(0);
+       KASSERTMSG(0, ("vtophys: pmap_extract of %#"PRIxVADDR" failed", va));
        return (paddr_t) -1;
 }
 
+
+#ifdef PMAP_NEEDS_FIXUP
 extern const struct pmap_ops *pmapops;
 extern const struct pmap_ops pmap32_ops;
 extern const struct pmap_ops pmap64_ops;
 extern const struct pmap_ops pmap64bridge_ops;
 
+void   pmap_fixup_stubs(const struct pmap_ops *);
+
 static inline void
 pmap_setup32(void)
 {
-       pmapops = &pmap32_ops;
+       pmap_fixup_stubs(&pmap32_ops);
 }
 
 static inline void
 pmap_setup64(void)
 {
-       pmapops = &pmap64_ops;
+       pmap_fixup_stubs(&pmap64_ops);
 }
 
 static inline void
 pmap_setup64bridge(void)
 {
-       pmapops = &pmap64bridge_ops;
+       pmap_fixup_stubs(&pmap64bridge_ops);
 }
-
-#endif /* !PMAP_NOOPNAMES */
+#endif
 
 bool pmap_pageidlezero (paddr_t);
 void pmap_syncicache (paddr_t, psize_t);
diff -r 3f64fa0e9841 -r cae8d0a0c31b sys/arch/powerpc/oea/pmap.c
--- a/sys/arch/powerpc/oea/pmap.c       Sat Feb 12 18:14:21 2011 +0000
+++ b/sys/arch/powerpc/oea/pmap.c       Sat Feb 12 18:23:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.75 2011/01/18 01:02:55 matt Exp $   */
+/*     $NetBSD: pmap.c,v 1.76 2011/02/12 18:23:10 matt Exp $   */
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.75 2011/01/18 01:02:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2011/02/12 18:23:10 matt Exp $");
 
 #define        PMAP_NOOPNAMES
 
@@ -121,21 +121,6 @@
 
 #if !defined(PMAP_OEA64) && !defined(PMAP_OEA64_BRIDGE)
 # define       PMAP_OEA 1
-# if defined(PMAP_EXCLUDE_DECLS) && !defined(PPC_OEA64) && !defined(PPC_OEA64_BRIDGE)
-#  define      PMAPNAME(name)  pmap_##name
-# endif
-#endif
-
-#if defined(PMAP_OEA64)
-# if defined(PMAP_EXCLUDE_DECLS) && !defined(PPC_OEA) && !defined(PPC_OEA64_BRIDGE)
-#  define      PMAPNAME(name)  pmap_##name
-# endif
-#endif
-
-#if defined(PMAP_OEA64_BRIDGE)
-# if defined(PMAP_EXCLUDE_DECLS) && !defined(PPC_OEA) && !defined(PPC_OEA64)
-#  define      PMAPNAME(name)  pmap_##name
-# endif
 #endif
 
 #if defined(PMAP_OEA)
@@ -147,7 +132,7 @@
 #define        _PRIxva         "lx"
 #define        _PRIsr          "lx"
 
-#if defined(PMAP_EXCLUDE_DECLS) && !defined(PMAPNAME)
+#ifdef PMAP_NEEDS_FIXUP
 #if defined(PMAP_OEA)
 #define        PMAPNAME(name)  pmap32_##name
 #elif defined(PMAP_OEA64)
@@ -157,9 +142,9 @@
 #else
 #error unknown variant for pmap
 #endif
-#endif /* PMAP_EXLCUDE_DECLS && !PMAPNAME */
-
-#if defined(PMAPNAME)
+#endif /* PMAP_NEEDS_FIXUP */
+
+#ifdef PMAPNAME
 #define        STATIC                  static
 #define pmap_pte_spill         PMAPNAME(pte_spill)
 #define pmap_real_memory       PMAPNAME(real_memory)
diff -r 3f64fa0e9841 -r cae8d0a0c31b sys/arch/powerpc/oea/pmap_kernel.c
--- a/sys/arch/powerpc/oea/pmap_kernel.c        Sat Feb 12 18:14:21 2011 +0000
+++ b/sys/arch/powerpc/oea/pmap_kernel.c        Sat Feb 12 18:23:09 2011 +0000
@@ -1,6 +1,292 @@
-/*     $NetBSD: pmap_kernel.c,v 1.2 2008/12/11 19:33:12 pooka Exp $    */
+/*     $NetBSD: pmap_kernel.c,v 1.3 2011/02/12 18:23:10 matt Exp $     */
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * 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(1, "$NetBSD: pmap_kernel.c,v 1.3 2011/02/12 18:23:10 matt Exp $");
+
+#include "opt_ddb.h"
+#include "opt_pmap.h"
 
 #include <sys/param.h>
 #include <uvm/uvm_extern.h>
+
 extern struct pmap kernel_pmap_;
 struct pmap *const kernel_pmap_ptr = &kernel_pmap_;
+
+#ifdef PMAP_NEEDS_FIXUP
+#include <powerpc/instr.h>
+



Home | Main Index | Thread Index | Old Index