KVM: PPC: Book3S HV: Fix incorrect userspace exit on ioeventfd write
authorGreg Kurz <gkurz@linux.vnet.ibm.com>
Thu, 6 Feb 2014 16:36:56 +0000 (17:36 +0100)
committerPaul Mackerras <paulus@samba.org>
Wed, 26 Mar 2014 12:33:44 +0000 (23:33 +1100)
commite59d24e61269de34d79d2f39d3d581c219ac7a94
tree3eb55df101db5e8960b03053b21c712ffa3dde90
parente724f080f5dd03881bc6d378750c37f7374cae7e
KVM: PPC: Book3S HV: Fix incorrect userspace exit on ioeventfd write

When the guest does an MMIO write which is handled successfully by an
ioeventfd, ioeventfd_write() returns 0 (success) and
kvmppc_handle_store() returns EMULATE_DONE.  Then
kvmppc_emulate_mmio() converts EMULATE_DONE to RESUME_GUEST_NV and
this causes an exit from the loop in kvmppc_vcpu_run_hv(), causing an
exit back to userspace with a bogus exit reason code, typically
causing userspace (e.g. qemu) to crash with a message about an unknown
exit code.

This adds handling of RESUME_GUEST_NV in kvmppc_vcpu_run_hv() in order
to fix that.  For generality, we define a helper to check for either
of the return-to-guest codes we use, RESUME_GUEST and RESUME_GUEST_NV,
to make it easy to check for either and provide one place to update if
any other return-to-guest code gets defined in future.

Since it only affects Book3S HV for now, the helper is added to
the kvm_book3s.h header file.

We use the helper in two places in kvmppc_run_core() as well for
future-proofing, though we don't see RESUME_GUEST_NV in either place
at present.

[paulus@samba.org - combined 4 patches into one, rewrote description]

Suggested-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/kvm/book3s_hv.c
This page took 0.025072 seconds and 5 git commands to generate.