Skip to content

Commit

Permalink
powerpc: Only do ERAT invalidate on radix context switch on P9 DD1
Browse files Browse the repository at this point in the history
BugLink: http://bugs.launchpad.net/bugs/1700819

On P9 (Nimbus) DD2 and later, in radix mode, the move to the PID
register will implicitly invalidate the user space ERAT entries
and leave the kernel ones alone. Thus the only thing needed is
an isync() to synchronize this with subsequent uaccess's

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 74e27c6 linux-next)
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
  • Loading branch information
Benjamin Herrenschmidt authored and Seth Forshee committed Jul 3, 2017
1 parent 41dd1e6 commit 32241e8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arch/powerpc/mm/mmu_context_book3s64.c
Original file line number Diff line number Diff line change
@@ -235,10 +235,15 @@ void destroy_context(struct mm_struct *mm)
#ifdef CONFIG_PPC_RADIX_MMU
void radix__switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
{
asm volatile("isync": : :"memory");
mtspr(SPRN_PID, next->context.id);
asm volatile("isync \n"
PPC_SLBIA(0x7)
: : :"memory");

if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
isync();
mtspr(SPRN_PID, next->context.id);
isync();
asm volatile(PPC_INVALIDATE_ERAT : : :"memory");
} else {
mtspr(SPRN_PID, next->context.id);
isync();
}
}
#endif

0 comments on commit 32241e8

Please sign in to comment.