MIPS: KVM: Use kmap instead of CKSEG0ADDR()
authorJames Hogan <james.hogan@imgtec.com>
Fri, 8 Jul 2016 10:53:22 +0000 (11:53 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Aug 2016 16:42:22 +0000 (18:42 +0200)
commit28cc5bd568745a58bb06291ac336d06b66c66dff
treed8c1dd5dd137177910f127f125e0e402be3ffded
parentcfacaced0cce20859de25b61d672edeb9789a1e9
MIPS: KVM: Use kmap instead of CKSEG0ADDR()

There are several unportable uses of CKSEG0ADDR() in MIPS KVM, which
implicitly assume that a host physical address will be in the low 512MB
of the physical address space (accessible in KSeg0). These assumptions
don't hold for highmem or on 64-bit kernels.

When interpreting the guest physical address when reading or overwriting
a trapping instruction, use kmap_atomic() to get a usable virtual
address to access guest memory, which is portable to 64-bit and highmem
kernels.

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
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/dyntrans.c
arch/mips/kvm/mmu.c