Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Adapt to common pmap changes.



details:   https://anonhg.NetBSD.org/src/rev/6716d009259f
branches:  trunk
changeset: 346389:6716d009259f
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jul 11 16:06:52 2016 +0000

description:
Adapt to common pmap changes.

diffstat:

 sys/arch/arm/arm32/arm32_tlb.c         |  15 ++++++++-------
 sys/arch/powerpc/booke/booke_machdep.c |   6 ++++--
 sys/arch/powerpc/booke/booke_pmap.c    |  29 +++++++++--------------------
 sys/arch/powerpc/booke/booke_stubs.c   |  10 +++++-----
 sys/arch/powerpc/booke/e500_tlb.c      |   9 +++++----
 sys/arch/powerpc/include/booke/pmap.h  |  13 +++++++++++--
 sys/arch/powerpc/include/booke/pte.h   |   8 +++++++-
 7 files changed, 49 insertions(+), 41 deletions(-)

diffs (truncated from 322 to 300 lines):

diff -r 74133c964304 -r 6716d009259f sys/arch/arm/arm32/arm32_tlb.c
--- a/sys/arch/arm/arm32/arm32_tlb.c    Mon Jul 11 16:06:09 2016 +0000
+++ b/sys/arch/arm/arm32/arm32_tlb.c    Mon Jul 11 16:06:52 2016 +0000
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: arm32_tlb.c,v 1.9 2015/03/26 08:45:05 hsuenaga Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_tlb.c,v 1.10 2016/07/11 16:09:27 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -77,6 +77,7 @@
                        armreg_iciallu_write(0);
                }
        }
+       arm_dsb();
        arm_isb();
 }
 
@@ -99,6 +100,7 @@
                        armreg_tlbiasid_write(lo);
 #endif
                }
+               arm_dsb();
                arm_isb();
                if (__predict_false(vivt_icache_p)) {
 #ifdef MULTIPROCESSOR
@@ -130,7 +132,6 @@
 #endif
                //armreg_tlbiall_write(asid);
        }
-       arm_dsb();
        arm_isb();
 }
 
@@ -143,7 +144,7 @@
 
 #if !defined(MULTIPROCESSOR) && defined(CPU_CORTEXA5)
 static u_int
-tlb_cortex_a5_record_asids(u_long *mapp)
+tlb_cortex_a5_record_asids(u_long *mapp, tlb_asid_t asid_max)
 {
        u_int nasids = 0;
        for (size_t va_index = 0; va_index < 63; va_index++) {
@@ -175,7 +176,7 @@
 
 #if !defined(MULTIPROCESSOR) && defined(CPU_CORTEXA7)
 static u_int
-tlb_cortex_a7_record_asids(u_long *mapp)
+tlb_cortex_a7_record_asids(u_long *mapp, tlb_asid_t asid_max)
 {
        u_int nasids = 0;
        for (size_t va_index = 0; va_index < 128; va_index++) {
@@ -207,16 +208,16 @@
 #endif
 
 u_int
-tlb_record_asids(u_long *mapp)
+tlb_record_asids(u_long *mapp, tlb_asid_t asid_max)
 {
 #ifndef MULTIPROCESSOR
 #ifdef CPU_CORTEXA5
        if (CPU_ID_CORTEX_A5_P(curcpu()->ci_arm_cpuid))
-               return tlb_cortex_a5_record_asids(mapp);
+               return tlb_cortex_a5_record_asids(mapp, asid_max);
 #endif
 #ifdef CPU_CORTEXA7
        if (CPU_ID_CORTEX_A7_P(curcpu()->ci_arm_cpuid))
-               return tlb_cortex_a7_record_asids(mapp);
+               return tlb_cortex_a7_record_asids(mapp, asid_max);
 #endif
 #endif /* MULTIPROCESSOR */
 #ifdef DIAGNOSTIC
diff -r 74133c964304 -r 6716d009259f sys/arch/powerpc/booke/booke_machdep.c
--- a/sys/arch/powerpc/booke/booke_machdep.c    Mon Jul 11 16:06:09 2016 +0000
+++ b/sys/arch/powerpc/booke/booke_machdep.c    Mon Jul 11 16:06:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: booke_machdep.c,v 1.23 2015/01/23 07:27:05 nonaka Exp $        */
+/*     $NetBSD: booke_machdep.c,v 1.24 2016/07/11 16:06:52 matt Exp $  */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 #define        _POWERPC_BUS_DMA_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.23 2015/01/23 07:27:05 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.24 2016/07/11 16:06:52 matt Exp $");
 
 #include "opt_modular.h"
 
@@ -130,6 +130,7 @@
                .ci_softc = &cpu_softc[0],
                .ci_cpl = IPL_HIGH,
                .ci_idepth = -1,
+               .ci_pmap_kern_segtab = &pmap_kern_segtab,
        },
 #ifdef MULTIPROCESSOR
        [CPU_MAXNUM-1] = {
@@ -138,6 +139,7 @@
                .ci_softc = &cpu_softc[CPU_MAXNUM-1],
                .ci_cpl = IPL_HIGH,
                .ci_idepth = -1,
+               .ci_pmap_kern_segtab = &pmap_kern_segtab,
        },
 #endif
 };
diff -r 74133c964304 -r 6716d009259f sys/arch/powerpc/booke/booke_pmap.c
--- a/sys/arch/powerpc/booke/booke_pmap.c       Mon Jul 11 16:06:09 2016 +0000
+++ b/sys/arch/powerpc/booke/booke_pmap.c       Mon Jul 11 16:06:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: booke_pmap.c,v 1.23 2015/11/05 06:26:15 pgoyette Exp $ */
+/*     $NetBSD: booke_pmap.c,v 1.24 2016/07/11 16:06:52 matt Exp $     */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.23 2015/11/05 06:26:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.24 2016/07/11 16:06:52 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/kcore.h>
@@ -53,19 +53,11 @@
 kmutex_t pmap_tlb_miss_lock;
 #endif
 
-/*
- * Initialize the kernel pmap.
- */
-#ifdef MULTIPROCESSOR
-#define        PMAP_SIZE       offsetof(struct pmap, pm_pai[PMAP_TLB_MAX])
-#else
-#define        PMAP_SIZE       sizeof(struct pmap)
-#endif
+PMAP_COUNTER(zeroed_pages, "pages zeroed");
+PMAP_COUNTER(copied_pages, "pages copied");
 
 CTASSERT(sizeof(pmap_segtab_t) == NBPG);
 
-pmap_segtab_t pmap_kernel_segtab;
-
 void
 pmap_procwr(struct proc *p, vaddr_t va, size_t len)
 {
@@ -140,7 +132,7 @@
 vaddr_t
 pmap_kvptefill(vaddr_t sva, vaddr_t eva, pt_entry_t pt_entry)
 {
-       const pmap_segtab_t * const stp = pmap_kernel()->pm_segtab;
+       pmap_segtab_t * const stp = &pmap_kern_segtab;
        KASSERT(sva == trunc_page(sva));
        pt_entry_t *ptep = kvtopte(stp, sva);
        for (; sva < eva; sva += NBPG) {
@@ -158,13 +150,7 @@
 pmap_bootstrap(vaddr_t startkernel, vaddr_t endkernel,
        phys_ram_seg_t *avail, size_t cnt)
 {
-       pmap_segtab_t * const stp = &pmap_kernel_segtab;
-
-       /*
-        * Initialize the kernel segment table.
-        */
-       pmap_kernel()->pm_segtab = stp;
-       curcpu()->ci_pmap_kern_segtab = stp;
+       pmap_segtab_t * const stp = &pmap_kern_segtab;
 
        KASSERT(endkernel == trunc_page(endkernel));
 
@@ -350,6 +336,7 @@
 void
 pmap_zero_page(paddr_t pa)
 {
+       PMAP_COUNT(zeroed_pages);
        vaddr_t va = pmap_md_map_poolpage(pa, NBPG);
        dcache_zero_page(va);
 
@@ -365,6 +352,8 @@
        vaddr_t dst_va = pmap_md_map_poolpage(dst, NBPG);
        const vaddr_t end = src_va + PAGE_SIZE;
 
+       PMAP_COUNT(copied_pages);
+
        while (src_va < end) {
                __asm __volatile(
                        "dcbt   %2,%0"  "\n\t"  /* touch next src cacheline */
diff -r 74133c964304 -r 6716d009259f sys/arch/powerpc/booke/booke_stubs.c
--- a/sys/arch/powerpc/booke/booke_stubs.c      Mon Jul 11 16:06:09 2016 +0000
+++ b/sys/arch/powerpc/booke/booke_stubs.c      Mon Jul 11 16:06:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: booke_stubs.c,v 1.9 2011/06/30 00:52:58 matt Exp $     */
+/*     $NetBSD: booke_stubs.c,v 1.10 2016/07/11 16:06:52 matt Exp $    */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.9 2011/06/30 00:52:58 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.10 2016/07/11 16:06:52 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -118,12 +118,12 @@
        (*cpu_md_ops.md_tlb_ops->md_tlb_write_entry)(pos, tlb);
 }
 
-u_int tlb_record_asids(u_long *) __stub;
+u_int tlb_record_asids(u_long *, tlb_asid_t) __stub;
 
 u_int
-tlb_record_asids(u_long *bitmap)
+tlb_record_asids(u_long *bitmap, tlb_asid_t asid_max)
 {
-       return (*cpu_md_ops.md_tlb_ops->md_tlb_record_asids)(bitmap);
+       return (*cpu_md_ops.md_tlb_ops->md_tlb_record_asids)(bitmap, asid_max);
 }
 
 void tlb_dump(void (*)(const char *, ...)) __stub;
diff -r 74133c964304 -r 6716d009259f sys/arch/powerpc/booke/e500_tlb.c
--- a/sys/arch/powerpc/booke/e500_tlb.c Mon Jul 11 16:06:09 2016 +0000
+++ b/sys/arch/powerpc/booke/e500_tlb.c Mon Jul 11 16:06:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: e500_tlb.c,v 1.17 2015/02/19 08:59:56 nonaka Exp $     */
+/*     $NetBSD: e500_tlb.c,v 1.18 2016/07/11 16:06:52 matt Exp $       */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.17 2015/02/19 08:59:56 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.18 2016/07/11 16:06:52 matt Exp $");
 
 #include <sys/param.h>
 
@@ -465,7 +465,7 @@
 }
 
 static u_int
-e500_tlb_record_asids(u_long *bitmap)
+e500_tlb_record_asids(u_long *bitmap, tlb_asid_t asid_max)
 {
        const size_t tlbassoc = TLBCFG_ASSOC(mftlb0cfg());
        const size_t tlbentries = TLBCFG_NENTRY(mftlb0cfg());
@@ -554,7 +554,8 @@
 #endif
                        return false;
                }
-               mtspr(SPR_MAS1, hwtlb.hwtlb_mas1);
+               mas1 = hwtlb.hwtlb_mas1 | MAS1_V;
+               mtspr(SPR_MAS1, mas1);
        }
        mtspr(SPR_MAS2, hwtlb.hwtlb_mas2);
        mtspr(SPR_MAS3, hwtlb.hwtlb_mas3);
diff -r 74133c964304 -r 6716d009259f sys/arch/powerpc/include/booke/pmap.h
--- a/sys/arch/powerpc/include/booke/pmap.h     Mon Jul 11 16:06:09 2016 +0000
+++ b/sys/arch/powerpc/include/booke/pmap.h     Mon Jul 11 16:06:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.15 2015/01/26 04:47:53 nonaka Exp $ */
+/*     $NetBSD: pmap.h,v 1.16 2016/07/11 16:06:52 matt Exp $   */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -131,7 +131,7 @@
 }
 
 static inline void
-pmap_md_vca_remove(struct vm_page *pg, vaddr_t va)
+pmap_md_vca_remove(struct vm_page *pg, vaddr_t va, bool dirty)
 {
 
 }
@@ -140,12 +140,21 @@
 pmap_md_vca_clean(struct vm_page *pg, vaddr_t va, int op)
 {
 }
+#endif
 
+#ifdef __PMAP_PRIVATE
 static inline size_t
 pmap_md_tlb_asid_max(void)
 {
        return PMAP_TLB_NUM_PIDS - 1;
 }
+
+struct vm_physseg;
+static inline bool
+pmap_md_ok_to_steal_p(const struct vm_physseg *seg, size_t npgs)
+{
+       return true;
+}
 #endif
 
 #define        POOL_VTOPHYS(va)        ((paddr_t)(vaddr_t)(va))



Home | Main Index | Thread Index | Old Index