diff options
author | David Howells <dhowells@redhat.com> | 2008-02-08 07:19:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:30 -0500 |
commit | b920de1b77b72ca9432ac3f97edb26541e65e5dd (patch) | |
tree | 40fa9be1470e929c47927dea7eddf184c0204229 /arch/mn10300/mm/mmu-context.c | |
parent | ef3d534754f31fed9c3b976fee1ece1b3bc38282 (diff) |
mn10300: add the MN10300/AM33 architecture to the kernel
Add architecture support for the MN10300/AM33 CPUs produced by MEI to the
kernel.
This patch also adds board support for the ASB2303 with the ASB2308 daughter
board, and the ASB2305. The only processor supported is the MN103E010, which
is an AM33v2 core plus on-chip devices.
[akpm@linux-foundation.org: nuke cvs control strings]
Signed-off-by: Masakazu Urade <urade.masakazu@jp.panasonic.com>
Signed-off-by: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mn10300/mm/mmu-context.c')
-rw-r--r-- | arch/mn10300/mm/mmu-context.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/arch/mn10300/mm/mmu-context.c b/arch/mn10300/mm/mmu-context.c new file mode 100644 index 000000000000..31c9d27a75ae --- /dev/null +++ b/arch/mn10300/mm/mmu-context.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* MN10300 MMU context allocation and management | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/mm.h> | ||
13 | #include <asm/mmu_context.h> | ||
14 | #include <asm/tlbflush.h> | ||
15 | |||
16 | /* | ||
17 | * list of the MMU contexts last allocated on each CPU | ||
18 | */ | ||
19 | unsigned long mmu_context_cache[NR_CPUS] = { | ||
20 | [0 ... NR_CPUS - 1] = MMU_CONTEXT_FIRST_VERSION * 2 - 1, | ||
21 | }; | ||
22 | |||
23 | /* | ||
24 | * flush the specified TLB entry | ||
25 | */ | ||
26 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) | ||
27 | { | ||
28 | unsigned long pteu, cnx, flags; | ||
29 | |||
30 | addr &= PAGE_MASK; | ||
31 | |||
32 | /* make sure the context doesn't migrate and defend against | ||
33 | * interference from vmalloc'd regions */ | ||
34 | local_irq_save(flags); | ||
35 | |||
36 | cnx = mm_context(vma->vm_mm); | ||
37 | |||
38 | if (cnx != MMU_NO_CONTEXT) { | ||
39 | pteu = addr | (cnx & 0x000000ffUL); | ||
40 | IPTEU = pteu; | ||
41 | DPTEU = pteu; | ||
42 | if (IPTEL & xPTEL_V) | ||
43 | IPTEL = 0; | ||
44 | if (DPTEL & xPTEL_V) | ||
45 | DPTEL = 0; | ||
46 | } | ||
47 | |||
48 | local_irq_restore(flags); | ||
49 | } | ||
50 | |||
51 | /* | ||
52 | * preemptively set a TLB entry | ||
53 | */ | ||
54 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte) | ||
55 | { | ||
56 | unsigned long pteu, ptel, cnx, flags; | ||
57 | |||
58 | addr &= PAGE_MASK; | ||
59 | ptel = pte_val(pte) & ~(xPTEL_UNUSED1 | xPTEL_UNUSED2); | ||
60 | |||
61 | /* make sure the context doesn't migrate and defend against | ||
62 | * interference from vmalloc'd regions */ | ||
63 | local_irq_save(flags); | ||
64 | |||
65 | cnx = mm_context(vma->vm_mm); | ||
66 | |||
67 | if (cnx != MMU_NO_CONTEXT) { | ||
68 | pteu = addr | (cnx & 0x000000ffUL); | ||
69 | if (!(pte_val(pte) & _PAGE_NX)) { | ||
70 | IPTEU = pteu; | ||
71 | if (IPTEL & xPTEL_V) | ||
72 | IPTEL = ptel; | ||
73 | } | ||
74 | DPTEU = pteu; | ||
75 | if (DPTEL & xPTEL_V) | ||
76 | DPTEL = ptel; | ||
77 | } | ||
78 | |||
79 | local_irq_restore(flags); | ||
80 | } | ||