diff options
-rw-r--r-- | arch/blackfin/include/asm/mmu_context.h | 33 |
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 | ||
69 | static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, | 69 | static 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 |
107 | static 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 | |||
99 | static inline void protect_page(struct mm_struct *mm, unsigned long addr, | 116 | static 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 */ | ||
149 | static 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 | ||
133 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | 156 | static 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 |