From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glauber Costa Subject: [PATCH 08/10] use env in kvm_arch_run Date: Fri, 9 Oct 2009 15:03:16 -0300 Message-ID: <1255111398-15251-9-git-send-email-glommer@redhat.com> References: <1255111398-15251-1-git-send-email-glommer@redhat.com> <1255111398-15251-2-git-send-email-glommer@redhat.com> <1255111398-15251-3-git-send-email-glommer@redhat.com> <1255111398-15251-4-git-send-email-glommer@redhat.com> <1255111398-15251-5-git-send-email-glommer@redhat.com> <1255111398-15251-6-git-send-email-glommer@redhat.com> <1255111398-15251-7-git-send-email-glommer@redhat.com> <1255111398-15251-8-git-send-email-glommer@redhat.com> Cc: avi@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28520 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761239AbZJISEB (ORCPT ); Fri, 9 Oct 2009 14:04:01 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n99I3alA009353 for ; Fri, 9 Oct 2009 14:03:36 -0400 In-Reply-To: <1255111398-15251-8-git-send-email-glommer@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: kvm_arch_run() takes a vcpu context parameter, but CPUState should do. Convert it, as well as the functions that it end up calling Signed-off-by: Glauber Costa --- qemu-kvm-x86.c | 12 ++++++------ qemu-kvm.c | 2 +- qemu-kvm.h | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index c5455d7..fffcfd8 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -162,10 +162,10 @@ int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, #ifdef KVM_EXIT_TPR_ACCESS -static int kvm_handle_tpr_access(kvm_vcpu_context_t vcpu) +static int kvm_handle_tpr_access(CPUState *env) { - struct kvm_run *run = vcpu->run; - kvm_tpr_access_report(cpu_single_env, + struct kvm_run *run = env->kvm_run; + kvm_tpr_access_report(env, run->tpr_access.rip, run->tpr_access.is_write); return 0; @@ -190,10 +190,10 @@ int kvm_enable_vapic(kvm_vcpu_context_t vcpu, uint64_t vapic) #endif -int kvm_arch_run(kvm_vcpu_context_t vcpu) +int kvm_arch_run(CPUState *env) { int r = 0; - struct kvm_run *run = vcpu->run; + struct kvm_run *run = env->kvm_run; switch (run->exit_reason) { @@ -203,7 +203,7 @@ int kvm_arch_run(kvm_vcpu_context_t vcpu) #endif #ifdef KVM_EXIT_TPR_ACCESS case KVM_EXIT_TPR_ACCESS: - r = kvm_handle_tpr_access(vcpu); + r = kvm_handle_tpr_access(env); break; #endif default: diff --git a/qemu-kvm.c b/qemu-kvm.c index bd1c0b5..fb50bb4 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1037,7 +1037,7 @@ int kvm_run(kvm_vcpu_context_t vcpu, void *env) abort(); break; default: - if (kvm_arch_run(vcpu)) { + if (kvm_arch_run(env)) { fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason); kvm_show_regs(vcpu); abort(); diff --git a/qemu-kvm.h b/qemu-kvm.h index 28940dd..adb2970 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -93,7 +93,8 @@ int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory, int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, void **vm_mem); -int kvm_arch_run(kvm_vcpu_context_t vcpu); + +int kvm_arch_run(CPUState *env); void kvm_show_code(kvm_vcpu_context_t vcpu); -- 1.6.2.5