Source-Changes-HG archive

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

[src/trunk]: src/sys add a new flag PMAP_CACHE_VIVT for the pmap to inform th...



details:   https://anonhg.NetBSD.org/src/rev/c775754b7331
branches:  trunk
changeset: 520923:c775754b7331
user:      chs <chs%NetBSD.org@localhost>
date:      Sat Jan 19 16:55:20 2002 +0000

description:
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.

diffstat:

 sys/arch/arm/include/arm32/pmap.h |   8 +++++++-
 sys/uvm/uvm_bio.c                 |  19 ++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diffs (76 lines):

diff -r de4e63d46127 -r c775754b7331 sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Sat Jan 19 16:49:28 2002 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Sat Jan 19 16:55:20 2002 +0000
@@ -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 @@
 #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_ */
diff -r de4e63d46127 -r c775754b7331 sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Sat Jan 19 16:49:28 2002 +0000
+++ b/sys/uvm/uvm_bio.c Sat Jan 19 16:55:20 2002 +0000
@@ -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 @@
        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 @@
        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 @@
                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);



Home | Main Index | Thread Index | Old Index