[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 17/20] kvm: Align kvm_arch_handle_exit to kvm_cpu
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH v2 17/20] kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changes |
Date: |
Tue, 15 Mar 2011 12:26:28 +0100 |
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 <address@hidden>
CC: Alexander Graf <address@hidden>
---
kvm-all.c | 5 -----
target-i386/kvm.c | 8 ++++----
target-ppc/kvm.c | 8 ++++----
target-s390x/kvm.c | 5 +++++
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index e6ff95c..78e4fbf 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1000,11 +1000,6 @@ int kvm_cpu_exec(CPUState *env)
default:
DPRINTF("kvm_arch_handle_exit\n");
ret = kvm_arch_handle_exit(env, run);
- if (ret == 0) {
- ret = EXCP_INTERRUPT;
- } else if (ret > 0) {
- ret = 0;
- }
break;
}
} while (ret == 0);
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 @@ static int kvm_handle_halt(CPUState *env)
(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 @@ static bool host_supports_vmx(void)
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 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run
*run)
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;
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 6c99a16..593eb98 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -271,7 +271,7 @@ static int kvmppc_handle_halt(CPUState *env)
env->exception_index = EXCP_HLT;
}
- return 1;
+ return 0;
}
/* map dcr access to existing qemu dcr emulation */
@@ -280,7 +280,7 @@ static int kvmppc_handle_dcr_read(CPUState *env, uint32_t
dcrn, uint32_t *data)
if (ppc_dcr_read(env->dcr_env, dcrn, data) < 0)
fprintf(stderr, "Read to unhandled DCR (0x%x)\n", dcrn);
- return 1;
+ return 0;
}
static int kvmppc_handle_dcr_write(CPUState *env, uint32_t dcrn, uint32_t data)
@@ -288,12 +288,12 @@ static int kvmppc_handle_dcr_write(CPUState *env,
uint32_t dcrn, uint32_t data)
if (ppc_dcr_write(env->dcr_env, dcrn, data) < 0)
fprintf(stderr, "Write to unhandled DCR (0x%x)\n", dcrn);
- return 1;
+ return 0;
}
int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
{
- int ret = 0;
+ int ret;
switch (run->exit_reason) {
case KVM_EXIT_DCR:
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index a85ae0f..9123203 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -497,6 +497,11 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run
*run)
break;
}
+ if (ret == 0) {
+ ret = EXCP_INTERRUPT;
+ } else if (ret > 0) {
+ ret = 0;
+ }
return ret;
}
--
1.7.1
- [Qemu-devel] [PATCH v2 12/20] kvm: x86: Synchronize PAT MSR with the kernel, (continued)
- [Qemu-devel] [PATCH v2 12/20] kvm: x86: Synchronize PAT MSR with the kernel, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 03/20] s390: Detect invalid invocations of qemu_ram_free/remap, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 02/20] x86: Unbreak TCG support for hardware breakpoints, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 05/20] Redirect cpu_interrupt to callback handler, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 04/20] Break up user and system cpu_interrupt implementations, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 09/20] kvm: Mark VCPU state dirty on creation, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 16/20] kvm: Rework inner loop of kvm_cpu_exec, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 11/20] x86: Save/restore PAT MSR, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 20/20] Expose thread_id in info cpus, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 14/20] kvm: Keep KVM_RUN return value in separate variable, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 17/20] kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changes,
Jan Kiszka <=
- [Qemu-devel] [PATCH v2 15/20] kvm: Reorder error handling of KVM_RUN, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 13/20] kvm: Consider EXIT_DEBUG unknown without CAP_SET_GUEST_DEBUG, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 19/20] kvm: x86: Push kvm_arch_debug to kvm_arch_handle_exit, Jan Kiszka, 2011/03/15
- [Qemu-devel] [PATCH v2 18/20] kvm: x86: Reorder functions in kvm.c, Jan Kiszka, 2011/03/15
- [Qemu-devel] Re: [PATCH v2 00/20] [uq/master] Patch queue, part V (the rest), Marcelo Tosatti, 2011/03/15