diff options
author | Will Deacon <will.deacon@arm.com> | 2013-02-28 11:48:40 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-03-03 17:54:16 -0500 |
commit | 89c7e4b8bbb3d4fa52df5746a8ad38e610143651 (patch) | |
tree | f6d3d835f5fca88fd4de01f166d782f16c2fe3c9 | |
parent | 862c588f062fe9339a180cf6429e4df1855c376a (diff) |
ARM: 7661/1: mm: perform explicit branch predictor maintenance when required
The ARM ARM requires branch predictor maintenance if, for a given ASID,
the instructions at a specific virtual address appear to change.
From the kernel's point of view, that means:
- Changing the kernel's view of memory (e.g. switching to the
identity map)
- ASID rollover (since ASIDs will be re-allocated to new tasks)
This patch adds explicit branch predictor maintenance when either of the
two conditions above are met.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/smp.c | 1 | ||||
-rw-r--r-- | arch/arm/kernel/suspend.c | 1 | ||||
-rw-r--r-- | arch/arm/mm/context.c | 4 | ||||
-rw-r--r-- | arch/arm/mm/idmap.c | 1 |
4 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 1bdfd87c8e41..31644f1978d5 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -285,6 +285,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void) | |||
285 | * switch away from it before attempting any exclusive accesses. | 285 | * switch away from it before attempting any exclusive accesses. |
286 | */ | 286 | */ |
287 | cpu_switch_mm(mm->pgd, mm); | 287 | cpu_switch_mm(mm->pgd, mm); |
288 | local_flush_bp_all(); | ||
288 | enter_lazy_tlb(mm, current); | 289 | enter_lazy_tlb(mm, current); |
289 | local_flush_tlb_all(); | 290 | local_flush_tlb_all(); |
290 | 291 | ||
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c index 358bca3a995e..c59c97ea8268 100644 --- a/arch/arm/kernel/suspend.c +++ b/arch/arm/kernel/suspend.c | |||
@@ -68,6 +68,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)) | |||
68 | ret = __cpu_suspend(arg, fn); | 68 | ret = __cpu_suspend(arg, fn); |
69 | if (ret == 0) { | 69 | if (ret == 0) { |
70 | cpu_switch_mm(mm->pgd, mm); | 70 | cpu_switch_mm(mm->pgd, mm); |
71 | local_flush_bp_all(); | ||
71 | local_flush_tlb_all(); | 72 | local_flush_tlb_all(); |
72 | } | 73 | } |
73 | 74 | ||
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c index 44d4ee52f3e2..a5a4b2bc42ba 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c | |||
@@ -212,8 +212,10 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) | |||
212 | atomic64_set(&mm->context.id, asid); | 212 | atomic64_set(&mm->context.id, asid); |
213 | } | 213 | } |
214 | 214 | ||
215 | if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) | 215 | if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { |
216 | local_flush_bp_all(); | ||
216 | local_flush_tlb_all(); | 217 | local_flush_tlb_all(); |
218 | } | ||
217 | 219 | ||
218 | atomic64_set(&per_cpu(active_asids, cpu), asid); | 220 | atomic64_set(&per_cpu(active_asids, cpu), asid); |
219 | cpumask_set_cpu(cpu, mm_cpumask(mm)); | 221 | cpumask_set_cpu(cpu, mm_cpumask(mm)); |
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index 2dffc010cc41..5ee505c937d1 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c | |||
@@ -141,6 +141,7 @@ void setup_mm_for_reboot(void) | |||
141 | { | 141 | { |
142 | /* Switch to the identity mapping. */ | 142 | /* Switch to the identity mapping. */ |
143 | cpu_switch_mm(idmap_pgd, &init_mm); | 143 | cpu_switch_mm(idmap_pgd, &init_mm); |
144 | local_flush_bp_all(); | ||
144 | 145 | ||
145 | #ifdef CONFIG_CPU_HAS_ASID | 146 | #ifdef CONFIG_CPU_HAS_ASID |
146 | /* | 147 | /* |