KVM: PPC: Book3S HV: Make sure we don't re-enter guest without XIVE loaded
authorPaul Mackerras <paulus@ozlabs.org>
Thu, 11 Jan 2018 03:31:43 +0000 (14:31 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Feb 2018 19:23:03 +0000 (20:23 +0100)
commit88b64450cc0a9340145331b2ffefdff15a0f96d3
tree236be293352906dabee2ef5cfbb03cb7faca618d
parentfe90a3a6f88179dfa427a758dbef47cb371b6be7
KVM: PPC: Book3S HV: Make sure we don't re-enter guest without XIVE loaded

commit 43ff3f65234061e08d234bdef5a9aadc19832b74 upstream.

This fixes a bug where it is possible to enter a guest on a POWER9
system without having the XIVE (interrupt controller) context loaded.
This can happen because we unload the XIVE context from the CPU
before doing the real-mode handling for machine checks.  After the
real-mode handler runs, it is possible that we re-enter the guest
via a fast path which does not load the XIVE context.

To fix this, we move the unloading of the XIVE context to come after
the real-mode machine check handler is called.

Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE interrupt controller")
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kvm/book3s_hv_rmhandlers.S