aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorPhilippe Gerum <rpm@xenomai.org>2009-10-27 17:05:33 -0400
committerMike Frysinger <vapier@gentoo.org>2009-12-15 00:15:18 -0500
commit4815b883edeb0dd0d1997aae078f18c92da9b6b8 (patch)
tree71836df8403426344cf9d8b219fdcde8a4ba60a2 /arch/blackfin
parent7d4a005c4334be228d36dc04e8b540775d005790 (diff)
Blackfin/ipipe: introduce support for CONFIG_MPU
Signed-off-by: Philippe Gerum <rpm@xenomai.org> Signed-off-by: Li Yi <yi.li@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/include/asm/mmu_context.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h
index 4a3be376ad5b..ae8ef4ffd806 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -66,8 +66,8 @@ activate_l1stack(struct mm_struct *mm, unsigned long sp_base)
66 66
67#define activate_mm(prev, next) switch_mm(prev, next, NULL) 67#define activate_mm(prev, next) switch_mm(prev, next, NULL)
68 68
69static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, 69static inline void __switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
70 struct task_struct *tsk) 70 struct task_struct *tsk)
71{ 71{
72#ifdef CONFIG_MPU 72#ifdef CONFIG_MPU
73 unsigned int cpu = smp_processor_id(); 73 unsigned int cpu = smp_processor_id();
@@ -95,7 +95,24 @@ static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_m
95#endif 95#endif
96} 96}
97 97
98#ifdef CONFIG_IPIPE
99#define lock_mm_switch(flags) local_irq_save_hw_cond(flags)
100#define unlock_mm_switch(flags) local_irq_restore_hw_cond(flags)
101#else
102#define lock_mm_switch(flags) do { (void)(flags); } while (0)
103#define unlock_mm_switch(flags) do { (void)(flags); } while (0)
104#endif /* CONFIG_IPIPE */
105
98#ifdef CONFIG_MPU 106#ifdef CONFIG_MPU
107static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
108 struct task_struct *tsk)
109{
110 unsigned long flags;
111 lock_mm_switch(flags);
112 __switch_mm(prev, next, tsk);
113 unlock_mm_switch(flags);
114}
115
99static inline void protect_page(struct mm_struct *mm, unsigned long addr, 116static inline void protect_page(struct mm_struct *mm, unsigned long addr,
100 unsigned long flags) 117 unsigned long flags)
101{ 118{
@@ -128,6 +145,12 @@ static inline void update_protections(struct mm_struct *mm)
128 set_mask_dcplbs(mm->context.page_rwx_mask, cpu); 145 set_mask_dcplbs(mm->context.page_rwx_mask, cpu);
129 } 146 }
130} 147}
148#else /* !CONFIG_MPU */
149static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
150 struct task_struct *tsk)
151{
152 __switch_mm(prev, next, tsk);
153}
131#endif 154#endif
132 155
133static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 156static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
@@ -173,4 +196,10 @@ static inline void destroy_context(struct mm_struct *mm)
173#endif 196#endif
174} 197}
175 198
199#define ipipe_mm_switch_protect(flags) \
200 local_irq_save_hw_cond(flags)
201
202#define ipipe_mm_switch_unprotect(flags) \
203 local_irq_restore_hw_cond(flags)
204
176#endif 205#endif