arm:vm caching fix.

Improve reliability by using write trough cache.
This commit is contained in:
Kees Jongenburger 2013-05-16 10:11:12 +02:00 committed by Kees Jongenburger
parent a3f6529ee2
commit 1e1ff96aea
4 changed files with 11 additions and 10 deletions

View File

@ -103,7 +103,7 @@ static phys_bytes createpde(
pdeval = (linaddr & ARM_VM_SECTION_MASK) pdeval = (linaddr & ARM_VM_SECTION_MASK)
| ARM_VM_SECTION | ARM_VM_SECTION
| ARM_VM_SECTION_DOMAIN | ARM_VM_SECTION_DOMAIN
| ARM_VM_SECTION_WT | ARM_VM_SECTION_DEVICE
| ARM_VM_SECTION_USER; | ARM_VM_SECTION_USER;
} }
@ -684,6 +684,7 @@ static int device_mem_mapping_index = -1,
char *device_mem; char *device_mem;
/* defined in kernel.lds */
extern char usermapped_start, usermapped_end, usermapped_nonglo_start; extern char usermapped_start, usermapped_end, usermapped_nonglo_start;
int arch_phys_map(const int index, int arch_phys_map(const int index,

View File

@ -200,7 +200,6 @@ void vm_enable_paging(void)
/* Enable MMU */ /* Enable MMU */
sctlr |= SCTLR_M; 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.*/ /* TRE set to zero (default reset value): TEX[2:0] are used, plus C and B bits.*/
sctlr &= ~SCTLR_TRE; sctlr &= ~SCTLR_TRE;

View 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, if((r=pt_writemap(vmprocess, pt, loc, p, VM_PAGE_SIZE*pages,
ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_RW ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_RW
#if defined(__arm__) #if defined(__arm__)
| ARM_VM_PTE_WB | ARM_VM_PTE_WT
#endif #endif
, 0)) != OK) { , 0)) != OK) {
printf("vm_mappages writemap failed\n"); printf("vm_mappages writemap failed\n");
@ -409,7 +409,7 @@ void vm_pagelock(void *vir, int lockflag)
#if defined(__arm__) #if defined(__arm__)
else else
flags |= ARCH_VM_PTE_RO; flags |= ARCH_VM_PTE_RO;
flags |= ARM_VM_PTE_WB | ARM_VM_PTE_S ; // LSC FIXME flags |= ARM_VM_PTE_WT ;
#endif #endif
/* Update flags. */ /* Update flags. */
@ -689,7 +689,7 @@ int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
#elif defined(__arm__) #elif defined(__arm__)
if((r=pt_writemap(dst_vmp, &dst_vmp->vm_pt, viraddr, physaddr, ARCH_PAGEDIR_SIZE, if((r=pt_writemap(dst_vmp, &dst_vmp->vm_pt, viraddr, physaddr, ARCH_PAGEDIR_SIZE,
ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER |
ARM_VM_PTE_WB | ARM_VM_PTE_S, //LSC FIXME ARM_VM_PTE_WT ,
#endif #endif
WMF_OVERWRITE)) != OK) { WMF_OVERWRITE)) != OK) {
return r; 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, 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 ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_RW
#ifdef __arm__ #ifdef __arm__
| ARM_VM_PTE_WB | ARM_VM_PTE_WT
#endif #endif
, ,
WMF_OVERWRITE)) != OK) { WMF_OVERWRITE)) != OK) {
@ -874,6 +874,7 @@ int pt_writemap(struct vmproc * vmp,
/* If we expect a writable page, allow a readonly page. */ /* If we expect a writable page, allow a readonly page. */
maskedentry &= ~ARCH_VM_PTE_RO; maskedentry &= ~ARCH_VM_PTE_RO;
} }
maskedentry &= ~(ARM_VM_PTE_WB|ARM_VM_PTE_WT);
#endif #endif
if(maskedentry != entry) { if(maskedentry != entry) {
printf("pt_writemap: mismatch: "); printf("pt_writemap: mismatch: ");
@ -1377,7 +1378,7 @@ int pt_mapkernel(pt_t *pt)
pt->pt_dir[kern_pde] = (addr & ARCH_VM_PDE_MASK) pt->pt_dir[kern_pde] = (addr & ARCH_VM_PDE_MASK)
| ARM_VM_SECTION | ARM_VM_SECTION
| ARM_VM_SECTION_DOMAIN | ARM_VM_SECTION_DOMAIN
| ARM_VM_SECTION_WB | ARM_VM_SECTION_WT
| ARM_VM_SECTION_SUPER; | ARM_VM_SECTION_SUPER;
#endif #endif
kern_pde++; kern_pde++;
@ -1412,8 +1413,7 @@ int pt_mapkernel(pt_t *pt)
assert(!pt->pt_dir[map_pde]); assert(!pt->pt_dir[map_pde]);
pt->pt_dir[map_pde] = addr | pt->pt_dir[map_pde] = addr |
ARM_VM_SECTION | ARM_VM_SECTION_DOMAIN | ARM_VM_SECTION | ARM_VM_SECTION_DOMAIN |
ARM_VM_SECTION_WB | ARM_VM_SECTION_DEVICE |
ARM_VM_SECTION_SHAREABLE |
ARM_VM_SECTION_SUPER; ARM_VM_SECTION_SUPER;
addr += ARCH_BIG_PAGE_SIZE; addr += ARCH_BIG_PAGE_SIZE;
} }

View File

@ -270,7 +270,8 @@ int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
#if defined(__arm__) #if defined(__arm__)
if (pb->phys >= 0x80000000 && pb->phys < (0xc0000000 - VM_PAGE_SIZE)) { if (pb->phys >= 0x80000000 && pb->phys < (0xc0000000 - VM_PAGE_SIZE)) {
// LSC Do this only for actual RAM // 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 #endif