Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Philippe Gerum and committed by
Mike Frysinger
4815b883 7d4a005c

+31 -2
+31 -2
arch/blackfin/include/asm/mmu_context.h
··· 66 66 67 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, 70 - struct task_struct *tsk) 69 + static inline void __switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, 70 + struct task_struct *tsk) 71 71 { 72 72 #ifdef CONFIG_MPU 73 73 unsigned int cpu = smp_processor_id(); ··· 95 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 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 116 static inline void protect_page(struct mm_struct *mm, unsigned long addr, 100 117 unsigned long flags) 101 118 { ··· 144 127 flush_switched_cplbs(cpu); 145 128 set_mask_dcplbs(mm->context.page_rwx_mask, cpu); 146 129 } 130 + } 131 + #else /* !CONFIG_MPU */ 132 + static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 133 + struct task_struct *tsk) 134 + { 135 + __switch_mm(prev, next, tsk); 147 136 } 148 137 #endif 149 138 ··· 195 172 free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order); 196 173 #endif 197 174 } 175 + 176 + #define ipipe_mm_switch_protect(flags) \ 177 + local_irq_save_hw_cond(flags) 178 + 179 + #define ipipe_mm_switch_unprotect(flags) \ 180 + local_irq_restore_hw_cond(flags) 198 181 199 182 #endif