diff options
-rw-r--r-- | sys/arch/hppa/hppa/mainbus.c | 5 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/pmap.c | 27 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/vm_machdep.c | 29 | ||||
-rw-r--r-- | sys/arch/hppa/include/pmap.h | 4 |
4 files changed, 53 insertions, 12 deletions
diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c index 0df5a4bf850..b4f136eb4fb 100644 --- a/sys/arch/hppa/hppa/mainbus.c +++ b/sys/arch/hppa/hppa/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.74 2009/04/20 00:42:06 oga Exp $ */ +/* $OpenBSD: mainbus.c,v 1.75 2009/06/11 20:10:51 kettenis Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -977,6 +977,9 @@ mbus_dmamem_free(void *v, bus_dma_segment_t *segs, int nsegs) if (!pg) panic("mbus_dmamem_free: no page for pa"); TAILQ_INSERT_TAIL(&pglist, pg, pageq); + pdcache(HPPA_SID_KERNEL, pa, PAGE_SIZE); + pdtlb(HPPA_SID_KERNEL, pa); + pitlb(HPPA_SID_KERNEL, pa); } uvm_pglistfree(&pglist); } diff --git a/sys/arch/hppa/hppa/pmap.c b/sys/arch/hppa/hppa/pmap.c index e6f4229fdac..5f9d72ab8b9 100644 --- a/sys/arch/hppa/hppa/pmap.c +++ b/sys/arch/hppa/hppa/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.135 2009/06/02 23:00:18 oga Exp $ */ +/* $OpenBSD: pmap.c,v 1.136 2009/06/11 20:10:51 kettenis Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -223,12 +223,15 @@ pmap_pde_ptp(struct pmap *pm, volatile pt_entry_t *pde) static __inline void pmap_pde_release(struct pmap *pmap, vaddr_t va, struct vm_page *ptp) { + paddr_t pa; + DPRINTF(PDB_FOLLOW|PDB_PV, ("pmap_pde_release(%p, 0x%x, %p)\n", pmap, va, ptp)); if (pmap != pmap_kernel() && --ptp->wire_count <= 1) { DPRINTF(PDB_FOLLOW|PDB_PV, ("pmap_pde_release: disposing ptp %p\n", ptp)); + pmap_pde_set(pmap, va, 0); pmap->pm_stats.resident_count--; if (pmap->pm_ptphint == ptp) @@ -238,6 +241,10 @@ pmap_pde_release(struct pmap *pmap, vaddr_t va, struct vm_page *ptp) if (ptp->pg_flags & PG_BUSY) panic("pmap_pde_release: busy page table page"); #endif + pa = VM_PAGE_TO_PHYS(ptp); + pdcache(HPPA_SID_KERNEL, pa, PAGE_SIZE); + pdtlb(HPPA_SID_KERNEL, pa); + pitlb(HPPA_SID_KERNEL, pa); uvm_pagefree(ptp); } } @@ -678,6 +685,7 @@ pmap_destroy(pmap) #ifdef DIAGNOSTIC struct vm_page *pg; #endif + paddr_t pa; int refs; DPRINTF(PDB_FOLLOW|PDB_PMAP, ("pmap_destroy(%p)\n", pmap)); @@ -729,8 +737,15 @@ pmap_destroy(pmap) #endif } #endif + pmap_sdir_set(pmap->pm_space, 0); + + pa = VM_PAGE_TO_PHYS(pmap->pm_pdir_pg); + pdcache(HPPA_SID_KERNEL, pa, PAGE_SIZE); + pdtlb(HPPA_SID_KERNEL, pa); + pitlb(HPPA_SID_KERNEL, pa); uvm_pagefree(pmap->pm_pdir_pg); + pmap->pm_pdir_pg = NULL; pool_put(&pmap_pmap_pool, pmap); } @@ -1295,3 +1310,13 @@ pmap_kremove(va, size) DPRINTF(PDB_FOLLOW|PDB_REMOVE, ("pmap_kremove: leaving\n")); } + +struct vm_page * +pmap_unmap_direct(vaddr_t va) +{ + fdcache(HPPA_SID_KERNEL, va, PAGE_SIZE); + pdtlb(HPPA_SID_KERNEL, va); + ficache(HPPA_SID_KERNEL, va, PAGE_SIZE); + pitlb(HPPA_SID_KERNEL, va); + return (PHYS_TO_VM_PAGE(va)); +} diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index a6cd08cbc78..6037e11bb8f 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.65 2009/03/26 17:24:33 oga Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.66 2009/06/11 20:10:51 kettenis Exp $ */ /* * Copyright (c) 1999-2004 Michael Shalayeff @@ -115,6 +115,21 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) mtctl(0, CR_CCR); } + /* + * Stash the physical for the pcb of U for later perusal + */ + if (!pmap_extract(pmap_kernel(), (vaddr_t)p2->p_addr, &pa)) + panic("pmap_extract(%p) failed", p2->p_addr); + + /* + * XXX This shouldn't be necessary, since there shouldn't be any + * allocated cache lines for this new pcb. But for some reason + * that is not the case... + */ + pdcache(HPPA_SID_KERNEL, pa, PAGE_SIZE); + pdtlb(HPPA_SID_KERNEL, pa); + pitlb(HPPA_SID_KERNEL, pa); + pcbp = &p2->p_addr->u_pcb; bcopy(&p1->p_addr->u_pcb, pcbp, sizeof(*pcbp)); /* space is cached for the copy{in,out}'s pleasure */ @@ -131,12 +146,6 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) sp += sizeof(struct trapframe); bcopy(p1->p_md.md_regs, tf, sizeof(*tf)); - /* - * Stash the physical for the pcb of U for later perusal - */ - if (!pmap_extract(pmap_kernel(), (vaddr_t)p2->p_addr, &pa)) - panic("pmap_extract(%p) failed", p2->p_addr); - tf->tf_cr30 = pa; tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr2 = tf->tf_sr3 = @@ -172,7 +181,11 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) *HPPA_FRAME_CARG(0, sp) = (register_t)arg; *HPPA_FRAME_CARG(1, sp) = KERNMODE(func); pcbp->pcb_ksp = sp; - fdcache(HPPA_SID_KERNEL, (vaddr_t)p2->p_addr, sp - (vaddr_t)p2->p_addr); + + fdcache(HPPA_SID_KERNEL, (vaddr_t)p2->p_addr, PAGE_SIZE); + pdtlb(HPPA_SID_KERNEL, (vaddr_t)p2->p_addr); + ficache(HPPA_SID_KERNEL, (vaddr_t)p2->p_addr, PAGE_SIZE); + pitlb(HPPA_SID_KERNEL, (vaddr_t)p2->p_addr); } void diff --git a/sys/arch/hppa/include/pmap.h b/sys/arch/hppa/include/pmap.h index 8b5693e3093..bc952b887fb 100644 --- a/sys/arch/hppa/include/pmap.h +++ b/sys/arch/hppa/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $ */ +/* $OpenBSD: pmap.h,v 1.36 2009/06/11 20:10:51 kettenis Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -84,7 +84,7 @@ extern struct pdc_hwtlb pdc_hwtlb; * pool quickmaps */ #define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg)) -#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)(va)) +struct vm_page *pmap_unmap_direct(vaddr_t); #define __HAVE_PMAP_DIRECT /* |