aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@ozlabs.org>2018-05-17 00:47:59 -0400
committerPaul Mackerras <paulus@ozlabs.org>2018-05-17 01:17:13 -0400
commitdf158189dbcc2e0ee29dc4b917d45ee5bf25a35e (patch)
treefc52a0a3e2d718091704ac5cc2f100b964dcfdb4
parent9dc81d6b0f1e3c40bdf97671dd26a24f128e1182 (diff)
KVM: PPC: Book 3S HV: Do ptesync in radix guest exit path
A radix guest can execute tlbie instructions to invalidate TLB entries. After a tlbie or a group of tlbies, it must then do the architected sequence eieio; tlbsync; ptesync to ensure that the TLB invalidation has been processed by all CPUs in the system before it can rely on no CPU using any translation that it just invalidated. In fact it is the ptesync which does the actual synchronization in this sequence, and hardware has a requirement that the ptesync must be executed on the same CPU thread as the tlbies which it is expected to order. Thus, if a vCPU gets moved from one physical CPU to another after it has done some tlbies but before it can get to do the ptesync, the ptesync will not have the desired effect when it is executed on the second physical CPU. To fix this, we do a ptesync in the exit path for radix guests. If there are any pending tlbies, this will wait for them to complete. If there aren't, then ptesync will just do the same as sync. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 25c32e421b57..07ca1b2a7966 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1908,6 +1908,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
1908 cmpwi cr2, r0, 0 1908 cmpwi cr2, r0, 0
1909 beq cr2, 4f 1909 beq cr2, 4f
1910 1910
1911 /*
1912 * Radix: do eieio; tlbsync; ptesync sequence in case we
1913 * interrupted the guest between a tlbie and a ptesync.
1914 */
1915 eieio
1916 tlbsync
1917 ptesync
1918
1911 /* Radix: Handle the case where the guest used an illegal PID */ 1919 /* Radix: Handle the case where the guest used an illegal PID */
1912 LOAD_REG_ADDR(r4, mmu_base_pid) 1920 LOAD_REG_ADDR(r4, mmu_base_pid)
1913 lwz r3, VCPU_GUEST_PID(r9) 1921 lwz r3, VCPU_GUEST_PID(r9)