CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Sun Oct 31 03:43:03 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: More struct vm_page * - struct vm_page_md * adjustments. To generate a diff of this commit: cvs rdiff -u -r1.211.2.16 -r1.211.2.17 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.16 src/sys/arch/arm/arm32/pmap.c:1.211.2.17 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.16 Sat Oct 30 08:41:06 2010 +++ src/sys/arch/arm/arm32/pmap.c Sun Oct 31 03:43:02 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.16 2010/10/30 08:41:06 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.17 2010/10/31 03:43:02 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -212,7 +212,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.16 2010/10/30 08:41:06 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.17 2010/10/31 03:43:02 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -663,7 +663,7 @@ static void pmap_vac_me_user(struct vm_page_md *, paddr_t, pmap_t, vaddr_t); #endif -static void pmap_clearbit(struct vm_page *, u_int); +static void pmap_clearbit(struct vm_page_md *, paddr_t, u_int); #ifdef PMAP_CACHE_VIVT static int pmap_clean_page(struct pv_entry *, bool); #endif @@ -676,7 +676,7 @@ }; static void pmap_flush_page(struct vm_page_md *, paddr_t, enum pmap_flush_op); #endif -static void pmap_page_remove(struct vm_page *); +static void pmap_page_remove(struct vm_page_md *, paddr_t); static void pmap_init_l1(struct l1_ttable *, pd_entry_t *); static vaddr_t kernel_pt_lookup(paddr_t); @@ -974,7 +974,7 @@ while (pv) { if (pv-pv_pmap == pm pv-pv_va == va) { /* match? */ NPDEBUG(PDB_PVDUMP, printf(pmap_remove_pv: pm %p, md - %p\n, pm, md)); + %p, flags 0x%x\n, pm, md, pv-pv_flags)); if (pv-pv_flags PVF_WIRED) { --pm-pm_stats.wired_count; } @@ -2121,9 +2121,8 @@ * constants and the latter would require an extra inversion at run-time. */ static void -pmap_clearbit(struct vm_page *pg, u_int maskbits) +pmap_clearbit(struct vm_page_md *md, paddr_t pa, u_int maskbits) { - struct vm_page_md *md = VM_PAGE_TO_MD(pg); struct l2_bucket *l2b; struct pv_entry *pv; pt_entry_t *ptep, npte, opte; @@ -2138,8 +2137,8 @@ #endif NPDEBUG(PDB_BITS, - printf(pmap_clearbit: pg %p (0x%08lx) mask 0x%x\n, - pg, VM_PAGE_TO_PHYS(pg), maskbits)); + printf(pmap_clearbit: md %p mask 0x%x\n, + md, maskbits)); PMAP_HEAD_TO_MAP_LOCK(); simple_lock(md-pvh_slock); @@ -2317,7 +2316,7 @@ * If we need to sync the I-cache and we haven't done it yet, do it. */ if (need_syncicache !did_syncicache) { - pmap_syncicache_page(md, VM_PAGE_TO_PHYS(pg)); + pmap_syncicache_page(md, pa); PMAPCOUNT(exec_synced_clearbit); } /* @@ -2327,7 +2326,7 @@ */ if (need_vac_me_harder) { if (md-pvh_attrs PVF_NC) - pmap_vac_me_harder(md, VM_PAGE_TO_PHYS(pg), NULL, 0); + pmap_vac_me_harder(md, pa, NULL, 0); } #endif @@ -2567,10 +2566,8 @@ * Reflects back modify bits to the pager. */ static void -pmap_page_remove(struct vm_page *pg) +pmap_page_remove(struct vm_page_md *md, paddr_t pa) { - struct vm_page_md *md = VM_PAGE_TO_MD(pg); - paddr_t pa = VM_PAGE_TO_PHYS(pg); struct l2_bucket *l2b; struct pv_entry *pv, *npv, **pvp; pmap_t pm; @@ -2579,7 +2576,7 @@ u_int flags; NPDEBUG(PDB_FOLLOW, - printf(pmap_page_remove: pg %p (0x%08lx)\n, pg, + printf(pmap_page_remove: md %p (0x%08lx)\n, md, pa)); PMAP_HEAD_TO_MAP_LOCK(); @@ -2896,9 +2893,7 @@ */ if (opg) { struct vm_page_md *omd = VM_PAGE_TO_MD(opg); -paddr_t opa; - -opa = VM_PAGE_TO_PHYS(opg); +paddr_t opa = VM_PAGE_TO_PHYS(opg); /* * Replacing an existing mapping with a new one. @@ -2945,7 +2940,7 @@ return (ENOMEM); } - pmap_enter_pv(md, VM_PAGE_TO_PHYS(pg), pv, pm, va, nflags); + pmap_enter_pv(md, pa, pv, pm, va, nflags); } } else { /* @@ -2969,9 +2964,11 @@ * at this address. */ struct vm_page_md *omd = VM_PAGE_TO_MD(opg); + paddr_t opa = VM_PAGE_TO_PHYS(opg); + simple_lock(omd-pvh_slock); - pv = pmap_remove_pv(omd, VM_PAGE_TO_PHYS(opg), pm, va); - pmap_vac_me_harder(omd, VM_PAGE_TO_PHYS(opg), pm, 0); + pv = pmap_remove_pv(omd, opa, pm, va); + pmap_vac_me_harder(omd, opa, pm, 0); simple_unlock(omd-pvh_slock); oflags = pv-pv_flags; @@ -3052,14 +3049,16 @@ if (pg != NULL) { struct vm_page_md *md = VM_PAGE_TO_MD(pg); + simple_lock(md-pvh_slock); - pmap_vac_me_harder(md, VM_PAGE_TO_PHYS(pg), pm, va); + pmap_vac_me_harder(md, pa, pm, va); simple_unlock(md-pvh_slock); } } #if defined(PMAP_CACHE_VIPT) defined(DIAGNOSTIC) if
CVS commit: [uebayasi-xip] src/sys/arch/arm
Module Name:src Committed By: uebayasi Date: Sat Aug 28 16:24:34 UTC 2010 Modified Files: src/sys/arch/arm/conf [uebayasi-xip]: files.arm Added Files: src/sys/arch/arm/arm [uebayasi-xip]: xmd_machdep.c Log Message: xmd(4) glue for arm. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/arm/arm/xmd_machdep.c cvs rdiff -u -r1.97.2.2 -r1.97.2.3 src/sys/arch/arm/conf/files.arm Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/conf/files.arm diff -u src/sys/arch/arm/conf/files.arm:1.97.2.2 src/sys/arch/arm/conf/files.arm:1.97.2.3 --- src/sys/arch/arm/conf/files.arm:1.97.2.2 Tue Aug 17 06:44:03 2010 +++ src/sys/arch/arm/conf/files.arm Sat Aug 28 16:24:34 2010 @@ -1,4 +1,4 @@ -# $NetBSD: files.arm,v 1.97.2.2 2010/08/17 06:44:03 uebayasi Exp $ +# $NetBSD: files.arm,v 1.97.2.3 2010/08/28 16:24:34 uebayasi Exp $ # temporary define to allow easy moving to ../arch/arm/arm32 defflagARM32 @@ -183,3 +183,5 @@ file arch/arm/arm/linux_sigcode.S compat_linux file arch/arm/arm/linux_syscall.c compat_linux file arch/arm/arm/linux_trap.c compat_linux + +file arch/arm/arm/xmd_machdep.c xmd Added files: Index: src/sys/arch/arm/arm/xmd_machdep.c diff -u /dev/null src/sys/arch/arm/arm/xmd_machdep.c:1.1.2.1 --- /dev/null Sat Aug 28 16:24:34 2010 +++ src/sys/arch/arm/arm/xmd_machdep.c Sat Aug 28 16:24:33 2010 @@ -0,0 +1,68 @@ +/* $NetBSD: xmd_machdep.c,v 1.1.2.1 2010/08/28 16:24:33 uebayasi Exp $ */ + +/*- + * Copyright (c) 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * 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(0, $NetBSD: xmd_machdep.c,v 1.1.2.1 2010/08/28 16:24:33 uebayasi Exp $); + +#include opt_xip.h + +#ifndef XIP +#error xmd(4) needs options XIP +#endif + +#include sys/param.h +#include sys/mman.h + +#include uvm/uvm_page.h + +#include dev/xmdvar.h + +paddr_t +xmd_machdep_mmap(vaddr_t addr, off_t off, int prot) +{ + + return arm_btop(vtophys(addr + off)); +} + +void * +xmd_machdep_physload(vaddr_t addr, size_t size) +{ + paddr_t start, end; + + start = arm_btop(vtophys(addr)); + end = arm_btop(vtophys(addr + size)); + + return uvm_page_physload_device(start, end, start, end, PROT_READ, 0); +} + +void +xmd_machdep_physunload(void *phys) +{ + + uvm_page_physunload_device(phys); +}
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Thu Jul 8 07:46:00 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: bus_dma.c Log Message: Fix build. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.52.18.1 src/sys/arch/arm/arm32/bus_dma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/bus_dma.c diff -u src/sys/arch/arm/arm32/bus_dma.c:1.52 src/sys/arch/arm/arm32/bus_dma.c:1.52.18.1 --- src/sys/arch/arm/arm32/bus_dma.c:1.52 Wed Jun 4 12:41:40 2008 +++ src/sys/arch/arm/arm32/bus_dma.c Thu Jul 8 07:45:59 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.52 2008/06/04 12:41:40 ad Exp $ */ +/* $NetBSD: bus_dma.c,v 1.52.18.1 2010/07/08 07:45:59 uebayasi Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #define _ARM32_BUS_DMA_PRIVATE #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.52 2008/06/04 12:41:40 ad Exp $); +__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.52.18.1 2010/07/08 07:45:59 uebayasi Exp $); #include sys/param.h #include sys/systm.h @@ -48,7 +48,7 @@ #include sys/vnode.h #include sys/device.h -#include uvm/uvm_extern.h +#include uvm/uvm.h #include machine/bus.h #include machine/cpu.h
CVS commit: [uebayasi-xip] src/sys/arch/arm/imx
Module Name:src Committed By: uebayasi Date: Thu Apr 29 03:16:18 UTC 2010 Modified Files: src/sys/arch/arm/imx [uebayasi-xip]: imx31_space.c Log Message: Adapt to the new uvm_page_physload_device(9). To generate a diff of this commit: cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/sys/arch/arm/imx/imx31_space.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/imx/imx31_space.c diff -u src/sys/arch/arm/imx/imx31_space.c:1.3.2.1 src/sys/arch/arm/imx/imx31_space.c:1.3.2.2 --- src/sys/arch/arm/imx/imx31_space.c:1.3.2.1 Wed Apr 28 14:56:14 2010 +++ src/sys/arch/arm/imx/imx31_space.c Thu Apr 29 03:16:18 2010 @@ -1,7 +1,7 @@ -/* $Id: imx31_space.c,v 1.3.2.1 2010/04/28 14:56:14 uebayasi Exp $ */ +/* $Id: imx31_space.c,v 1.3.2.2 2010/04/29 03:16:18 uebayasi Exp $ */ /* derived from: */ -/* $NetBSD: imx31_space.c,v 1.3.2.1 2010/04/28 14:56:14 uebayasi Exp $ */ +/* $NetBSD: imx31_space.c,v 1.3.2.2 2010/04/29 03:16:18 uebayasi Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -287,6 +287,7 @@ void * imx31_bs_physload(void *t, bus_addr_t addr, bus_size_t size, int prot, int flags) { + /* XXX */ const paddr_t start = imx31_bs_mmap(t, addr, 0, prot, flags); const paddr_t end = imx31_bs_mmap(t, addr + size, 0, prot, flags); @@ -303,10 +304,11 @@ void * imx31_bs_physload_device(void *t, bus_addr_t addr, bus_size_t size, int prot, int flags) { + /* XXX */ const paddr_t start = imx31_bs_mmap(t, addr, 0, prot, flags); const paddr_t end = imx31_bs_mmap(t, addr + size, 0, prot, flags); - return uvm_page_physload_device(start, end, start, end, 0/* XXX freelist */); + return uvm_page_physload_device(start, end, start, end, prot, flags); } void
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Thu Feb 25 03:19:51 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: mem.c Log Message: pg-mdpage - VM_PAGE_TO_MD(pg) To generate a diff of this commit: cvs rdiff -u -r1.26.6.1 -r1.26.6.2 src/sys/arch/arm/arm32/mem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/mem.c diff -u src/sys/arch/arm/arm32/mem.c:1.26.6.1 src/sys/arch/arm/arm32/mem.c:1.26.6.2 --- src/sys/arch/arm/arm32/mem.c:1.26.6.1 Wed Feb 10 14:20:23 2010 +++ src/sys/arch/arm/arm32/mem.c Thu Feb 25 03:19:51 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.26.6.1 2010/02/10 14:20:23 uebayasi Exp $ */ +/* $NetBSD: mem.c,v 1.26.6.2 2010/02/25 03:19:51 uebayasi Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -74,9 +74,11 @@ #include opt_arm32_pmap.h #include opt_compat_netbsd.h +#include opt_device_page.h +#include opt_xip.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.26.6.1 2010/02/10 14:20:23 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.26.6.2 2010/02/25 03:19:51 uebayasi Exp $); #include sys/param.h #include sys/conf.h @@ -144,7 +146,7 @@ { struct vm_page *pg; pg = PHYS_TO_VM_PAGE(trunc_page(v)); -if (pg != NULL pmap_is_page_colored_p(pg-mdpage)) +if (pg != NULL pmap_is_page_colored_p(VM_PAGE_TO_MD(pg))) o = pg-mdpage.pvh_attrs; else o = v;
CVS commit: [uebayasi-xip] src/sys/arch/arm
Module Name:src Committed By: uebayasi Date: Thu Feb 25 03:30:22 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: mem.c pmap.c src/sys/arch/arm/include/arm32 [uebayasi-xip]: pmap.h Log Message: A few more VM_PAGE_TO_MD(). To generate a diff of this commit: cvs rdiff -u -r1.26.6.2 -r1.26.6.3 src/sys/arch/arm/arm32/mem.c cvs rdiff -u -r1.211.2.8 -r1.211.2.9 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.94.2.1 -r1.94.2.2 src/sys/arch/arm/include/arm32/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/mem.c diff -u src/sys/arch/arm/arm32/mem.c:1.26.6.2 src/sys/arch/arm/arm32/mem.c:1.26.6.3 --- src/sys/arch/arm/arm32/mem.c:1.26.6.2 Thu Feb 25 03:19:51 2010 +++ src/sys/arch/arm/arm32/mem.c Thu Feb 25 03:30:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.26.6.2 2010/02/25 03:19:51 uebayasi Exp $ */ +/* $NetBSD: mem.c,v 1.26.6.3 2010/02/25 03:30:22 uebayasi Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -78,7 +78,7 @@ #include opt_xip.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.26.6.2 2010/02/25 03:19:51 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.26.6.3 2010/02/25 03:30:22 uebayasi Exp $); #include sys/param.h #include sys/conf.h @@ -147,7 +147,7 @@ struct vm_page *pg; pg = PHYS_TO_VM_PAGE(trunc_page(v)); if (pg != NULL pmap_is_page_colored_p(VM_PAGE_TO_MD(pg))) - o = pg-mdpage.pvh_attrs; + o = VM_PAGE_TO_MD(pg)-pvh_attrs; else o = v; m += o arm_cache_prefer_mask; Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.8 src/sys/arch/arm/arm32/pmap.c:1.211.2.9 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.8 Sat Feb 20 16:48:57 2010 +++ src/sys/arch/arm/arm32/pmap.c Thu Feb 25 03:30:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.8 2010/02/20 16:48:57 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.9 2010/02/25 03:30:22 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -191,6 +191,8 @@ #include opt_ddb.h #include opt_lockdebug.h #include opt_multiprocessor.h +#include opt_device_page.h +#include opt_xip.h #include sys/param.h #include sys/types.h @@ -211,7 +213,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.8 2010/02/20 16:48:57 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.9 2010/02/25 03:30:22 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -3343,8 +3345,8 @@ struct vm_page_md *md = VM_PAGE_TO_MD(pg); NPDEBUG(PDB_KENTER, - printf(pmap_kenter_pa: va 0x%08lx, pa 0x%08lx, prot 0x%x\n, - va, pa, prot)); + printf(pmap_kenter_pa: va 0x%08lx, pa 0x%08lx, prot 0x%x pg %p md %p\n, + va, pa, prot, pg, md)); l2b = pmap_get_l2_bucket(pmap_kernel(), va); KDASSERT(l2b != NULL); Index: src/sys/arch/arm/include/arm32/pmap.h diff -u src/sys/arch/arm/include/arm32/pmap.h:1.94.2.1 src/sys/arch/arm/include/arm32/pmap.h:1.94.2.2 --- src/sys/arch/arm/include/arm32/pmap.h:1.94.2.1 Wed Feb 10 14:20:23 2010 +++ src/sys/arch/arm/include/arm32/pmap.h Thu Feb 25 03:30:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.94.2.1 2010/02/10 14:20:23 uebayasi Exp $ */ +/* $NetBSD: pmap.h,v 1.94.2.2 2010/02/25 03:30:22 uebayasi Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -269,9 +269,10 @@ #define pmap_wired_count(pmap) ((pmap)-pm_stats.wired_count) #define pmap_is_modified(pg) \ - (((pg)-mdpage.pvh_attrs PVF_MOD) != 0) + ((VM_PAGE_TO_MD(pg)-pvh_attrs PVF_MOD) != 0) #define pmap_is_referenced(pg) \ - (((pg)-mdpage.pvh_attrs PVF_REF) != 0) + ((VM_PAGE_TO_MD(pg)-pvh_attrs PVF_REF) != 0) + #define pmap_is_page_colored_p(md) \ (((md)-pvh_attrs PVF_COLORED) != 0)
CVS commit: [uebayasi-xip] src/sys/arch/arm/include/arm32
Module Name:src Committed By: uebayasi Date: Tue Feb 23 07:03:13 UTC 2010 Modified Files: src/sys/arch/arm/include/arm32 [uebayasi-xip]: vmparam.h Log Message: Pass struct vm_page_md * to VM_MDPAGE_INIT(), not struct vm_page *. To generate a diff of this commit: cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/sys/arch/arm/include/arm32/vmparam.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/include/arm32/vmparam.h diff -u src/sys/arch/arm/include/arm32/vmparam.h:1.24.2.1 src/sys/arch/arm/include/arm32/vmparam.h:1.24.2.2 --- src/sys/arch/arm/include/arm32/vmparam.h:1.24.2.1 Tue Feb 9 07:42:26 2010 +++ src/sys/arch/arm/include/arm32/vmparam.h Tue Feb 23 07:03:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.24.2.1 2010/02/09 07:42:26 uebayasi Exp $ */ +/* $NetBSD: vmparam.h,v 1.24.2.2 2010/02/23 07:03:12 uebayasi Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -120,22 +120,22 @@ * Set the default color of each page. */ #if ARM_MMU_V6 0 -#define VM_MDPAGE_PVH_ATTRS_INIT(pg) \ - (pg)-mdpage.pvh_attrs = VM_PAGE_TO_PHYS(pg) arm_cache_prefer_mask +#define VM_MDPAGE_PVH_ATTRS_INIT(md, pa) \ + (md)-pvh_attrs = (pa) arm_cache_prefer_mask #else -#define VM_MDPAGE_PVH_ATTRS_INIT(pg) \ - (pg)-mdpage.pvh_attrs = 0 +#define VM_MDPAGE_PVH_ATTRS_INIT(md, pa) \ + (md)-pvh_attrs = 0 #endif -#define VM_MDPAGE_INIT(pg) \ +#define VM_MDPAGE_INIT(md, pa) \ do { \ - SLIST_INIT((pg)-mdpage.pvh_list);\ - simple_lock_init((pg)-mdpage.pvh_slock); \ - VM_MDPAGE_PVH_ATTRS_INIT(pg); \ - (pg)-mdpage.uro_mappings = 0; \ - (pg)-mdpage.urw_mappings = 0; \ - (pg)-mdpage.k_mappings = 0; \ + SLIST_INIT((md)-pvh_list); \ + simple_lock_init((md)-pvh_slock);\ + VM_MDPAGE_PVH_ATTRS_INIT((md), (pa));\ + (md)-uro_mappings = 0; \ + (md)-urw_mappings = 0; \ + (md)-k_mappings = 0; \ } while (/*CONSTCOND*/0) #endif /* __ASSEMBLER__ */
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Sat Feb 20 16:48:57 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: Fix \!DIAGNOSTIC build. To generate a diff of this commit: cvs rdiff -u -r1.211.2.7 -r1.211.2.8 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.7 src/sys/arch/arm/arm32/pmap.c:1.211.2.8 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.7 Wed Feb 10 15:48:28 2010 +++ src/sys/arch/arm/arm32/pmap.c Sat Feb 20 16:48:57 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.7 2010/02/10 15:48:28 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.8 2010/02/20 16:48:57 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.7 2010/02/10 15:48:28 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.8 2010/02/20 16:48:57 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -4794,7 +4794,9 @@ return (1); pa = VM_PAGE_TO_PHYS(pg); #ifdef PMAP_CACHE_VIPT +#ifdef DIAGNOSTIC struct vm_page_md *md = VM_PAGE_TO_MD(pg); +#endif /* * This new page must not have any mappings. Enter it via * pmap_kenter_pa and let that routine do the hard work.
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Wed Feb 10 12:53:26 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: Start changing this to be ready for device page (XIP). The basic rule is device pages don't have struct vm_page * objects. Instead per-page data (mainly PV mappings) is rooted from the global struct vm_page_md array. Convert 2 functions to take struct vm_page_md * instead of struct vm_page *. To generate a diff of this commit: cvs rdiff -u -r1.211 -r1.211.2.1 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211 src/sys/arch/arm/arm32/pmap.c:1.211.2.1 --- src/sys/arch/arm/arm32/pmap.c:1.211 Sat Jan 2 07:53:29 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Feb 10 12:53:26 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211 2010/01/02 07:53:29 he Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.1 2010/02/10 12:53:26 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211 2010/01/02 07:53:29 he Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.1 2010/02/10 12:53:26 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -638,7 +638,7 @@ static bool pmap_is_cached(pmap_t); static void pmap_enter_pv(struct vm_page *, struct pv_entry *, pmap_t, vaddr_t, u_int); -static struct pv_entry *pmap_find_pv(struct vm_page *, pmap_t, vaddr_t); +static struct pv_entry *pmap_find_pv(struct vm_page_md *, pmap_t, vaddr_t); static struct pv_entry *pmap_remove_pv(struct vm_page *, pmap_t, vaddr_t); static u_int pmap_modify_pv(struct vm_page *, pmap_t, vaddr_t, u_int, u_int); @@ -667,7 +667,7 @@ static int pmap_clean_page(struct pv_entry *, bool); #endif #ifdef PMAP_CACHE_VIPT -static void pmap_syncicache_page(struct vm_page *); +static void pmap_syncicache_page(struct vm_page_md *, paddr_t); enum pmap_flush_op { PMAP_FLUSH_PRIMARY, PMAP_FLUSH_SECONDARY, @@ -916,7 +916,7 @@ */ if (PV_IS_EXEC_P(flags)) { if (!PV_IS_EXEC_P(pg-mdpage.pvh_attrs)) { - pmap_syncicache_page(pg); + pmap_syncicache_page(pg-mdpage, VM_PAGE_TO_PHYS(pg)); PMAPCOUNT(exec_synced_map); } PMAPCOUNT(exec_mappings); @@ -937,11 +937,11 @@ * = caller should hold lock on vm_page */ static inline struct pv_entry * -pmap_find_pv(struct vm_page *pg, pmap_t pm, vaddr_t va) +pmap_find_pv(struct vm_page_md *md, pmap_t pm, vaddr_t va) { struct pv_entry *pv; - SLIST_FOREACH(pv, pg-mdpage.pvh_list, pv_link) { + SLIST_FOREACH(pv, md-pvh_list, pv_link) { if (pm == pv-pv_pmap va == pv-pv_va) break; } @@ -1005,7 +1005,7 @@ pg-mdpage.pvh_attrs = ~PVF_EXEC; PMAPCOUNT(exec_discarded_unmap); } else { - pmap_syncicache_page(pg); + pmap_syncicache_page(pg-mdpage, VM_PAGE_TO_PHYS(pg)); PMAPCOUNT(exec_synced_unmap); } } @@ -1060,7 +1060,7 @@ KASSERT((clr_mask PVF_KENTRY) == 0); KASSERT((set_mask PVF_KENTRY) == 0); - if ((npv = pmap_find_pv(pg, pm, va)) == NULL) + if ((npv = pmap_find_pv(pg-mdpage, pm, va)) == NULL) return (0); NPDEBUG(PDB_PVDUMP, @@ -1120,7 +1120,7 @@ if ((PV_IS_EXEC_P(flags) !PV_IS_EXEC_P(pg-mdpage.pvh_attrs)) || (PV_IS_EXEC_P(pg-mdpage.pvh_attrs) || (!(flags PVF_WRITE) (oflags PVF_WRITE { - pmap_syncicache_page(pg); + pmap_syncicache_page(pg-mdpage, VM_PAGE_TO_PHYS(pg)); PMAPCOUNT(exec_synced_remap); } KASSERT((pg-mdpage.pvh_attrs PVF_DMOD) == 0 || (pg-mdpage.pvh_attrs (PVF_DIRTY|PVF_NC))); @@ -2315,7 +2315,7 @@ * If we need to sync the I-cache and we haven't done it yet, do it. */ if (need_syncicache !did_syncicache) { - pmap_syncicache_page(pg); + pmap_syncicache_page(pg-mdpage, VM_PAGE_TO_PHYS(pg)); PMAPCOUNT(exec_synced_clearbit); } /* @@ -2427,26 +2427,26 @@ * right cache alias to make sure we flush the right stuff. */ void -pmap_syncicache_page(struct vm_page *pg) +pmap_syncicache_page(struct vm_page_md *md, paddr_t pa) { - const vsize_t va_offset = pg-mdpage.pvh_attrs arm_cache_prefer_mask; + const vsize_t va_offset = md-pvh_attrs arm_cache_prefer_mask; pt_entry_t * const ptep = cdst_pte[va_offset PGSHIFT]; - NPDEBUG(PDB_EXEC, printf(pmap_syncicache_page: pg=%p (attrs=%#x)\n, - pg, pg-mdpage.pvh_attrs)); + NPDEBUG(PDB_EXEC, printf(pmap_syncicache_page: md=%p (attrs=%#x)\n, + md, md-pvh_attrs)); /* * No need to clean the page if it's non-cached. */ - if (pg-mdpage.pvh_attrs PVF_NC) + if (md-pvh_attrs PVF_NC) return; - KASSERT(arm_cache_prefer_mask == 0 || pg-mdpage.pvh_attrs PVF_COLORED); + KASSERT(arm_cache_prefer_mask == 0 || md-pvh_attrs PVF_COLORED); pmap_tlb_flushID_SE(pmap_kernel(), cdstp + va_offset); /* * Set up a PTE with the right coloring to flush existing cache lines.
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Wed Feb 10 13:23:57 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: Convert pmap_remove_pv() / pmap_modify_pv() to take struct vm_page_md *. To generate a diff of this commit: cvs rdiff -u -r1.211.2.1 -r1.211.2.2 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.1 src/sys/arch/arm/arm32/pmap.c:1.211.2.2 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.1 Wed Feb 10 12:53:26 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Feb 10 13:23:57 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.1 2010/02/10 12:53:26 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.2 2010/02/10 13:23:57 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.1 2010/02/10 12:53:26 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.2 2010/02/10 13:23:57 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -639,8 +639,8 @@ static void pmap_enter_pv(struct vm_page *, struct pv_entry *, pmap_t, vaddr_t, u_int); static struct pv_entry *pmap_find_pv(struct vm_page_md *, pmap_t, vaddr_t); -static struct pv_entry *pmap_remove_pv(struct vm_page *, pmap_t, vaddr_t); -static u_int pmap_modify_pv(struct vm_page *, pmap_t, vaddr_t, +static struct pv_entry *pmap_remove_pv(struct vm_page_md *, paddr_t, pmap_t, vaddr_t); +static u_int pmap_modify_pv(struct vm_page_md *, paddr_t, pmap_t, vaddr_t, u_int, u_int); static void pmap_pinit(pmap_t); @@ -960,20 +960,20 @@ * = we return the removed pv */ static struct pv_entry * -pmap_remove_pv(struct vm_page *pg, pmap_t pm, vaddr_t va) +pmap_remove_pv(struct vm_page_md *md, paddr_t pa, pmap_t pm, vaddr_t va) { struct pv_entry *pv, **prevptr; NPDEBUG(PDB_PVDUMP, - printf(pmap_remove_pv: pm %p, pg %p, va 0x%08lx\n, pm, pg, va)); + printf(pmap_remove_pv: pm %p, md %p, va 0x%08lx\n, pm, md, va)); - prevptr = SLIST_FIRST(pg-mdpage.pvh_list); /* prev pv_entry ptr */ + prevptr = SLIST_FIRST(md-pvh_list); /* prev pv_entry ptr */ pv = *prevptr; while (pv) { if (pv-pv_pmap == pm pv-pv_va == va) { /* match? */ - NPDEBUG(PDB_PVDUMP, printf(pmap_remove_pv: pm %p, pg - %p, flags 0x%x\n, pm, pg, pv-pv_flags)); + NPDEBUG(PDB_PVDUMP, printf(pmap_remove_pv: pm %p, md + %p\n, pm, md)); if (pv-pv_flags PVF_WIRED) { --pm-pm_stats.wired_count; } @@ -981,14 +981,14 @@ if (pm == pmap_kernel()) { PMAPCOUNT(kernel_unmappings); if (pv-pv_flags PVF_WRITE) - pg-mdpage.krw_mappings--; + md-krw_mappings--; else - pg-mdpage.kro_mappings--; + md-kro_mappings--; } else { if (pv-pv_flags PVF_WRITE) - pg-mdpage.urw_mappings--; + md-urw_mappings--; else - pg-mdpage.uro_mappings--; + md-uro_mappings--; } PMAPCOUNT(unmappings); @@ -1000,12 +1000,12 @@ * this was the last mapping, discard the contents, * otherwise sync the i-cache for this page. */ - if (PV_IS_EXEC_P(pg-mdpage.pvh_attrs)) { -if (SLIST_EMPTY(pg-mdpage.pvh_list)) { - pg-mdpage.pvh_attrs = ~PVF_EXEC; + if (PV_IS_EXEC_P(md-pvh_attrs)) { +if (SLIST_EMPTY(md-pvh_list)) { + md-pvh_attrs = ~PVF_EXEC; PMAPCOUNT(exec_discarded_unmap); } else { - pmap_syncicache_page(pg-mdpage, VM_PAGE_TO_PHYS(pg)); + pmap_syncicache_page(md, pa); PMAPCOUNT(exec_synced_unmap); } } @@ -1021,18 +1021,18 @@ * If we no longer have a WRITEABLE KENTRY at the head of list, * clear the KMOD attribute from the page. */ - if (SLIST_FIRST(pg-mdpage.pvh_list) == NULL - || (SLIST_FIRST(pg-mdpage.pvh_list)-pv_flags PVF_KWRITE) != PVF_KWRITE) - pg-mdpage.pvh_attrs = ~PVF_KMOD; + if (SLIST_FIRST(md-pvh_list) == NULL + || (SLIST_FIRST(md-pvh_list)-pv_flags PVF_KWRITE) != PVF_KWRITE) + md-pvh_attrs = ~PVF_KMOD; /* * If this was a writeable page and there are no more writeable * mappings (ignoring KMPAGE), clear the WRITE flag and writeback * the contents to memory. */ - if (pg-mdpage.krw_mappings + pg-mdpage.urw_mappings == 0) - pg-mdpage.pvh_attrs = ~PVF_WRITE; - KASSERT((pg-mdpage.pvh_attrs PVF_DMOD) == 0 || (pg-mdpage.pvh_attrs (PVF_DIRTY|PVF_NC))); + if (md-krw_mappings + md-urw_mappings == 0) + md-pvh_attrs = ~PVF_WRITE; + KASSERT((md-pvh_attrs PVF_DMOD) == 0 || (md-pvh_attrs (PVF_DIRTY|PVF_NC))); #endif /* PMAP_CACHE_VIPT */ return(pv);/* return removed pv */ @@ -1051,7 +1051,7 @@ * Modify a physical-virtual mapping in the pv table */ static u_int -pmap_modify_pv(struct vm_page *pg, pmap_t pm, vaddr_t va, +pmap_modify_pv(struct vm_page_md *md, paddr_t pa, pmap_t pm, vaddr_t va, u_int clr_mask, u_int set_mask) {
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Wed Feb 10 13:26:22 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: Convert pmap_enter_pv(). To generate a diff of this commit: cvs rdiff -u -r1.211.2.2 -r1.211.2.3 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.2 src/sys/arch/arm/arm32/pmap.c:1.211.2.3 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.2 Wed Feb 10 13:23:57 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Feb 10 13:26:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.2 2010/02/10 13:23:57 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.3 2010/02/10 13:26:22 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.2 2010/02/10 13:23:57 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.3 2010/02/10 13:26:22 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -636,7 +636,7 @@ pt_entry_t **); static bool pmap_is_current(pmap_t); static bool pmap_is_cached(pmap_t); -static void pmap_enter_pv(struct vm_page *, struct pv_entry *, +static void pmap_enter_pv(struct vm_page_md *, paddr_t, struct pv_entry *, pmap_t, vaddr_t, u_int); static struct pv_entry *pmap_find_pv(struct vm_page_md *, pmap_t, vaddr_t); static struct pv_entry *pmap_remove_pv(struct vm_page_md *, paddr_t, pmap_t, vaddr_t); @@ -859,20 +859,20 @@ * = caller should not adjust pmap's wire_count */ static void -pmap_enter_pv(struct vm_page *pg, struct pv_entry *pv, pmap_t pm, +pmap_enter_pv(struct vm_page_md *md, paddr_t pa, struct pv_entry *pv, pmap_t pm, vaddr_t va, u_int flags) { struct pv_entry **pvp; NPDEBUG(PDB_PVDUMP, - printf(pmap_enter_pv: pm %p, pg %p, flags 0x%x\n, pm, pg, flags)); + printf(pmap_enter_pv: pm %p, md %p, flags 0x%x\n, pm, md, flags)); pv-pv_pmap = pm; pv-pv_va = va; pv-pv_flags = flags; - simple_lock(pg-mdpage.pvh_slock); /* lock vm_page */ - pvp = SLIST_FIRST(pg-mdpage.pvh_list); + simple_lock(md-pvh_slock); /* lock vm_page */ + pvp = SLIST_FIRST(md-pvh_list); #ifdef PMAP_CACHE_VIPT /* * Insert unmanaged entries, writeable first, at the head of @@ -888,25 +888,25 @@ #endif SLIST_NEXT(pv, pv_link) = *pvp; /* add to ... */ *pvp = pv;/* ... locked list */ - pg-mdpage.pvh_attrs |= flags (PVF_REF | PVF_MOD); + md-pvh_attrs |= flags (PVF_REF | PVF_MOD); #ifdef PMAP_CACHE_VIPT if ((pv-pv_flags PVF_KWRITE) == PVF_KWRITE) - pg-mdpage.pvh_attrs |= PVF_KMOD; - if ((pg-mdpage.pvh_attrs (PVF_DMOD|PVF_NC)) != PVF_NC) - pg-mdpage.pvh_attrs |= PVF_DIRTY; - KASSERT((pg-mdpage.pvh_attrs PVF_DMOD) == 0 || (pg-mdpage.pvh_attrs (PVF_DIRTY|PVF_NC))); + md-pvh_attrs |= PVF_KMOD; + if ((md-pvh_attrs (PVF_DMOD|PVF_NC)) != PVF_NC) + md-pvh_attrs |= PVF_DIRTY; + KASSERT((md-pvh_attrs PVF_DMOD) == 0 || (md-pvh_attrs (PVF_DIRTY|PVF_NC))); #endif if (pm == pmap_kernel()) { PMAPCOUNT(kernel_mappings); if (flags PVF_WRITE) - pg-mdpage.krw_mappings++; + md-krw_mappings++; else - pg-mdpage.kro_mappings++; + md-kro_mappings++; } else { if (flags PVF_WRITE) - pg-mdpage.urw_mappings++; + md-urw_mappings++; else - pg-mdpage.uro_mappings++; + md-uro_mappings++; } #ifdef PMAP_CACHE_VIPT @@ -915,8 +915,8 @@ * for this page, make sure to sync the I-cache. */ if (PV_IS_EXEC_P(flags)) { - if (!PV_IS_EXEC_P(pg-mdpage.pvh_attrs)) { - pmap_syncicache_page(pg-mdpage, VM_PAGE_TO_PHYS(pg)); + if (!PV_IS_EXEC_P(md-pvh_attrs)) { + pmap_syncicache_page(md, pa); PMAPCOUNT(exec_synced_map); } PMAPCOUNT(exec_mappings); @@ -924,7 +924,7 @@ #endif PMAPCOUNT(mappings); - simple_unlock(pg-mdpage.pvh_slock); /* unlock, done! */ + simple_unlock(md-pvh_slock); /* unlock, done! */ if (pv-pv_flags PVF_WIRED) ++pm-pm_stats.wired_count; @@ -2933,7 +2933,7 @@ return (ENOMEM); } - pmap_enter_pv(pg, pv, pm, va, nflags); + pmap_enter_pv(pg-mdpage, VM_PAGE_TO_PHYS(pg), pv, pm, va, nflags); } } else { /* @@ -3405,7 +3405,7 @@ pv = pool_get(pmap_pv_pool, PR_NOWAIT); KASSERT(pv != NULL); } - pmap_enter_pv(pg, pv, pmap_kernel(), va, + pmap_enter_pv(pg-mdpage, VM_PAGE_TO_PHYS(pg), pv, pmap_kernel(), va, PVF_WIRED | PVF_KENTRY | (prot VM_PROT_WRITE ? PVF_WRITE : 0)); if ((prot VM_PROT_WRITE)
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Wed Feb 10 13:58:08 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: Convert pmap_enter() and pmap_vac_me_harder(). To generate a diff of this commit: cvs rdiff -u -r1.211.2.3 -r1.211.2.4 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.3 src/sys/arch/arm/arm32/pmap.c:1.211.2.4 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.3 Wed Feb 10 13:26:22 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Feb 10 13:58:08 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.3 2010/02/10 13:26:22 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.4 2010/02/10 13:58:08 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.3 2010/02/10 13:26:22 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.4 2010/02/10 13:58:08 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -656,10 +656,10 @@ static int pmap_l2ptp_ctor(void *, void *, int); static int pmap_l2dtable_ctor(void *, void *, int); -static void pmap_vac_me_harder(struct vm_page *, pmap_t, vaddr_t); +static void pmap_vac_me_harder(struct vm_page_md *, paddr_t, pmap_t, vaddr_t); #ifdef PMAP_CACHE_VIVT -static void pmap_vac_me_kpmap(struct vm_page *, pmap_t, vaddr_t); -static void pmap_vac_me_user(struct vm_page *, pmap_t, vaddr_t); +static void pmap_vac_me_kpmap(struct vm_page_md *, paddr_t, pmap_t, vaddr_t); +static void pmap_vac_me_user(struct vm_page_md *, paddr_t, pmap_t, vaddr_t); #endif static void pmap_clearbit(struct vm_page *, u_int); @@ -673,7 +673,7 @@ PMAP_FLUSH_SECONDARY, PMAP_CLEAN_PRIMARY }; -static void pmap_flush_page(struct vm_page *, enum pmap_flush_op); +static void pmap_flush_page(struct vm_page_md *, paddr_t, enum pmap_flush_op); #endif static void pmap_page_remove(struct vm_page *); @@ -1573,50 +1573,50 @@ }; static inline int -pmap_get_vac_flags(const struct vm_page *pg) +pmap_get_vac_flags(const struct vm_page_md *md) { int kidx, uidx; kidx = 0; - if (pg-mdpage.kro_mappings || pg-mdpage.krw_mappings 1) + if (md-kro_mappings || md-krw_mappings 1) kidx |= 1; - if (pg-mdpage.krw_mappings) + if (md-krw_mappings) kidx |= 2; uidx = 0; - if (pg-mdpage.uro_mappings || pg-mdpage.urw_mappings 1) + if (md-uro_mappings || md-urw_mappings 1) uidx |= 1; - if (pg-mdpage.urw_mappings) + if (md-urw_mappings) uidx |= 2; return (pmap_vac_flags[uidx][kidx]); } static inline void -pmap_vac_me_harder(struct vm_page *pg, pmap_t pm, vaddr_t va) +pmap_vac_me_harder(struct vm_page_md *md, paddr_t pa, pmap_t pm, vaddr_t va) { int nattr; - nattr = pmap_get_vac_flags(pg); + nattr = pmap_get_vac_flags(md); if (nattr 0) { - pg-mdpage.pvh_attrs = ~PVF_NC; + md-pvh_attrs = ~PVF_NC; return; } - if (nattr == 0 (pg-mdpage.pvh_attrs PVF_NC) == 0) + if (nattr == 0 (md-pvh_attrs PVF_NC) == 0) return; if (pm == pmap_kernel()) - pmap_vac_me_kpmap(pg, pm, va); + pmap_vac_me_kpmap(md, pa, pm, va); else - pmap_vac_me_user(pg, pm, va); + pmap_vac_me_user(md, pa, pm, va); - pg-mdpage.pvh_attrs = (pg-mdpage.pvh_attrs ~PVF_NC) | nattr; + md-pvh_attrs = (md-pvh_attrs ~PVF_NC) | nattr; } static void -pmap_vac_me_kpmap(struct vm_page *pg, pmap_t pm, vaddr_t va) +pmap_vac_me_kpmap(struct vm_page_md *md, paddr_t pa, pmap_t pm, vaddr_t va) { u_int u_cacheable, u_entries; struct pv_entry *pv; @@ -1628,19 +1628,19 @@ * kernel-writable pages. */ u_cacheable = 0; - SLIST_FOREACH(pv, pg-mdpage.pvh_list, pv_link) { + SLIST_FOREACH(pv, md-pvh_list, pv_link) { if (pv-pv_pmap != pm (pv-pv_flags PVF_NC) == 0) u_cacheable++; } - u_entries = pg-mdpage.urw_mappings + pg-mdpage.uro_mappings; + u_entries = md-urw_mappings + md-uro_mappings; /* * We know we have just been updating a kernel entry, so if * all user pages are already cacheable, then there is nothing * further to do. */ - if (pg-mdpage.k_mappings == 0 u_cacheable == u_entries) + if (md-k_mappings == 0 u_cacheable == u_entries) return; if (u_entries) { @@ -1649,7 +1649,7 @@ * might not be set correctly, call pmap_vac_me_user * to recalculate the settings. */ - SLIST_FOREACH(pv, pg-mdpage.pvh_list, pv_link) { + SLIST_FOREACH(pv, md-pvh_list, pv_link) { /* * We know kernel mappings will get set * correctly in other calls. We also know @@ -1664,7 +1664,7 @@ * is writable but non-cacheable, then we can * skip this entry also. */ - if (pg-mdpage.k_mappings + if (md-k_mappings (pv-pv_flags (PVF_NC | PVF_WRITE)) == (PVF_NC | PVF_WRITE)) continue; @@ -1674,7 +1674,7 @@ * entries and the page is already
CVS commit: [uebayasi-xip] src/sys/arch/arm
Module Name:src Committed By: uebayasi Date: Wed Feb 10 14:20:23 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: mem.c src/sys/arch/arm/include/arm32 [uebayasi-xip]: pmap.h Log Message: Missing bits of pmap_is_page_colored_p() conversion. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.26.6.1 src/sys/arch/arm/arm32/mem.c cvs rdiff -u -r1.94 -r1.94.2.1 src/sys/arch/arm/include/arm32/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/mem.c diff -u src/sys/arch/arm/arm32/mem.c:1.26 src/sys/arch/arm/arm32/mem.c:1.26.6.1 --- src/sys/arch/arm/arm32/mem.c:1.26 Wed Nov 19 06:24:04 2008 +++ src/sys/arch/arm/arm32/mem.c Wed Feb 10 14:20:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.26 2008/11/19 06:24:04 matt Exp $ */ +/* $NetBSD: mem.c,v 1.26.6.1 2010/02/10 14:20:23 uebayasi Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -76,7 +76,7 @@ #include opt_compat_netbsd.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.26 2008/11/19 06:24:04 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.26.6.1 2010/02/10 14:20:23 uebayasi Exp $); #include sys/param.h #include sys/conf.h @@ -144,7 +144,7 @@ { struct vm_page *pg; pg = PHYS_TO_VM_PAGE(trunc_page(v)); -if (pg != NULL pmap_is_page_colored_p(pg)) +if (pg != NULL pmap_is_page_colored_p(pg-mdpage)) o = pg-mdpage.pvh_attrs; else o = v; Index: src/sys/arch/arm/include/arm32/pmap.h diff -u src/sys/arch/arm/include/arm32/pmap.h:1.94 src/sys/arch/arm/include/arm32/pmap.h:1.94.2.1 --- src/sys/arch/arm/include/arm32/pmap.h:1.94 Sun Dec 27 05:14:56 2009 +++ src/sys/arch/arm/include/arm32/pmap.h Wed Feb 10 14:20:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.94 2009/12/27 05:14:56 uebayasi Exp $ */ +/* $NetBSD: pmap.h,v 1.94.2.1 2010/02/10 14:20:23 uebayasi Exp $ */ /* * Copyright (c) 2002, 2003 Wasabi Systems, Inc. @@ -272,8 +272,8 @@ (((pg)-mdpage.pvh_attrs PVF_MOD) != 0) #define pmap_is_referenced(pg) \ (((pg)-mdpage.pvh_attrs PVF_REF) != 0) -#define pmap_is_page_colored_p(pg) \ - (((pg)-mdpage.pvh_attrs PVF_COLORED) != 0) +#define pmap_is_page_colored_p(md) \ + (((md)-pvh_attrs PVF_COLORED) != 0) #define pmap_copy(dp, sp, da, l, sa) /* nothing */
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Wed Feb 10 15:37:48 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: Replace all remaining pg-mdpage references with VM_PAGE_TO_MD(). Now struct vm_page * is fully opaque. To generate a diff of this commit: cvs rdiff -u -r1.211.2.5 -r1.211.2.6 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.5 src/sys/arch/arm/arm32/pmap.c:1.211.2.6 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.5 Wed Feb 10 14:18:30 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Feb 10 15:37:48 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.5 2010/02/10 14:18:30 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.6 2010/02/10 15:37:48 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.5 2010/02/10 14:18:30 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.6 2010/02/10 15:37:48 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -2122,6 +2122,7 @@ static void pmap_clearbit(struct vm_page *pg, u_int maskbits) { + struct vm_page_md *md = VM_PAGE_TO_MD(pg); struct l2_bucket *l2b; struct pv_entry *pv; pt_entry_t *ptep, npte, opte; @@ -2129,7 +2130,7 @@ vaddr_t va; u_int oflags; #ifdef PMAP_CACHE_VIPT - const bool want_syncicache = PV_IS_EXEC_P(pg-mdpage.pvh_attrs); + const bool want_syncicache = PV_IS_EXEC_P(md-pvh_attrs); bool need_syncicache = false; bool did_syncicache = false; bool need_vac_me_harder = false; @@ -2140,7 +2141,7 @@ pg, VM_PAGE_TO_PHYS(pg), maskbits)); PMAP_HEAD_TO_MAP_LOCK(); - simple_lock(pg-mdpage.pvh_slock); + simple_lock(md-pvh_slock); #ifdef PMAP_CACHE_VIPT /* @@ -2148,25 +2149,25 @@ * then we know we definitely need to sync or discard it. */ if (want_syncicache) - need_syncicache = pg-mdpage.pvh_attrs PVF_MOD; + need_syncicache = md-pvh_attrs PVF_MOD; #endif /* * Clear saved attributes (modify, reference) */ - pg-mdpage.pvh_attrs = ~(maskbits (PVF_MOD | PVF_REF)); + md-pvh_attrs = ~(maskbits (PVF_MOD | PVF_REF)); - if (SLIST_EMPTY(pg-mdpage.pvh_list)) { + if (SLIST_EMPTY(md-pvh_list)) { #ifdef PMAP_CACHE_VIPT if (need_syncicache) { /* * No one has it mapped, so just discard it. The next * exec remapping will cause it to be synced. */ - pg-mdpage.pvh_attrs = ~PVF_EXEC; + md-pvh_attrs = ~PVF_EXEC; PMAPCOUNT(exec_discarded_clearbit); } #endif - simple_unlock(pg-mdpage.pvh_slock); + simple_unlock(md-pvh_slock); PMAP_HEAD_TO_MAP_UNLOCK(); return; } @@ -2174,7 +2175,7 @@ /* * Loop over all current mappings setting/clearing as appropos */ - SLIST_FOREACH(pv, pg-mdpage.pvh_list, pv_link) { + SLIST_FOREACH(pv, md-pvh_list, pv_link) { va = pv-pv_va; pm = pv-pv_pmap; oflags = pv-pv_flags; @@ -2244,15 +2245,15 @@ * Keep alias accounting up to date */ if (pv-pv_pmap == pmap_kernel()) { - pg-mdpage.krw_mappings--; - pg-mdpage.kro_mappings++; + md-krw_mappings--; + md-kro_mappings++; } else { - pg-mdpage.urw_mappings--; - pg-mdpage.uro_mappings++; + md-urw_mappings--; + md-uro_mappings++; } #ifdef PMAP_CACHE_VIPT -if (pg-mdpage.urw_mappings + pg-mdpage.krw_mappings == 0) - pg-mdpage.pvh_attrs = ~PVF_WRITE; +if (md-urw_mappings + md-krw_mappings == 0) + md-pvh_attrs = ~PVF_WRITE; if (want_syncicache) need_syncicache = true; need_vac_me_harder = true; @@ -2315,7 +2316,7 @@ * If we need to sync the I-cache and we haven't done it yet, do it. */ if (need_syncicache !did_syncicache) { - pmap_syncicache_page(pg-mdpage, VM_PAGE_TO_PHYS(pg)); + pmap_syncicache_page(md, VM_PAGE_TO_PHYS(pg)); PMAPCOUNT(exec_synced_clearbit); } /* @@ -2324,12 +2325,12 @@ * this as a page deletion. */ if (need_vac_me_harder) { - if (pg-mdpage.pvh_attrs PVF_NC) - pmap_vac_me_harder(pg-mdpage, VM_PAGE_TO_PHYS(pg), NULL, 0); + if (md-pvh_attrs PVF_NC) + pmap_vac_me_harder(md, VM_PAGE_TO_PHYS(pg), NULL, 0); } #endif - simple_unlock(pg-mdpage.pvh_slock); + simple_unlock(md-pvh_slock); PMAP_HEAD_TO_MAP_UNLOCK(); } @@ -2567,6 +2568,7 @@ static void pmap_page_remove(struct vm_page *pg) { + struct vm_page_md *md = VM_PAGE_TO_MD(pg); struct l2_bucket *l2b; struct pv_entry *pv, *npv, **pvp; pmap_t pm; @@ -2579,35 +2581,35 @@ VM_PAGE_TO_PHYS(pg))); PMAP_HEAD_TO_MAP_LOCK(); - simple_lock(pg-mdpage.pvh_slock); + simple_lock(md-pvh_slock); - pv = SLIST_FIRST(pg-mdpage.pvh_list); + pv = SLIST_FIRST(md-pvh_list); if (pv == NULL) { #ifdef PMAP_CACHE_VIPT /* * We *know* the page contents are about to be replaced. * Discard the exec contents */ - if
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Wed Feb 10 15:48:28 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: Adjust previous. To generate a diff of this commit: cvs rdiff -u -r1.211.2.6 -r1.211.2.7 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.6 src/sys/arch/arm/arm32/pmap.c:1.211.2.7 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.6 Wed Feb 10 15:37:48 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Feb 10 15:48:28 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.6 2010/02/10 15:37:48 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.7 2010/02/10 15:48:28 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.6 2010/02/10 15:37:48 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.7 2010/02/10 15:48:28 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -2569,6 +2569,7 @@ pmap_page_remove(struct vm_page *pg) { struct vm_page_md *md = VM_PAGE_TO_MD(pg); + paddr_t pa = VM_PAGE_TO_PHYS(pg); struct l2_bucket *l2b; struct pv_entry *pv, *npv, **pvp; pmap_t pm; @@ -2578,7 +2579,7 @@ NPDEBUG(PDB_FOLLOW, printf(pmap_page_remove: pg %p (0x%08lx)\n, pg, - VM_PAGE_TO_PHYS(pg))); + pa)); PMAP_HEAD_TO_MAP_LOCK(); simple_lock(md-pvh_slock); @@ -2681,7 +2682,7 @@ if (pv == NULL) { *pvp = NULL; if (!SLIST_EMPTY(md-pvh_list)) -pmap_vac_me_harder(md, VM_PAGE_TO_PHYS(pg), pm, 0); +pmap_vac_me_harder(md, pa, pm, 0); } pmap_release_pmap_lock(pm); } @@ -3471,8 +3472,8 @@ while (va next_bucket) { opte = *ptep; opg = PHYS_TO_VM_PAGE(l2pte_pa(opte)); - struct vm_page_md *omd = VM_PAGE_TO_MD(opg); if (opg) { +struct vm_page_md *omd = VM_PAGE_TO_MD(opg); if (omd-pvh_attrs PVF_KMPAGE) { simple_lock(omd-pvh_slock); KASSERT(omd-urw_mappings == 0); @@ -3640,8 +3641,8 @@ *ptep = pte; PTE_SYNC(ptep); -struct vm_page_md *md = VM_PAGE_TO_MD(pg); if (pg != NULL) { + struct vm_page_md *md = VM_PAGE_TO_MD(pg); simple_lock(md-pvh_slock); f = pmap_modify_pv(md, VM_PAGE_TO_PHYS(pg), pm, sva, clr_mask, 0);