]> git.karo-electronics.de Git - karo-tx-linux.git/commit
KVM: PPC: Book3S HV: Handle unexpected traps in guest entry/exit code better
authorPaul Mackerras <paulus@ozlabs.org>
Thu, 12 Nov 2015 05:43:48 +0000 (16:43 +1100)
committerPaul Mackerras <paulus@samba.org>
Wed, 9 Dec 2015 04:46:14 +0000 (15:46 +1100)
commit1c9e3d51d5410acbc4fad70d59370ec2f13c6748
treea6fdf31e3bb92315edcf235641f4fc1532fbdbca
parent460146348518a1c4e810d01baf81847f8c6a1c73
KVM: PPC: Book3S HV: Handle unexpected traps in guest entry/exit code better

As we saw with the TM Bad Thing type of program interrupt occurring
on the hrfid that enters the guest, it is not completely impossible
to have a trap occurring in the guest entry/exit code, despite the
fact that the code has been written to avoid taking any traps.

This adds a check in the kvmppc_handle_exit_hv() function to detect
the case when a trap has occurred in the hypervisor-mode code, and
instead of treating it just like a trap in guest code, we now print
a message and return to userspace with a KVM_EXIT_INTERNAL_ERROR
exit reason.

Of the various interrupts that get handled in the assembly code in
the guest exit path and that can return directly to the guest, the
only one that can occur when MSR.HV=1 and MSR.EE=0 is machine check
(other than system call, which we can avoid just by not doing a sc
instruction).  Therefore this adds code to the machine check path to
ensure that if the MCE occurred in hypervisor mode, we exit to the
host rather than trying to continue the guest.

Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S