diff options
author | James Hogan <james.hogan@imgtec.com> | 2017-03-14 06:25:46 -0400 |
---|---|---|
committer | James Hogan <james.hogan@imgtec.com> | 2017-03-28 10:36:17 -0400 |
commit | 1c506c9c104cf01d01a9633ad2e76f15f938c54c (patch) | |
tree | 27df069d8a6e31f4c76f4bfb18790727ae3d50c7 /arch/mips/kvm/tlb.c | |
parent | 4fa9de5a645a9770679032a7eea0604f9a36eaf3 (diff) |
KVM: MIPS/TLB: Handle virtually tagged icaches
When TLB entries are invalidated in the presence of a virtually tagged
icache, such as that found on Octeon CPUs, flush the icache so that we
don't get a reserved instruction exception even though the TLB mapping
is removed.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Diffstat (limited to 'arch/mips/kvm/tlb.c')
-rw-r--r-- | arch/mips/kvm/tlb.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/mips/kvm/tlb.c b/arch/mips/kvm/tlb.c index c215470fdcb0..fbab2f747721 100644 --- a/arch/mips/kvm/tlb.c +++ b/arch/mips/kvm/tlb.c | |||
@@ -185,6 +185,13 @@ int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long va, | |||
185 | 185 | ||
186 | local_irq_restore(flags); | 186 | local_irq_restore(flags); |
187 | 187 | ||
188 | /* | ||
189 | * We don't want to get reserved instruction exceptions for missing tlb | ||
190 | * entries. | ||
191 | */ | ||
192 | if (cpu_has_vtag_icache) | ||
193 | flush_icache_all(); | ||
194 | |||
188 | if (user && idx_user >= 0) | 195 | if (user && idx_user >= 0) |
189 | kvm_debug("%s: Invalidated guest user entryhi %#lx @ idx %d\n", | 196 | kvm_debug("%s: Invalidated guest user entryhi %#lx @ idx %d\n", |
190 | __func__, (va & VPN2_MASK) | | 197 | __func__, (va & VPN2_MASK) | |
@@ -260,6 +267,13 @@ int kvm_vz_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long va) | |||
260 | htw_start(); | 267 | htw_start(); |
261 | local_irq_restore(flags); | 268 | local_irq_restore(flags); |
262 | 269 | ||
270 | /* | ||
271 | * We don't want to get reserved instruction exceptions for missing tlb | ||
272 | * entries. | ||
273 | */ | ||
274 | if (cpu_has_vtag_icache) | ||
275 | flush_icache_all(); | ||
276 | |||
263 | if (idx > 0) | 277 | if (idx > 0) |
264 | kvm_debug("%s: Invalidated root entryhi %#lx @ idx %d\n", | 278 | kvm_debug("%s: Invalidated root entryhi %#lx @ idx %d\n", |
265 | __func__, (va & VPN2_MASK) | | 279 | __func__, (va & VPN2_MASK) | |