]> Zhao Yanbai Git Server - minix.git/commitdiff
arm:vm caching fix. 65/565/1
authorKees Jongenburger <kees.jongenburger@gmail.com>
Thu, 16 May 2013 08:11:12 +0000 (10:11 +0200)
committerKees Jongenburger <keesj@minix3.org>
Thu, 16 May 2013 18:39:20 +0000 (20:39 +0200)
Improve reliability by using write trough cache.

kernel/arch/earm/memory.c
kernel/arch/earm/pg_utils.c
servers/vm/arch/i386/pagetable.c
servers/vm/region.c

index 7d2123adaadbc64879d8ec7c337a8f1fb7d8db71..00de13ea78d78c02a05bec14d1846dde8cedd152 100644 (file)
@@ -103,7 +103,7 @@ static phys_bytes createpde(
                pdeval = (linaddr & ARM_VM_SECTION_MASK)
                        | ARM_VM_SECTION
                        | ARM_VM_SECTION_DOMAIN
-                       | ARM_VM_SECTION_WT
+                       | ARM_VM_SECTION_DEVICE
                        | ARM_VM_SECTION_USER;
        }
 
@@ -684,6 +684,7 @@ static int device_mem_mapping_index = -1,
 
 char *device_mem;
 
+/* defined in kernel.lds */
 extern char usermapped_start, usermapped_end, usermapped_nonglo_start;
 
 int arch_phys_map(const int index,
index 2895aa314cc3376873cc340afb4423a45648a351..b2d696d1e5a4cc8a5c3ab5305f359a975b68ce35 100644 (file)
@@ -200,7 +200,6 @@ void vm_enable_paging(void)
        /* Enable MMU */
        sctlr |= SCTLR_M;
 
-       /* AFE set to zero (default reset value): not using simplified model. */
        /* TRE set to zero (default reset value): TEX[2:0] are used, plus C and B bits.*/
        sctlr &= ~SCTLR_TRE;
 
index 0cb8a62aef7abc53d906593aba70c88a931fa752..8008f11387b728a20bf34416fc0b59a59a904279 100644 (file)
@@ -301,7 +301,7 @@ void *vm_mappages(phys_bytes p, int pages)
        if((r=pt_writemap(vmprocess, pt, loc, p, VM_PAGE_SIZE*pages,
                ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_RW
 #if defined(__arm__)
-               | ARM_VM_PTE_WB
+               | ARM_VM_PTE_WT
 #endif
                , 0)) != OK) {
                printf("vm_mappages writemap failed\n");
@@ -409,7 +409,7 @@ void vm_pagelock(void *vir, int lockflag)
 #if defined(__arm__)
        else
                flags |= ARCH_VM_PTE_RO;
-       flags |= ARM_VM_PTE_WB | ARM_VM_PTE_S ; // LSC FIXME
+       flags |= ARM_VM_PTE_WT ;
 #endif
 
        /* Update flags. */
@@ -689,7 +689,7 @@ int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
 #elif defined(__arm__)
        if((r=pt_writemap(dst_vmp, &dst_vmp->vm_pt, viraddr, physaddr, ARCH_PAGEDIR_SIZE,
                ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER |
-               ARM_VM_PTE_WB | ARM_VM_PTE_S, //LSC FIXME
+               ARM_VM_PTE_WT ,
 #endif
                WMF_OVERWRITE)) != OK) {
                return r;
@@ -715,7 +715,7 @@ int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
                if((r=pt_writemap(dst_vmp, &dst_vmp->vm_pt, viraddr, physaddr, VM_PAGE_SIZE,
                        ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_RW
 #ifdef __arm__
-                       | ARM_VM_PTE_WB
+                       | ARM_VM_PTE_WT
 #endif
                        ,
                        WMF_OVERWRITE)) != OK) {
@@ -874,6 +874,7 @@ int pt_writemap(struct vmproc * vmp,
                                /* If we expect a writable page, allow a readonly page. */
                                maskedentry &= ~ARCH_VM_PTE_RO;
                        }
+                       maskedentry &= ~(ARM_VM_PTE_WB|ARM_VM_PTE_WT);
 #endif
                        if(maskedentry != entry) {
                                printf("pt_writemap: mismatch: ");
@@ -1377,7 +1378,7 @@ int pt_mapkernel(pt_t *pt)
                pt->pt_dir[kern_pde] = (addr & ARCH_VM_PDE_MASK)
                        | ARM_VM_SECTION
                        | ARM_VM_SECTION_DOMAIN
-                       | ARM_VM_SECTION_WB
+                       | ARM_VM_SECTION_WT
                        | ARM_VM_SECTION_SUPER;
 #endif
                kern_pde++;
@@ -1412,8 +1413,7 @@ int pt_mapkernel(pt_t *pt)
                                assert(!pt->pt_dir[map_pde]);
                                pt->pt_dir[map_pde] = addr |
                                        ARM_VM_SECTION | ARM_VM_SECTION_DOMAIN |
-                                       ARM_VM_SECTION_WB |
-                                       ARM_VM_SECTION_SHAREABLE |
+                                       ARM_VM_SECTION_DEVICE |
                                        ARM_VM_SECTION_SUPER;
                                addr += ARCH_BIG_PAGE_SIZE;
                        }
index a77f415dd657666f66e54c2219075009b04c50fe..53611931d09e37d1c6494b2d6ecd66a1ce88ea88 100644 (file)
@@ -270,7 +270,8 @@ int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
 #if  defined(__arm__)
        if (pb->phys >= 0x80000000 && pb->phys < (0xc0000000 - VM_PAGE_SIZE)) {
                // LSC Do this only for actual RAM
-               flags |= ARM_VM_PTE_WT;
+               // KEJO:fishy will need to look into this 
+               flags |= ARM_VM_PTE_DEVICE;
        }
 #endif