summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/cpu_setup_power.S
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-07-06 20:51:28 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-07-11 12:53:53 +1000
commit41d0c2ecde19cfe93071ed7b979a53ba60b12840 (patch)
tree53125a7e90771bad98aa47d756a93e4e9fbf91cc /arch/powerpc/kernel/cpu_setup_power.S
parent3a6a04706fd08eb5677fdfc086e26fcd5eb154f4 (diff)
downloadlinux-41d0c2ecde19cfe93071ed7b979a53ba60b12840.tar.gz
linux-41d0c2ecde19cfe93071ed7b979a53ba60b12840.tar.bz2
linux-41d0c2ecde19cfe93071ed7b979a53ba60b12840.zip
powerpc/powernv: Fix local TLB flush for boot and MCE on POWER9
There are two cases outside the normal address space management where a CPU's local TLB is to be flushed: 1. Host boot; in case something has left stale entries in the TLB (e.g., kexec). 2. Machine check; to clean corrupted TLB entries. CPU state restore from deep idle states also flushes the TLB. However this seems to be a side effect of reusing the boot code to set CPU state, rather than a requirement itself. The current flushing has a number of problems with ISA v3.0B: - The current radix mode of the MMU is not taken into account. tlbiel is undefined if the R field does not match the current radix mode. - ISA v3.0B hash must flush the partition and process table caches. - ISA v3.0B radix must flush partition and process scoped translations, partition and process table caches, and also the page walk cache. Add POWER9 cases to handle these, with radix vs hash determined by the host MMU mode. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/cpu_setup_power.S')
-rw-r--r--arch/powerpc/kernel/cpu_setup_power.S13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S
index 10cb2896b2ae..610955fe8b81 100644
--- a/arch/powerpc/kernel/cpu_setup_power.S
+++ b/arch/powerpc/kernel/cpu_setup_power.S
@@ -218,13 +218,20 @@ __init_tlb_power8:
ptesync
1: blr
+/*
+ * Flush the TLB in hash mode. Hash must flush with RIC=2 once for process
+ * and one for partition scope to clear process and partition table entries.
+ */
__init_tlb_power9:
- li r6,POWER9_TLB_SETS_HASH
+ li r6,POWER9_TLB_SETS_HASH - 1
mtctr r6
li r7,0xc00 /* IS field = 0b11 */
+ li r8,0
ptesync
-2: tlbiel r7
- addi r7,r7,0x1000
+ PPC_TLBIEL(7, 8, 2, 1, 0)
+ PPC_TLBIEL(7, 8, 2, 0, 0)
+2: addi r7,r7,0x1000
+ PPC_TLBIEL(7, 8, 0, 0, 0)
bdnz 2b
ptesync
1: blr