hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/arm64/include/asm/mmu_context.h
....@@ -15,6 +15,7 @@
1515 #include <linux/sched/hotplug.h>
1616 #include <linux/mm_types.h>
1717 #include <linux/pgtable.h>
18
+#include <linux/irq_pipeline.h>
1819
1920 #include <asm/cacheflush.h>
2021 #include <asm/cpufeature.h>
....@@ -112,6 +113,9 @@
112113 static inline void cpu_uninstall_idmap(void)
113114 {
114115 struct mm_struct *mm = current->active_mm;
116
+ unsigned long flags;
117
+
118
+ flags = hard_cond_local_irq_save();
115119
116120 cpu_set_reserved_ttbr0();
117121 local_flush_tlb_all();
....@@ -119,15 +123,23 @@
119123
120124 if (mm != &init_mm && !system_uses_ttbr0_pan())
121125 cpu_switch_mm(mm->pgd, mm);
126
+
127
+ hard_cond_local_irq_restore(flags);
122128 }
123129
124130 static inline void cpu_install_idmap(void)
125131 {
132
+ unsigned long flags;
133
+
134
+ flags = hard_cond_local_irq_save();
135
+
126136 cpu_set_reserved_ttbr0();
127137 local_flush_tlb_all();
128138 cpu_set_idmap_tcr_t0sz();
129139
130140 cpu_switch_mm(lm_alias(idmap_pg_dir), &init_mm);
141
+
142
+ hard_cond_local_irq_restore(flags);
131143 }
132144
133145 /*
....@@ -230,7 +242,7 @@
230242 }
231243
232244 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,
234246 struct task_struct *tsk)
235247 {
236248 if (prev != next)
....@@ -245,8 +257,26 @@
245257 update_saved_ttbr0(tsk, next);
246258 }
247259
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
+
248271 #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
+}
250280
251281 static inline const struct cpumask *
252282 task_cpu_possible_mask(struct task_struct *p)