]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Invalidate ERAT when flushing guest TLB entries
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>
Thu, 20 Jun 2019 01:46:49 +0000 (11:46 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 20 Jun 2019 12:11:25 +0000 (22:11 +1000)
commit67f5ef9138544a6660206124c6e95f2a83d53994
tree5d4c1a36be51e0969f3287d0e34da3bb408ec50b
parent1a645dd7f5b886307163171b31830ecf478b2fcb
KVM: PPC: Book3S HV: Invalidate ERAT when flushing guest TLB entries

When a guest vcpu moves from one physical thread to another it is
necessary for the host to perform a tlb flush on the previous core if
another vcpu from the same guest is going to run there. This is because the
guest may use the local form of the tlb invalidation instruction meaning
stale tlb entries would persist where it previously ran. This is handled
on guest entry in kvmppc_check_need_tlb_flush() which calls
flush_guest_tlb() to perform the tlb flush.

Previously the generic radix__local_flush_tlb_lpid_guest() function was
used, however the functionality was reimplemented in flush_guest_tlb()
to avoid the trace_tlbie() call as the flushing may be done in real
mode. The reimplementation in flush_guest_tlb() was missing an erat
invalidation after flushing the tlb.

This lead to observable memory corruption in the guest due to the
caching of stale translations. Fix this by adding the erat invalidation.

Fixes: 511897fe7fbb ("KVM: PPC: Book3S HV: Flush TLB on secondary radix threads")
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kvm/book3s_hv_builtin.c