diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-09-20 22:55:03 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2007-09-20 22:57:55 -0400 |
commit | d04a0f79f502a87bb17b147afc4b3e39e75275c3 (patch) | |
tree | 9fcd7244769316e22ce54e11bd0b80f544b30f90 /arch/sh/mm | |
parent | db2504966ceb9f08557b6ea3ab7e367016fcaba9 (diff) |
sh: Fix up extended mode TLB for SH-X2+ cores.
The extended mode TLB requires both 64-bit PTEs and a 64-bit pgprot,
correspondingly, the PGD also has to be 64-bits, so fix that up.
The kernel and user permission bits really are decoupled in early
cuts of the silicon, which means that we also have to set corresponding
kernel permissions on user pages or we end up with user pages that the
kernel simply can't touch (!).
Finally, with those things corrected, really enable MMUCR.ME and
correct the PTEA value (this simply needs to be the upper 32-bits
of the PTE, with the size and protection bit encoding).
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/tlb-sh4.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c index 13fde8cc7179..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 | ||
@@ -62,12 +49,22 @@ void update_mmu_cache(struct vm_area_struct * vma, | |||
62 | vpn = (address & MMU_VPN_MASK) | get_asid(); | 49 | vpn = (address & MMU_VPN_MASK) | get_asid(); |
63 | ctrl_outl(vpn, MMU_PTEH); | 50 | ctrl_outl(vpn, MMU_PTEH); |
64 | 51 | ||
65 | pteval = pte_val(pte); | 52 | pteval = pte.pte_low; |
66 | 53 | ||
67 | /* 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 | ||
68 | if (cpu_data->flags & CPU_HAS_PTEA) | 64 | if (cpu_data->flags & CPU_HAS_PTEA) |
69 | /* TODO: make this look less hacky */ | 65 | /* TODO: make this look less hacky */ |
70 | ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA); | 66 | ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA); |
67 | #endif | ||
71 | 68 | ||
72 | /* Set PTEL register */ | 69 | /* Set PTEL register */ |
73 | pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ | 70 | pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ |
@@ -98,4 +95,3 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page) | |||
98 | ctrl_outl(data, addr); | 95 | ctrl_outl(data, addr); |
99 | back_to_P1(); | 96 | back_to_P1(); |
100 | } | 97 | } |
101 | |||