aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-xtensa/mmu_context.h
diff options
context:
space:
mode:
authorChris Zankel <chris@zankel.net>2008-11-06 09:40:46 -0500
committerChris Zankel <chris@zankel.net>2008-11-06 13:25:09 -0500
commit367b8112fe2ea5c39a7bb4d263dcdd9b612fae18 (patch)
tree9f3349189718dd2c5678faf0ab38f389786b6925 /include/asm-xtensa/mmu_context.h
parent206ead28377fee86b129637edada8c77816cc0d6 (diff)
xtensa: move headers files to arch/xtensa/include
Move all header files for xtensa to arch/xtensa/include and platform and variant header files to the appropriate arch/xtensa/platforms/ and arch/xtensa/variants/ directories. Moving the files gets also rid of all uses of symlinks in the Makefile. This has been completed already for the majority of the architectures and xtensa is one out of six missing. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'include/asm-xtensa/mmu_context.h')
-rw-r--r--include/asm-xtensa/mmu_context.h136
1 files changed, 0 insertions, 136 deletions
diff --git a/include/asm-xtensa/mmu_context.h b/include/asm-xtensa/mmu_context.h
deleted file mode 100644
index c0fd8e5b4513..000000000000
--- a/include/asm-xtensa/mmu_context.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * include/asm-xtensa/mmu_context.h
3 *
4 * Switch an MMU context.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_MMU_CONTEXT_H
14#define _XTENSA_MMU_CONTEXT_H
15
16#include <linux/stringify.h>
17#include <linux/sched.h>
18
19#include <asm/pgtable.h>
20#include <asm/cacheflush.h>
21#include <asm/tlbflush.h>
22#include <asm-generic/mm_hooks.h>
23
24#define XCHAL_MMU_ASID_BITS 8
25
26#if (XCHAL_HAVE_TLBS != 1)
27# error "Linux must have an MMU!"
28#endif
29
30extern unsigned long asid_cache;
31
32/*
33 * NO_CONTEXT is the invalid ASID value that we don't ever assign to
34 * any user or kernel context.
35 *
36 * 0 invalid
37 * 1 kernel
38 * 2 reserved
39 * 3 reserved
40 * 4...255 available
41 */
42
43#define NO_CONTEXT 0
44#define ASID_USER_FIRST 4
45#define ASID_MASK ((1 << XCHAL_MMU_ASID_BITS) - 1)
46#define ASID_INSERT(x) (0x03020001 | (((x) & ASID_MASK) << 8))
47
48static inline void set_rasid_register (unsigned long val)
49{
50 __asm__ __volatile__ (" wsr %0, "__stringify(RASID)"\n\t"
51 " isync\n" : : "a" (val));
52}
53
54static inline unsigned long get_rasid_register (void)
55{
56 unsigned long tmp;
57 __asm__ __volatile__ (" rsr %0,"__stringify(RASID)"\n\t" : "=a" (tmp));
58 return tmp;
59}
60
61static inline void
62__get_new_mmu_context(struct mm_struct *mm)
63{
64 extern void flush_tlb_all(void);
65 if (! (++asid_cache & ASID_MASK) ) {
66 flush_tlb_all(); /* start new asid cycle */
67 asid_cache += ASID_USER_FIRST;
68 }
69 mm->context = asid_cache;
70}
71
72static inline void
73__load_mmu_context(struct mm_struct *mm)
74{
75 set_rasid_register(ASID_INSERT(mm->context));
76 invalidate_page_directory();
77}
78
79/*
80 * Initialize the context related info for a new mm_struct
81 * instance.
82 */
83
84static inline int
85init_new_context(struct task_struct *tsk, struct mm_struct *mm)
86{
87 mm->context = NO_CONTEXT;
88 return 0;
89}
90
91/*
92 * After we have set current->mm to a new value, this activates
93 * the context for the new mm so we see the new mappings.
94 */
95static inline void
96activate_mm(struct mm_struct *prev, struct mm_struct *next)
97{
98 /* Unconditionally get a new ASID. */
99
100 __get_new_mmu_context(next);
101 __load_mmu_context(next);
102}
103
104
105static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
106 struct task_struct *tsk)
107{
108 unsigned long asid = asid_cache;
109
110 /* Check if our ASID is of an older version and thus invalid */
111
112 if (next->context == NO_CONTEXT || ((next->context^asid) & ~ASID_MASK))
113 __get_new_mmu_context(next);
114
115 __load_mmu_context(next);
116}
117
118#define deactivate_mm(tsk, mm) do { } while(0)
119
120/*
121 * Destroy context related info for an mm_struct that is about
122 * to be put to rest.
123 */
124static inline void destroy_context(struct mm_struct *mm)
125{
126 invalidate_page_directory();
127}
128
129
130static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
131{
132 /* Nothing to do. */
133
134}
135
136#endif /* _XTENSA_MMU_CONTEXT_H */