[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 18/20] kvm: x86: Reorder functions in kvm.c
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH v2 18/20] kvm: x86: Reorder functions in kvm.c |
Date: |
Tue, 15 Mar 2011 12:26:29 +0100 |
Required for next patch which will access guest debug services from
kvm_arch_handle_exit. No functional changes.
Signed-off-by: Jan Kiszka <address@hidden>
---
target-i386/kvm.c | 108 ++++++++++++++++++++++++++--------------------------
1 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 6f84610..3920444 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1624,60 +1624,6 @@ static int kvm_handle_halt(CPUState *env)
return 0;
}
-static bool host_supports_vmx(void)
-{
- uint32_t ecx, unused;
-
- host_cpuid(1, 0, &unused, &unused, &ecx, &unused);
- return ecx & CPUID_EXT_VMX;
-}
-
-#define VMX_INVALID_GUEST_STATE 0x80000021
-
-int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
-{
- uint64_t code;
- int ret;
-
- switch (run->exit_reason) {
- case KVM_EXIT_HLT:
- DPRINTF("handle_hlt\n");
- ret = kvm_handle_halt(env);
- break;
- case KVM_EXIT_SET_TPR:
- ret = 0;
- break;
- case KVM_EXIT_FAIL_ENTRY:
- code = run->fail_entry.hardware_entry_failure_reason;
- fprintf(stderr, "KVM: entry failed, hardware error 0x%" PRIx64 "\n",
- code);
- if (host_supports_vmx() && code == VMX_INVALID_GUEST_STATE) {
- fprintf(stderr,
- "\nIf you're runnning a guest on an Intel machine without "
- "unrestricted mode\n"
- "support, the failure can be most likely due to the guest "
- "entering an invalid\n"
- "state for Intel VT. For example, the guest maybe running "
- "in big real mode\n"
- "which is not supported on less recent Intel processors."
- "\n\n");
- }
- ret = -1;
- break;
- case KVM_EXIT_EXCEPTION:
- fprintf(stderr, "KVM: exception %d exit (error code 0x%x)\n",
- run->ex.exception, run->ex.error_code);
- ret = -1;
- break;
- default:
- fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
- ret = -1;
- break;
- }
-
- return ret;
-}
-
#ifdef KVM_CAP_SET_GUEST_DEBUG
int kvm_arch_insert_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp)
{
@@ -1860,6 +1806,60 @@ void kvm_arch_update_guest_debug(CPUState *env, struct
kvm_guest_debug *dbg)
}
#endif /* KVM_CAP_SET_GUEST_DEBUG */
+static bool host_supports_vmx(void)
+{
+ uint32_t ecx, unused;
+
+ host_cpuid(1, 0, &unused, &unused, &ecx, &unused);
+ return ecx & CPUID_EXT_VMX;
+}
+
+#define VMX_INVALID_GUEST_STATE 0x80000021
+
+int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
+{
+ uint64_t code;
+ int ret;
+
+ switch (run->exit_reason) {
+ case KVM_EXIT_HLT:
+ DPRINTF("handle_hlt\n");
+ ret = kvm_handle_halt(env);
+ break;
+ case KVM_EXIT_SET_TPR:
+ ret = 0;
+ break;
+ case KVM_EXIT_FAIL_ENTRY:
+ code = run->fail_entry.hardware_entry_failure_reason;
+ fprintf(stderr, "KVM: entry failed, hardware error 0x%" PRIx64 "\n",
+ code);
+ if (host_supports_vmx() && code == VMX_INVALID_GUEST_STATE) {
+ fprintf(stderr,
+ "\nIf you're runnning a guest on an Intel machine without "
+ "unrestricted mode\n"
+ "support, the failure can be most likely due to the guest "
+ "entering an invalid\n"
+ "state for Intel VT. For example, the guest maybe running "
+ "in big real mode\n"
+ "which is not supported on less recent Intel processors."
+ "\n\n");
+ }
+ ret = -1;
+ break;
+ case KVM_EXIT_EXCEPTION:
+ fprintf(stderr, "KVM: exception %d exit (error code 0x%x)\n",
+ run->ex.exception, run->ex.error_code);
+ ret = -1;
+ break;
+ default:
+ fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
+
bool kvm_arch_stop_on_emulation_error(CPUState *env)
{
return !(env->cr[0] & CR0_PE_MASK) ||
--
1.7.1
- [Qemu-devel] [PATCH v2 04/20] Break up user and system cpu_interrupt implementations, (continued)
- [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, 2011/03/15
- [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 <=
- [Qemu-devel] Re: [PATCH v2 00/20] [uq/master] Patch queue, part V (the rest), Marcelo Tosatti, 2011/03/15