| .. | .. |
|---|
| 15 | 15 | #include <linux/sched/hotplug.h> |
|---|
| 16 | 16 | #include <linux/mm_types.h> |
|---|
| 17 | 17 | #include <linux/pgtable.h> |
|---|
| 18 | +#include <linux/irq_pipeline.h> |
|---|
| 18 | 19 | |
|---|
| 19 | 20 | #include <asm/cacheflush.h> |
|---|
| 20 | 21 | #include <asm/cpufeature.h> |
|---|
| .. | .. |
|---|
| 112 | 113 | static inline void cpu_uninstall_idmap(void) |
|---|
| 113 | 114 | { |
|---|
| 114 | 115 | struct mm_struct *mm = current->active_mm; |
|---|
| 116 | + unsigned long flags; |
|---|
| 117 | + |
|---|
| 118 | + flags = hard_cond_local_irq_save(); |
|---|
| 115 | 119 | |
|---|
| 116 | 120 | cpu_set_reserved_ttbr0(); |
|---|
| 117 | 121 | local_flush_tlb_all(); |
|---|
| .. | .. |
|---|
| 119 | 123 | |
|---|
| 120 | 124 | if (mm != &init_mm && !system_uses_ttbr0_pan()) |
|---|
| 121 | 125 | cpu_switch_mm(mm->pgd, mm); |
|---|
| 126 | + |
|---|
| 127 | + hard_cond_local_irq_restore(flags); |
|---|
| 122 | 128 | } |
|---|
| 123 | 129 | |
|---|
| 124 | 130 | static inline void cpu_install_idmap(void) |
|---|
| 125 | 131 | { |
|---|
| 132 | + unsigned long flags; |
|---|
| 133 | + |
|---|
| 134 | + flags = hard_cond_local_irq_save(); |
|---|
| 135 | + |
|---|
| 126 | 136 | cpu_set_reserved_ttbr0(); |
|---|
| 127 | 137 | local_flush_tlb_all(); |
|---|
| 128 | 138 | cpu_set_idmap_tcr_t0sz(); |
|---|
| 129 | 139 | |
|---|
| 130 | 140 | cpu_switch_mm(lm_alias(idmap_pg_dir), &init_mm); |
|---|
| 141 | + |
|---|
| 142 | + hard_cond_local_irq_restore(flags); |
|---|
| 131 | 143 | } |
|---|
| 132 | 144 | |
|---|
| 133 | 145 | /* |
|---|
| .. | .. |
|---|
| 230 | 242 | } |
|---|
| 231 | 243 | |
|---|
| 232 | 244 | static inline void |
|---|
| 233 | | -switch_mm(struct mm_struct *prev, struct mm_struct *next, |
|---|
| 245 | +do_switch_mm(struct mm_struct *prev, struct mm_struct *next, |
|---|
| 234 | 246 | struct task_struct *tsk) |
|---|
| 235 | 247 | { |
|---|
| 236 | 248 | if (prev != next) |
|---|
| .. | .. |
|---|
| 245 | 257 | update_saved_ttbr0(tsk, next); |
|---|
| 246 | 258 | } |
|---|
| 247 | 259 | |
|---|
| 260 | +static inline void |
|---|
| 261 | +switch_mm(struct mm_struct *prev, struct mm_struct *next, |
|---|
| 262 | + struct task_struct *tsk) |
|---|
| 263 | +{ |
|---|
| 264 | + unsigned long flags; |
|---|
| 265 | + |
|---|
| 266 | + protect_inband_mm(flags); |
|---|
| 267 | + do_switch_mm(prev, next, tsk); |
|---|
| 268 | + unprotect_inband_mm(flags); |
|---|
| 269 | +} |
|---|
| 270 | + |
|---|
| 248 | 271 | #define deactivate_mm(tsk,mm) do { } while (0) |
|---|
| 249 | | -#define activate_mm(prev,next) switch_mm(prev, next, current) |
|---|
| 272 | +#define activate_mm(prev,next) do_switch_mm(prev, next, current) |
|---|
| 273 | + |
|---|
| 274 | +static inline void |
|---|
| 275 | +switch_oob_mm(struct mm_struct *prev, struct mm_struct *next, |
|---|
| 276 | + struct task_struct *tsk) |
|---|
| 277 | +{ |
|---|
| 278 | + do_switch_mm(prev, next, tsk); |
|---|
| 279 | +} |
|---|
| 250 | 280 | |
|---|
| 251 | 281 | static inline const struct cpumask * |
|---|
| 252 | 282 | task_cpu_possible_mask(struct task_struct *p) |
|---|