kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changes
Make the return code of kvm_arch_handle_exit directly usable for
kvm_cpu_exec. This is straightforward for x86 and ppc, just s390
would require more work. Avoid this for now by pushing the return code
translation logic into s390's kvm_arch_handle_exit.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 032bc3e..6f84610 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1618,10 +1618,10 @@
(env->eflags & IF_MASK)) &&
!(env->interrupt_request & CPU_INTERRUPT_NMI)) {
env->halted = 1;
- return 0;
+ return EXCP_HLT;
}
- return 1;
+ return 0;
}
static bool host_supports_vmx(void)
@@ -1637,7 +1637,7 @@
int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
{
uint64_t code;
- int ret = 0;
+ int ret;
switch (run->exit_reason) {
case KVM_EXIT_HLT:
@@ -1645,7 +1645,7 @@
ret = kvm_handle_halt(env);
break;
case KVM_EXIT_SET_TPR:
- ret = 1;
+ ret = 0;
break;
case KVM_EXIT_FAIL_ENTRY:
code = run->fail_entry.hardware_entry_failure_reason;