]> asedeno.scripts.mit.edu Git - linux.git/commit
KVM: MIPS/TLB: Fix off-by-one in TLB invalidate
authorJames Hogan <james.hogan@imgtec.com>
Fri, 7 Oct 2016 21:01:05 +0000 (22:01 +0100)
committerJames Hogan <james.hogan@imgtec.com>
Fri, 3 Feb 2017 15:20:53 +0000 (15:20 +0000)
commitf3a8603f098fd2c68311d945a6531d1e3b62271c
treed1220ae25501292494c3954e2b45eb1b22afd642
parenta7cfa7ac1236937dac431845596a39ba27364a00
KVM: MIPS/TLB: Fix off-by-one in TLB invalidate

kvm_mips_host_tlb_inv() uses the TLBP instruction to probe the host TLB
for an entry matching the given guest virtual address, and determines
whether a match was found based on whether CP0_Index > 0. This is
technically incorrect as an index of 0 (with the high bit clear) is a
perfectly valid TLB index.

This is harmless at the moment due to the use of at least 1 wired TLB
entry for the KVM commpage, however we will soon be ridding ourselves of
that particular wired entry so lets fix the condition in case the entry
needing invalidation does land at TLB index 0.

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: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
arch/mips/kvm/tlb.c