aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/proc-v7-2level.S
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2011-05-31 10:38:43 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2012-04-17 10:29:21 -0400
commit3c5f7e7b4a0346de670b08f595bd15e7eec91f97 (patch)
treeab49b3cd2cc56f83f569350c0dd2a2499de80a09 /arch/arm/mm/proc-v7-2level.S
parente816b57a337ea3b755de72bec38c10c864f23015 (diff)
ARM: Use TTBR1 instead of reserved context ID
On ARMv7 CPUs that cache first level page table entries (like the Cortex-A15), using a reserved ASID while changing the TTBR or flushing the TLB is unsafe. This is because the CPU may cache the first level entry as the result of a speculative memory access while the reserved ASID is assigned. After the process owning the page tables dies, the memory will be reallocated and may be written with junk values which can be interpreted as global, valid PTEs by the processor. This will result in the TLB being populated with bogus global entries. This patch avoids the use of a reserved context ID in the v7 switch_mm and ASID rollover code by temporarily using the swapper_pg_dir pointed at by TTBR1, which contains only global entries that are not tagged with ASIDs. Reviewed-by: Frank Rowand <frank.rowand@am.sony.com> Tested-by: Marc Zyngier <Marc.Zyngier@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> [catalin.marinas@arm.com: add LPAE support] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/mm/proc-v7-2level.S')
-rw-r--r--arch/arm/mm/proc-v7-2level.S10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index 3a4b3e7b888c..72270482a922 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -46,18 +46,16 @@ ENTRY(cpu_v7_switch_mm)
46#ifdef CONFIG_ARM_ERRATA_430973 46#ifdef CONFIG_ARM_ERRATA_430973
47 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB 47 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
48#endif 48#endif
49#ifdef CONFIG_ARM_ERRATA_754322 49 mrc p15, 0, r2, c2, c0, 1 @ load TTB 1
50 dsb 50 mcr p15, 0, r2, c2, c0, 0 @ into TTB 0
51#endif
52 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID
53 isb
541: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
55 isb 51 isb
56#ifdef CONFIG_ARM_ERRATA_754322 52#ifdef CONFIG_ARM_ERRATA_754322
57 dsb 53 dsb
58#endif 54#endif
59 mcr p15, 0, r1, c13, c0, 1 @ set context ID 55 mcr p15, 0, r1, c13, c0, 1 @ set context ID
60 isb 56 isb
57 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
58 isb
61#endif 59#endif
62 mov pc, lr 60 mov pc, lr
63ENDPROC(cpu_v7_switch_mm) 61ENDPROC(cpu_v7_switch_mm)