diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-07-22 06:20:49 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-07-22 06:20:49 -0400 |
commit | 2277ab4a1df50e05bc732fe9488d4e902bb8399a (patch) | |
tree | f41cb47f15e02bbd1f79bf08ef7762d3bba934f6 /arch/sh/mm/tlb-sh4.c | |
parent | c0b96cf639aa1bfa8983f734d4225091aa813e00 (diff) |
sh: Migrate from PG_mapped to PG_dcache_dirty.
This inverts the delayed dcache flush a bit to be more in line with other
platforms. At the same time this also gives us the ability to do some
more optimizations and cleanup. Now that the update_mmu_cache() callsite
only tests for the bit, the implementation can gradually be split out and
made generic, rather than relying on special implementations for each of
the peculiar CPU types.
SH7705 in 32kB mode and SH-4 still need slightly different handling, but
this is something that can remain isolated in the varying page copy/clear
routines. On top of that, SH-X3 is dcache coherent, so there is no need
to bother with any of these tests in the PTEAEX version of
update_mmu_cache(), so we kill that off too.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm/tlb-sh4.c')
-rw-r--r-- | arch/sh/mm/tlb-sh4.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c index f0c7b7397fa6..cf50082d2435 100644 --- a/arch/sh/mm/tlb-sh4.c +++ b/arch/sh/mm/tlb-sh4.c | |||
@@ -21,27 +21,26 @@ void update_mmu_cache(struct vm_area_struct * vma, | |||
21 | unsigned long flags; | 21 | unsigned long flags; |
22 | unsigned long pteval; | 22 | unsigned long pteval; |
23 | unsigned long vpn; | 23 | unsigned long vpn; |
24 | unsigned long pfn = pte_pfn(pte); | ||
25 | struct page *page; | ||
24 | 26 | ||
25 | /* Ptrace may call this routine. */ | 27 | /* Ptrace may call this routine. */ |
26 | if (vma && current->active_mm != vma->vm_mm) | 28 | if (vma && current->active_mm != vma->vm_mm) |
27 | return; | 29 | return; |
28 | 30 | ||
29 | #ifndef CONFIG_CACHE_OFF | 31 | page = pfn_to_page(pfn); |
30 | { | 32 | if (pfn_valid(pfn) && page_mapping(page)) { |
31 | unsigned long pfn = pte_pfn(pte); | 33 | #ifndef CONFIG_SMP |
34 | int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); | ||
35 | if (dirty) { | ||
32 | 36 | ||
33 | if (pfn_valid(pfn)) { | 37 | unsigned long addr = (unsigned long)page_address(page); |
34 | struct page *page = pfn_to_page(pfn); | ||
35 | 38 | ||
36 | if (!test_bit(PG_mapped, &page->flags)) { | 39 | if (pages_do_alias(addr, address & PAGE_MASK)) |
37 | unsigned long phys = pte_val(pte) & PTE_PHYS_MASK; | 40 | __flush_wback_region((void *)addr, PAGE_SIZE); |
38 | __flush_wback_region((void *)P1SEGADDR(phys), | ||
39 | PAGE_SIZE); | ||
40 | __set_bit(PG_mapped, &page->flags); | ||
41 | } | ||
42 | } | 41 | } |
43 | } | ||
44 | #endif | 42 | #endif |
43 | } | ||
45 | 44 | ||
46 | local_irq_save(flags); | 45 | local_irq_save(flags); |
47 | 46 | ||