diff options
Diffstat (limited to 'arch/sh/mm/tlb-sh4.c')
-rw-r--r-- | arch/sh/mm/tlb-sh4.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c index f74cf667c8fa..2d1dd6044307 100644 --- a/arch/sh/mm/tlb-sh4.c +++ b/arch/sh/mm/tlb-sh4.c | |||
@@ -4,27 +4,14 @@ | |||
4 | * SH-4 specific TLB operations | 4 | * SH-4 specific TLB operations |
5 | * | 5 | * |
6 | * Copyright (C) 1999 Niibe Yutaka | 6 | * Copyright (C) 1999 Niibe Yutaka |
7 | * Copyright (C) 2002 Paul Mundt | 7 | * Copyright (C) 2002 - 2007 Paul Mundt |
8 | * | 8 | * |
9 | * Released under the terms of the GNU GPL v2.0. | 9 | * Released under the terms of the GNU GPL v2.0. |
10 | */ | 10 | */ |
11 | #include <linux/signal.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
14 | #include <linux/errno.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/ptrace.h> | ||
18 | #include <linux/mman.h> | ||
19 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
20 | #include <linux/smp.h> | 13 | #include <linux/io.h> |
21 | #include <linux/smp_lock.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | |||
24 | #include <asm/system.h> | 14 | #include <asm/system.h> |
25 | #include <asm/io.h> | ||
26 | #include <asm/uaccess.h> | ||
27 | #include <asm/pgalloc.h> | ||
28 | #include <asm/mmu_context.h> | 15 | #include <asm/mmu_context.h> |
29 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
30 | 17 | ||
@@ -34,22 +21,27 @@ void update_mmu_cache(struct vm_area_struct * vma, | |||
34 | unsigned long flags; | 21 | unsigned long flags; |
35 | unsigned long pteval; | 22 | unsigned long pteval; |
36 | unsigned long vpn; | 23 | unsigned long vpn; |
37 | struct page *page; | ||
38 | unsigned long pfn; | ||
39 | 24 | ||
40 | /* Ptrace may call this routine. */ | 25 | /* Ptrace may call this routine. */ |
41 | if (vma && current->active_mm != vma->vm_mm) | 26 | if (vma && current->active_mm != vma->vm_mm) |
42 | return; | 27 | return; |
43 | 28 | ||
44 | pfn = pte_pfn(pte); | 29 | #ifndef CONFIG_CACHE_OFF |
45 | if (pfn_valid(pfn)) { | 30 | { |
46 | page = pfn_to_page(pfn); | 31 | unsigned long pfn = pte_pfn(pte); |
47 | if (!test_bit(PG_mapped, &page->flags)) { | 32 | |
48 | unsigned long phys = pte_val(pte) & PTE_PHYS_MASK; | 33 | if (pfn_valid(pfn)) { |
49 | __flush_wback_region((void *)P1SEGADDR(phys), PAGE_SIZE); | 34 | struct page *page = pfn_to_page(pfn); |
50 | __set_bit(PG_mapped, &page->flags); | 35 | |
36 | if (!test_bit(PG_mapped, &page->flags)) { | ||
37 | unsigned long phys = pte_val(pte) & PTE_PHYS_MASK; | ||
38 | __flush_wback_region((void *)P1SEGADDR(phys), | ||
39 | PAGE_SIZE); | ||
40 | __set_bit(PG_mapped, &page->flags); | ||
41 | } | ||
51 | } | 42 | } |
52 | } | 43 | } |
44 | #endif | ||
53 | 45 | ||
54 | local_irq_save(flags); | 46 | local_irq_save(flags); |
55 | 47 | ||
@@ -57,16 +49,26 @@ void update_mmu_cache(struct vm_area_struct * vma, | |||
57 | vpn = (address & MMU_VPN_MASK) | get_asid(); | 49 | vpn = (address & MMU_VPN_MASK) | get_asid(); |
58 | ctrl_outl(vpn, MMU_PTEH); | 50 | ctrl_outl(vpn, MMU_PTEH); |
59 | 51 | ||
60 | pteval = pte_val(pte); | 52 | pteval = pte.pte_low; |
61 | 53 | ||
62 | /* Set PTEA register */ | 54 | /* Set PTEA register */ |
55 | #ifdef CONFIG_X2TLB | ||
56 | /* | ||
57 | * For the extended mode TLB this is trivial, only the ESZ and | ||
58 | * EPR bits need to be written out to PTEA, with the remainder of | ||
59 | * the protection bits (with the exception of the compat-mode SZ | ||
60 | * and PR bits, which are cleared) being written out in PTEL. | ||
61 | */ | ||
62 | ctrl_outl(pte.pte_high, MMU_PTEA); | ||
63 | #else | ||
63 | if (cpu_data->flags & CPU_HAS_PTEA) | 64 | if (cpu_data->flags & CPU_HAS_PTEA) |
64 | /* TODO: make this look less hacky */ | 65 | /* TODO: make this look less hacky */ |
65 | ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA); | 66 | ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA); |
67 | #endif | ||
66 | 68 | ||
67 | /* Set PTEL register */ | 69 | /* Set PTEL register */ |
68 | pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ | 70 | pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ |
69 | #ifdef CONFIG_SH_WRITETHROUGH | 71 | #ifdef CONFIG_CACHE_WRITETHROUGH |
70 | pteval |= _PAGE_WT; | 72 | pteval |= _PAGE_WT; |
71 | #endif | 73 | #endif |
72 | /* conveniently, we want all the software flags to be 0 anyway */ | 74 | /* conveniently, we want all the software flags to be 0 anyway */ |
@@ -93,4 +95,3 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page) | |||
93 | ctrl_outl(data, addr); | 95 | ctrl_outl(data, addr); |
94 | back_to_P1(); | 96 | back_to_P1(); |
95 | } | 97 | } |
96 | |||