diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2015-03-23 15:06:50 +0000 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2015-06-30 10:12:22 +0100 |
commit | aa391b91650394364b723137b8ff81f781432362 (patch) | |
tree | 27f8590e48c79f6fce75a3fd3c344ea02081f8c2 | |
parent | 16f1c5c0539c9f47992a3cd17948d2022cd739ce (diff) |
arm64: Use the reserved TTBR0 if context switching to the init_mmlsk-3.10-armlt-cpuidle
The idle_task_exit() function may call switch_mm() with next ==
&init_mm. On arm64, init_mm.pgd cannot be used for user mappings, so
this patch simply sets the reserved TTBR0.
Cc: <stable@vger.kernel.org>
Reported-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Tested-by: Jon Medhurst (Tixy) <tixy@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit e53f21bce4d35a93b23d8fa1a840860f6c74f59e)
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | arch/arm64/include/asm/mmu_context.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index a9eee33dfa62..101a42bde728 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h @@ -151,6 +151,15 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, { unsigned int cpu = smp_processor_id(); + /* + * init_mm.pgd does not contain any user mappings and it is always + * active for kernel addresses in TTBR1. Just set the reserved TTBR0. + */ + if (next == &init_mm) { + cpu_set_reserved_ttbr0(); + return; + } + if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) check_and_switch_context(next, tsk); } |