ARM: 6943/1: mm: use TTBR1 instead of reserved context ID
commit52af9c6cd863fe37d1103035ec7ee22ac1296458
authorWill Deacon <will.deacon@arm.com>
Thu, 26 May 2011 10:23:43 +0000 (26 11:23 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 26 May 2011 11:14:33 +0000 (26 12:14 +0100)
treefd6b4e6d7b3bc2881422fb5e735c5b9eda62662a
parentd427958a46af24f75d0017c45eadd172273bbf33
ARM: 6943/1: mm: 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.

Acked-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>
arch/arm/mm/context.c
arch/arm/mm/proc-v7.S