linux_dsm_epyc7002/arch/mips/kvm
James Hogan 797179bc4f MIPS: KVM: Fix modular KVM under QEMU
Copy __kvm_mips_vcpu_run() into unmapped memory, so that we can never
get a TLB refill exception in it when KVM is built as a module.

This was observed to happen with the host MIPS kernel running under
QEMU, due to a not entirely transparent optimisation in the QEMU TLB
handling where TLB entries replaced with TLBWR are copied to a separate
part of the TLB array. Code in those pages continue to be executable,
but those mappings persist only until the next ASID switch, even if they
are marked global.

An ASID switch happens in __kvm_mips_vcpu_run() at exception level after
switching to the guest exception base. Subsequent TLB mapped kernel
instructions just prior to switching to the guest trigger a TLB refill
exception, which enters the guest exception handlers without updating
EPC. This appears as a guest triggered TLB refill on a host kernel
mapped (host KSeg2) address, which is not handled correctly as user
(guest) mode accesses to kernel (host) segments always generate address
error exceptions.

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: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 3.10.x-
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-06-14 10:59:44 +02:00
..
00README.txt KVM/MIPS32: Release notes and KVM module Makefile 2013-05-08 03:55:35 +02:00
callback.c MIPS: KVM: Convert EXPORT_SYMBOL to _GPL 2016-01-24 03:13:24 +01:00
commpage.c MIPS: KVM: Skip memory cleaning in kvm_mips_commpage_init() 2014-06-30 16:52:03 +02:00
commpage.h MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
dyntrans.c MIPS: KVM: Refactor added offsetof()s 2016-01-24 03:14:15 +01:00
emulate.c Small release overall. 2016-05-19 11:27:09 -07:00
fpu.S MIPS: KVM: Add base guest FPU support 2015-03-27 21:25:14 +00:00
interrupt.c MIPS: Move Cause.ExcCode trap codes to mipsregs.h 2016-01-24 03:15:51 +01:00
interrupt.h MIPS: KVM: Fix modular KVM under QEMU 2016-06-14 10:59:44 +02:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
locore.S MIPS: KVM: Fix modular KVM under QEMU 2016-06-14 10:59:44 +02:00
Makefile MIPS: KVM: Add base guest MSA support 2015-03-27 21:25:19 +00:00
mips.c MIPS: KVM: Fix modular KVM under QEMU 2016-06-14 10:59:44 +02:00
msa.S MIPS: KVM: Add base guest MSA support 2015-03-27 21:25:19 +00:00
stats.c MIPS: KVM: Add MSA exception handling 2015-03-27 21:25:20 +00:00
tlb.c Small release overall. 2016-05-19 11:27:09 -07:00
trace.h KVM: MIPS: Fix trace event to save PC directly 2015-03-02 19:17:52 -03:00
trap_emul.c Small release overall. 2016-05-19 11:27:09 -07:00