hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/arm/include/asm/mmu_context.h
....@@ -14,6 +14,7 @@
1414 #include <linux/sched.h>
1515 #include <linux/mm_types.h>
1616 #include <linux/preempt.h>
17
+#include <linux/irq_pipeline.h>
1718
1819 #include <asm/cacheflush.h>
1920 #include <asm/cachetype.h>
....@@ -72,6 +73,7 @@
7273 static inline void finish_arch_post_lock_switch(void)
7374 {
7475 struct mm_struct *mm = current->mm;
76
+ unsigned long flags;
7577
7678 if (mm && mm->context.switch_pending) {
7779 /*
....@@ -83,7 +85,9 @@
8385 preempt_disable();
8486 if (mm->context.switch_pending) {
8587 mm->context.switch_pending = 0;
88
+ protect_inband_mm(flags);
8689 cpu_switch_mm(mm->pgd, mm);
90
+ unprotect_inband_mm(flags);
8791 }
8892 preempt_enable_no_resched();
8993 }
....@@ -102,7 +106,7 @@
102106 #endif /* CONFIG_CPU_HAS_ASID */
103107
104108 #define destroy_context(mm) do { } while(0)
105
-#define activate_mm(prev,next) switch_mm(prev, next, NULL)
109
+#define activate_mm(prev,next) __switch_mm(prev, next, NULL)
106110
107111 /*
108112 * This is called when "tsk" is about to enter lazy TLB mode.
....@@ -118,15 +122,9 @@
118122 {
119123 }
120124
121
-/*
122
- * This is the actual mm switch as far as the scheduler
123
- * is concerned. No registers are touched. We avoid
124
- * calling the CPU specific function when the mm hasn't
125
- * actually changed.
126
- */
127125 static inline void
128
-switch_mm(struct mm_struct *prev, struct mm_struct *next,
129
- struct task_struct *tsk)
126
+__switch_mm(struct mm_struct *prev, struct mm_struct *next,
127
+ struct task_struct *tsk)
130128 {
131129 #ifdef CONFIG_MMU
132130 unsigned int cpu = smp_processor_id();
....@@ -149,6 +147,30 @@
149147 #endif
150148 }
151149
150
+/*
151
+ * This is the actual mm switch as far as the scheduler
152
+ * is concerned. No registers are touched. We avoid
153
+ * calling the CPU specific function when the mm hasn't
154
+ * actually changed.
155
+ */
156
+static inline void
157
+switch_mm(struct mm_struct *prev, struct mm_struct *next,
158
+ struct task_struct *tsk)
159
+{
160
+ unsigned long flags;
161
+
162
+ protect_inband_mm(flags);
163
+ __switch_mm(prev, next, tsk);
164
+ unprotect_inband_mm(flags);
165
+}
166
+
152167 #define deactivate_mm(tsk,mm) do { } while (0)
153168
169
+static inline void
170
+switch_oob_mm(struct mm_struct *prev, struct mm_struct *next,
171
+ struct task_struct *tsk)
172
+{
173
+ __switch_mm(prev, next, tsk);
174
+}
175
+
154176 #endif