Skip to content

Commit e1a5848

Browse files
wildea01Russell King
authored andcommitted
ARM: 7924/1: mm: don't bother with reserved ttbr0 when running with LPAE
With the new ASID allocation algorithm, active ASIDs at the time of a rollover event will be marked as reserved, so active mm_structs can continue to operate with the same ASID as before. This in turn means that we don't need to worry about allocating a new ASID to an mm that is currently active (installed in TTBR0). Since updating the pgd and ASID is atomic on LPAE systems (by virtue of the two being fields in the same hardware register), we can dispose of the reserved TTBR0 and rely on whatever tables we currently have live. Reviewed-by: Catalin Marinas <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent a472b09 commit e1a5848

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

arch/arm/mm/context.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,21 @@ void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
7878
#endif
7979

8080
#ifdef CONFIG_ARM_LPAE
81-
static void cpu_set_reserved_ttbr0(void)
82-
{
83-
/*
84-
* Set TTBR0 to swapper_pg_dir which contains only global entries. The
85-
* ASID is set to 0.
86-
*/
87-
cpu_set_ttbr(0, __pa(swapper_pg_dir));
88-
isb();
89-
}
81+
/*
82+
* With LPAE, the ASID and page tables are updated atomicly, so there is
83+
* no need for a reserved set of tables (the active ASID tracking prevents
84+
* any issues across a rollover).
85+
*/
86+
#define cpu_set_reserved_ttbr0()
9087
#else
9188
static void cpu_set_reserved_ttbr0(void)
9289
{
9390
u32 ttb;
94-
/* Copy TTBR1 into TTBR0 */
91+
/*
92+
* Copy TTBR1 into TTBR0.
93+
* This points at swapper_pg_dir, which contains only global
94+
* entries so any speculative walks are perfectly safe.
95+
*/
9596
asm volatile(
9697
" mrc p15, 0, %0, c2, c0, 1 @ read TTBR1\n"
9798
" mcr p15, 0, %0, c2, c0, 0 @ set TTBR0\n"

0 commit comments

Comments
 (0)