Source-Changes-HG archive

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

[src/trunk]: src/sys PowerPC now exports a common view of cpu.h, vmparam.h an...



details:   https://anonhg.NetBSD.org/src/rev/8cbc0f6d996f
branches:  trunk
changeset: 766330:8cbc0f6d996f
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jun 20 20:24:28 2011 +0000

description:
PowerPC now exports a common view of cpu.h, vmparam.h and pmap.h
when building a MODULAR kernel or compiling _MODULE.
It should be noted that MODULAR or _MODULE export a view of the kernel
as being MULTIPROCESSOR (even if isn't).
The shared pmap TLB uses mdpg in places where it used mdpg to avoid
deadly embrance inclusion problems.

diffstat:

 sys/arch/powerpc/booke/booke_pmap.c       |    8 +-
 sys/arch/powerpc/booke/trap.c             |   16 +-
 sys/arch/powerpc/include/booke/pmap.h     |   10 +-
 sys/arch/powerpc/include/booke/pte.h      |   26 +-
 sys/arch/powerpc/include/booke/vmparam.h  |   91 +-----------
 sys/arch/powerpc/include/ibm4xx/pmap.h    |   13 +-
 sys/arch/powerpc/include/ibm4xx/vmparam.h |    6 +-
 sys/arch/powerpc/include/intr.h           |   33 ++-
 sys/arch/powerpc/include/oea/pmap.h       |   19 +-
 sys/arch/powerpc/include/oea/vmparam.h    |   21 --
 sys/arch/powerpc/include/pmap.h           |   36 ++++-
 sys/arch/powerpc/include/vmparam.h        |   65 ++++++++-
 sys/common/pmap/tlb/pmap.c                |  229 +++++++++++++++++------------
 sys/common/pmap/tlb/pmap.h                |    8 +-
 14 files changed, 313 insertions(+), 268 deletions(-)

diffs (truncated from 1412 to 300 lines):

diff -r 2d482df9e5f4 -r 8cbc0f6d996f sys/arch/powerpc/booke/booke_pmap.c
--- a/sys/arch/powerpc/booke/booke_pmap.c       Mon Jun 20 20:18:43 2011 +0000
+++ b/sys/arch/powerpc/booke/booke_pmap.c       Mon Jun 20 20:24:28 2011 +0000
@@ -37,13 +37,13 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.5 2011/06/12 05:32:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.6 2011/06/20 20:24:28 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/kcore.h>
 #include <sys/buf.h>
 
-#include <uvm/uvm_extern.h>
+#include <uvm/uvm.h>
 
 #include <machine/pmap.h>
 
@@ -265,7 +265,7 @@
 {
        dcache_zero_page(pa);
 
-       KASSERT(!VM_PAGE_MD_EXECPAGE_P(PHYS_TO_VM_PAGE(pa)));
+       KASSERT(!VM_PAGEMD_EXECPAGE_P(VM_PAGE_TO_MD(PHYS_TO_VM_PAGE(pa))));
 }
 
 void
@@ -291,7 +291,7 @@
                }
        }
 
-       KASSERT(!VM_PAGE_MD_EXECPAGE_P(PHYS_TO_VM_PAGE(dst - PAGE_SIZE)));
+       KASSERT(!VM_PAGEMD_EXECPAGE_P(VM_PAGE_TO_MD(PHYS_TO_VM_PAGE(dst - PAGE_SIZE))));
 }
 
 void
diff -r 2d482df9e5f4 -r 8cbc0f6d996f sys/arch/powerpc/booke/trap.c
--- a/sys/arch/powerpc/booke/trap.c     Mon Jun 20 20:18:43 2011 +0000
+++ b/sys/arch/powerpc/booke/trap.c     Mon Jun 20 20:24:28 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.10 2011/06/14 05:50:24 matt Exp $   */
+/*     $NetBSD: trap.c,v 1.11 2011/06/20 20:24:28 matt Exp $   */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.10 2011/06/14 05:50:24 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.11 2011/06/20 20:24:28 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -233,9 +233,10 @@
                const paddr_t pa = pte_to_paddr(pte);
                struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
                KASSERT(pg);
+               struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
 
-               if (!VM_PAGE_MD_MODIFIED_P(pg)) {
-                       pmap_page_set_attributes(pg, VM_PAGE_MD_MODIFIED);
+               if (!VM_PAGEMD_MODIFIED_P(mdpg)) {
+                       pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED);
                }
                pte &= ~PTE_UNMODIFIED;
                *ptep = pte;
@@ -294,19 +295,20 @@
                const paddr_t pa = pte_to_paddr(pte);
                struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
                KASSERT(pg);
+               struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
 
                UVMHIST_LOG(pmapexechist,
                    "srr0=%#x pg=%p (pa %#"PRIxPADDR"): %s", 
                    tf->tf_srr0, pg, pa, 
-                   (VM_PAGE_MD_EXECPAGE_P(pg)
+                   (VM_PAGEMD_EXECPAGE_P(mdpg)
                        ? "no syncicache (already execpage)"
                        : "performed syncicache (now execpage)"));
 
-               if (!VM_PAGE_MD_EXECPAGE_P(pg)) {
+               if (!VM_PAGEMD_EXECPAGE_P(mdpg)) {
                        ci->ci_softc->cpu_ev_exec_trap_sync.ev_count++;
                        dcache_wb_page(pa);
                        icache_inv_page(pa);
-                       pmap_page_set_attributes(pg, VM_PAGE_MD_EXECPAGE);
+                       pmap_page_set_attributes(mdpg, VM_PAGEMD_EXECPAGE);
                }
                pte &= ~PTE_UNSYNCED;
                pte |= PTE_xX;
diff -r 2d482df9e5f4 -r 8cbc0f6d996f sys/arch/powerpc/include/booke/pmap.h
--- a/sys/arch/powerpc/include/booke/pmap.h     Mon Jun 20 20:18:43 2011 +0000
+++ b/sys/arch/powerpc/include/booke/pmap.h     Mon Jun 20 20:24:28 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.5 2011/06/05 16:52:25 matt Exp $    */
+/*     $NetBSD: pmap.h,v 1.6 2011/06/20 20:24:28 matt Exp $    */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,6 +40,10 @@
 #error use assym.h instead
 #endif
 
+#if defined(_MODULE)
+#error this file should not be included by loadable kernel modules
+#endif
+
 #include <sys/cpu.h>
 #include <sys/kcore.h>
 #include <uvm/uvm_page.h>
@@ -51,6 +55,8 @@
 #define        PMAP_MD_NOCACHE         0x01000000
 #define        PMAP_NEED_PROCWR
 
+#include <common/pmap/tlb/vmpagemd.h>
+
 #include <powerpc/booke/pte.h>
 
 #define        NBSEG           (NBPG*NPTEPG)
@@ -64,7 +70,6 @@
 #define        PMAP_TLB_NUM_PIDS               256
 #define        PMAP_INVALID_SEGTAB_ADDRESS     ((struct pmap_segtab *)0xfeeddead)
 
-#ifndef _LOCORE
 #define        pmap_phys_address(x)            (x)
 
 void   pmap_procwr(struct proc *, vaddr_t, size_t);
@@ -120,6 +125,5 @@
 #define        POOL_PHYSTOV(pa)        ((vaddr_t)(paddr_t)(pa))
 
 #include <common/pmap/tlb/pmap.h>
-#endif /* _LOCORE */
 
 #endif /* !_POWERPC_BOOKE_PMAP_H_ */
diff -r 2d482df9e5f4 -r 8cbc0f6d996f sys/arch/powerpc/include/booke/pte.h
--- a/sys/arch/powerpc/include/booke/pte.h      Mon Jun 20 20:18:43 2011 +0000
+++ b/sys/arch/powerpc/include/booke/pte.h      Mon Jun 20 20:24:28 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pte.h,v 1.2 2011/01/18 01:02:54 matt Exp $     */
+/*     $NetBSD: pte.h,v 1.3 2011/06/20 20:24:28 matt Exp $     */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -180,17 +180,17 @@
 }
 
 static inline pt_entry_t
-pte_prot_bits(struct vm_page *pg, vm_prot_t prot)
+pte_prot_bits(struct vm_page_md *mdpg, vm_prot_t prot)
 {
        KASSERT(prot & VM_PROT_READ);
        pt_entry_t pt_entry = PTE_xR;
        if (prot & VM_PROT_EXECUTE) {
 #if 0
                pt_entry |= PTE_xX;
-               if (pg != NULL && !VM_PAGE_MD_EXECPAGE_P(pg))
+               if (mdpg != NULL && !VM_PAGEMD_EXECPAGE_P(mdpg))
                        pt_entry |= PTE_UNSYNCED;
 #elif 1
-               if (pg != NULL && !VM_PAGE_MD_EXECPAGE_P(pg))
+               if (mdpg != NULL && !VM_PAGEMD_EXECPAGE_P(mdpg))
                        pt_entry |= PTE_UNSYNCED;
                else
                        pt_entry |= PTE_xX;
@@ -200,23 +200,23 @@
        }
        if (prot & VM_PROT_WRITE) {
                pt_entry |= PTE_xW;
-               if (pg != NULL && !VM_PAGE_MD_MODIFIED_P(pg))
+               if (mdpg != NULL && !VM_PAGEMD_MODIFIED_P(mdpg))
                        pt_entry |= PTE_UNMODIFIED;
        }
        return pt_entry;
 }
 
 static inline pt_entry_t
-pte_flag_bits(struct vm_page *pg, int flags)
+pte_flag_bits(struct vm_page_md *mdpg, int flags)
 {
        if (__predict_false(flags & PMAP_MD_NOCACHE)) {
-               if (__predict_true(pg != NULL)) {
+               if (__predict_true(mdpg != NULL)) {
                        return pte_nocached_bits();
                } else {
                        return pte_ionocached_bits();
                }
        } else {
-               if (__predict_false(pg != NULL)) {
+               if (__predict_false(mdpg != NULL)) {
                        return pte_cached_bits();
                } else {
                        return pte_iocached_bits();
@@ -225,24 +225,24 @@
 }
 
 static inline pt_entry_t
-pte_make_enter(paddr_t pa, struct vm_page *pg, vm_prot_t prot,
+pte_make_enter(paddr_t pa, struct vm_page_md *mdpg, vm_prot_t prot,
        int flags, bool kernel)
 {
        pt_entry_t pt_entry = (pt_entry_t) pa & PTE_RPN_MASK;
 
-       pt_entry |= pte_flag_bits(pg, flags);
-       pt_entry |= pte_prot_bits(pg, prot);
+       pt_entry |= pte_flag_bits(mdpg, flags);
+       pt_entry |= pte_prot_bits(mdpg, prot);
 
        return pt_entry;
 }
 
 static inline pt_entry_t
-pte_make_kenter_pa(paddr_t pa, struct vm_page *pg, vm_prot_t prot,
+pte_make_kenter_pa(paddr_t pa, struct vm_page_md *mdpg, vm_prot_t prot,
        int flags)
 {
        pt_entry_t pt_entry = (pt_entry_t) pa & PTE_RPN_MASK;
 
-       pt_entry |= pte_flag_bits(pg, flags);
+       pt_entry |= pte_flag_bits(mdpg, flags);
        pt_entry |= pte_prot_bits(NULL, prot); /* pretend unmanaged */
 
        return pt_entry;
diff -r 2d482df9e5f4 -r 8cbc0f6d996f sys/arch/powerpc/include/booke/vmparam.h
--- a/sys/arch/powerpc/include/booke/vmparam.h  Mon Jun 20 20:18:43 2011 +0000
+++ b/sys/arch/powerpc/include/booke/vmparam.h  Mon Jun 20 20:24:28 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vmparam.h,v 1.4 2011/06/05 16:52:25 matt Exp $ */
+/*     $NetBSD: vmparam.h,v 1.5 2011/06/20 20:24:28 matt Exp $ */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,8 +37,6 @@
 #ifndef _POWERPC_BOOKE_VMPARAM_H_
 #define _POWERPC_BOOKE_VMPARAM_H_
 
-#include <sys/mutex.h>
-
 /*
  * Most of the definitions in this can be overriden by a machine-specific
  * vmparam.h if required.  Otherwise a port can just include this file
@@ -102,97 +100,12 @@
 #define        VM_MIN_KERNEL_ADDRESS   ((vaddr_t) 0xe4000000)
 #define        VM_MAX_KERNEL_ADDRESS   ((vaddr_t) 0xfefff000)
 
-/*
- * The address to which unspecified mapping requests default
- * Put the stack in it's own segment and start mmaping at the
- * top of the next lower segment.
- */
-#ifdef _KERNEL_OPT
-#include "opt_uvm.h"
-#endif
-#define        __USE_TOPDOWN_VM
-#define        VM_DEFAULT_ADDRESS(da, sz) \
-       ((VM_MAXUSER_ADDRESS - MAXSSIZ) - round_page(sz))
-
-#ifndef VM_PHYSSEG_MAX
-#define        VM_PHYSSEG_MAX          16
-#endif
 #define        VM_PHYSSEG_STRAT        VM_PSTRAT_BIGFIRST
 
 #ifndef VM_PHYS_SIZE
 #define        VM_PHYS_SIZE            (USRIOSIZE * PAGE_SIZE)
 #endif
 
-#define        VM_NFREELIST            2       /* 16 distinct memory segments */
-#define        VM_FREELIST_DEFAULT     0
-#define        VM_FREELIST_FIRST16     1
-#define        VM_FREELIST_MAX         2
-
-#ifndef VM_NFREELIST
-#define        VM_NFREELIST            16      /* 16 distinct memory segments */
-#define VM_FREELIST_DEFAULT    0
-#define VM_FREELIST_MAX                1
-#endif
-
-#define        __HAVE_VM_PAGE_MD
-#ifndef _LOCORE
-
-typedef struct pv_entry {
-       struct pv_entry *pv_next;
-       struct pmap *pv_pmap;
-       vaddr_t pv_va;
-} *pv_entry_t;
-
-#define        VM_PAGE_MD_REFERENCED   0x0001  /* page has been recently referenced */
-#define        VM_PAGE_MD_MODIFIED     0x0002  /* page has been modified */
-#define        VM_PAGE_MD_POOLPAGE     0x0004  /* page is used as a poolpage */
-#define        VM_PAGE_MD_EXECPAGE     0x0008  /* page is exec mapped */
-#if 0
-#define        VM_PAGE_MD_UNCACHED     0x0010  /* page is mapped uncached */
-#endif
-
-#ifdef VM_PAGE_MD_UNCACHED
-#define        VM_PAGE_MD_CACHED_P(pg) (((pg)->mdpage.mdpg_attrs & VM_PAGE_MD_UNCACHED) == 0)
-#define        VM_PAGE_MD_UNCACHED_P(pg)       (((pg)->mdpage.mdpg_attrs & VM_PAGE_MD_UNCACHED) != 0)
-#endif
-#define        VM_PAGE_MD_MODIFIED_P(pg)       (((pg)->mdpage.mdpg_attrs & VM_PAGE_MD_MODIFIED) != 0)



Home | Main Index | Thread Index | Old Index