summaryrefslogtreecommitdiff
path: root/arch/sh/mm/pg-mmu.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-07-29 00:12:17 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-07-29 00:12:17 +0900
commit9cef7492696a416663b4edb953a4eade8517ebeb (patch)
treee52b19208a2197a624a7942e6c549d274a944fb0 /arch/sh/mm/pg-mmu.c
parent0dfae7d5a21901b28ec0452d71be64adf5ea323e (diff)
downloadlwn-9cef7492696a416663b4edb953a4eade8517ebeb.tar.gz
lwn-9cef7492696a416663b4edb953a4eade8517ebeb.zip
sh: update_mmu_cache() consolidation.
This splits out a separate __update_cache()/__update_tlb() for update_mmu_cache() to wrap in to. This lets us share the common __update_cache() bits while keeping special __update_tlb() handling broken out. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm/pg-mmu.c')
-rw-r--r--arch/sh/mm/pg-mmu.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/sh/mm/pg-mmu.c b/arch/sh/mm/pg-mmu.c
index 356d2cdcb209..8602f68af4c8 100644
--- a/arch/sh/mm/pg-mmu.c
+++ b/arch/sh/mm/pg-mmu.c
@@ -134,3 +134,24 @@ void clear_user_highpage(struct page *page, unsigned long vaddr)
kunmap_atomic(kaddr, KM_USER0);
}
EXPORT_SYMBOL(clear_user_highpage);
+
+void __update_cache(struct vm_area_struct *vma,
+ unsigned long address, pte_t pte)
+{
+ struct page *page;
+ unsigned long pfn = pte_pfn(pte);
+
+ if (!boot_cpu_data.dcache.n_aliases)
+ return;
+
+ page = pfn_to_page(pfn);
+ if (pfn_valid(pfn) && page_mapping(page)) {
+ int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
+ if (dirty) {
+ unsigned long addr = (unsigned long)page_address(page);
+
+ if (pages_do_alias(addr, address & PAGE_MASK))
+ __flush_wback_region((void *)addr, PAGE_SIZE);
+ }
+ }
+}