diff options
Diffstat (limited to 'arch/arm64/include/asm/mmu_context.h')
-rw-r--r-- | arch/arm64/include/asm/mmu_context.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index e53d30c6f779..5c1b168a3c22 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h | |||
@@ -59,6 +59,13 @@ static inline void cpu_set_reserved_ttbr0(void) | |||
59 | : "r" (ttbr)); | 59 | : "r" (ttbr)); |
60 | } | 60 | } |
61 | 61 | ||
62 | static inline void cpu_switch_mm(pgd_t *pgd, struct mm_struct *mm) | ||
63 | { | ||
64 | BUG_ON(pgd == swapper_pg_dir); | ||
65 | cpu_set_reserved_ttbr0(); | ||
66 | cpu_do_switch_mm(virt_to_phys(pgd),mm); | ||
67 | } | ||
68 | |||
62 | /* | 69 | /* |
63 | * TCR.T0SZ value to use when the ID map is active. Usually equals | 70 | * TCR.T0SZ value to use when the ID map is active. Usually equals |
64 | * TCR_T0SZ(VA_BITS), unless system RAM is positioned very high in | 71 | * TCR_T0SZ(VA_BITS), unless system RAM is positioned very high in |
@@ -179,9 +186,10 @@ static inline void update_saved_ttbr0(struct task_struct *tsk, | |||
179 | struct mm_struct *mm) | 186 | struct mm_struct *mm) |
180 | { | 187 | { |
181 | if (system_uses_ttbr0_pan()) { | 188 | if (system_uses_ttbr0_pan()) { |
189 | u64 ttbr; | ||
182 | BUG_ON(mm->pgd == swapper_pg_dir); | 190 | BUG_ON(mm->pgd == swapper_pg_dir); |
183 | task_thread_info(tsk)->ttbr0 = | 191 | ttbr = virt_to_phys(mm->pgd) | ASID(mm) << 48; |
184 | virt_to_phys(mm->pgd) | ASID(mm) << 48; | 192 | WRITE_ONCE(task_thread_info(tsk)->ttbr0, ttbr); |
185 | } | 193 | } |
186 | } | 194 | } |
187 | #else | 195 | #else |
@@ -228,4 +236,6 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
228 | #define deactivate_mm(tsk,mm) do { } while (0) | 236 | #define deactivate_mm(tsk,mm) do { } while (0) |
229 | #define activate_mm(prev,next) switch_mm(prev, next, current) | 237 | #define activate_mm(prev,next) switch_mm(prev, next, current) |
230 | 238 | ||
239 | void post_ttbr_update_workaround(void); | ||
240 | |||
231 | #endif | 241 | #endif |