Skip to content

Commit

Permalink
sh: Use more aggressive dcache purging in kmap teardown.
Browse files Browse the repository at this point in the history
This fixes up a number of outstanding issues observed with old mappings
on the same colour hanging around. This requires some more optimal
handling, but is a safe fallback until all of the corner cases have been
handled.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed Sep 8, 2009
1 parent 0906a3a commit 6e4154d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 6 additions & 5 deletions arch/sh/mm/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void copy_user_highpage(struct page *to, struct page *from,
}

if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
__flush_wback_region(vto, PAGE_SIZE);
__flush_purge_region(vto, PAGE_SIZE);

kunmap_atomic(vto, KM_USER1);
/* Make sure this page is cleared on other CPU's too before using it */
Expand All @@ -112,7 +112,7 @@ void clear_user_highpage(struct page *page, unsigned long vaddr)
clear_page(kaddr);

if (pages_do_alias((unsigned long)kaddr, vaddr & PAGE_MASK))
__flush_wback_region(kaddr, PAGE_SIZE);
__flush_purge_region(kaddr, PAGE_SIZE);

kunmap_atomic(kaddr, KM_USER0);
}
Expand All @@ -134,7 +134,7 @@ void __update_cache(struct vm_area_struct *vma,
unsigned long addr = (unsigned long)page_address(page);

if (pages_do_alias(addr, address & PAGE_MASK))
__flush_wback_region((void *)addr, PAGE_SIZE);
__flush_purge_region((void *)addr, PAGE_SIZE);
}
}
}
Expand All @@ -149,10 +149,11 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr)
void *kaddr;

kaddr = kmap_coherent(page, vmaddr);
__flush_wback_region((void *)kaddr, PAGE_SIZE);
/* XXX.. For now kunmap_coherent() does a purge */
/* __flush_purge_region((void *)kaddr, PAGE_SIZE); */
kunmap_coherent(kaddr);
} else
__flush_wback_region((void *)addr, PAGE_SIZE);
__flush_purge_region((void *)addr, PAGE_SIZE);
}
}

Expand Down
3 changes: 3 additions & 0 deletions arch/sh/mm/kmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ void kunmap_coherent(void *kvaddr)
unsigned long vaddr = (unsigned long)kvaddr & PAGE_MASK;
enum fixed_addresses idx = __virt_to_fix(vaddr);

/* XXX.. Kill this later, here for sanity at the moment.. */
__flush_purge_region((void *)vaddr, PAGE_SIZE);

pte_clear(&init_mm, vaddr, kmap_coherent_pte - idx);
local_flush_tlb_one(get_asid(), vaddr);
}
Expand Down

0 comments on commit 6e4154d

Please sign in to comment.