add a new flag PMAP_CACHE_VIVT for the pmap to inform the MI code that

that the cache is virtually-indexed and virtually-tagged (such as on the ARM),
and use this flag in the UBC code to be more friendly to those caches.
This commit is contained in:
chs 2002-01-19 16:55:20 +00:00
parent d7938946ac
commit b263a7eb4d
2 changed files with 23 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.19 2001/11/23 19:21:48 thorpej Exp $ */
/* $NetBSD: pmap.h,v 1.20 2002/01/19 16:55:22 chs Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@ -211,6 +211,12 @@ boolean_t pmap_pageidlezero __P((paddr_t));
#define KERNEL_PD_SIZE \
(PD_SIZE - (KERNEL_SPACE_START >> PDSHIFT) * sizeof(pd_entry_t))
/*
* tell MI code that the cache is virtually-indexed *and* virtually-tagged.
*/
#define PMAP_CACHE_VIVT
#endif /* _KERNEL */
#endif /* _ARM32_PMAP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_bio.c,v 1.22 2001/11/19 02:44:27 enami Exp $ */
/* $NetBSD: uvm_bio.c,v 1.23 2002/01/19 16:55:20 chs Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.22 2001/11/19 02:44:27 enami Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.23 2002/01/19 16:55:20 chs Exp $");
#include "opt_uvmhist.h"
@ -229,6 +229,7 @@ ubc_fault(ufi, ign1, ign2, ign3, ign4, fault_type, access_type, flags)
vaddr_t va, eva, ubc_offset, slot_offset;
int i, error, npages;
struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT], *pg;
vm_prot_t prot;
UVMHIST_FUNC("ubc_fault"); UVMHIST_CALLED(ubchist);
/*
@ -288,6 +289,18 @@ again:
va = ufi->orig_rvaddr;
eva = ufi->orig_rvaddr + (npages << PAGE_SHIFT);
/*
* for virtually-indexed, virtually-tagged caches we should avoid
* creating writable mappings when we don't absolutely need them,
* since the "compatible alias" trick doesn't work on such caches.
* otherwise, we can always map the pages writable.
*/
#ifdef PMAP_CACHE_VIVT
prot = VM_PROT_READ | access_type;
#else
prot = VM_PROT_READ | VM_PROT_WRITE;
#endif
UVMHIST_LOG(ubchist, "va 0x%lx eva 0x%lx", va, eva, 0,0);
simple_lock(&uobj->vmobjlock);
uvm_lock_pageq();
@ -309,7 +322,7 @@ again:
KASSERT(access_type == VM_PROT_READ ||
(pg->flags & PG_RDONLY) == 0);
pmap_enter(ufi->orig_map->pmap, va, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ | VM_PROT_WRITE, access_type);
prot, access_type);
uvm_pageactivate(pg);
pg->flags &= ~(PG_BUSY);
UVM_PAGE_OWN(pg, NULL);