From patchwork Tue Oct 20 19:15:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 54998 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9KJFbSY016874 for ; Tue, 20 Oct 2009 19:15:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752642AbZJTTPa (ORCPT ); Tue, 20 Oct 2009 15:15:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752455AbZJTTPa (ORCPT ); Tue, 20 Oct 2009 15:15:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9783 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752451AbZJTTPa (ORCPT ); Tue, 20 Oct 2009 15:15:30 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9KJFYK9028484 for ; Tue, 20 Oct 2009 15:15:35 -0400 Received: from localhost.localdomain (vpn-12-46.rdu.redhat.com [10.11.12.46]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9KJFX1B032293; Tue, 20 Oct 2009 15:15:33 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: avi@redhat.com Subject: [PATCH] move hlt exit to arch-specific code, and use upstream version. Date: Tue, 20 Oct 2009 17:15:32 -0200 Message-Id: <1256066132-13801-1-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index c1d0ae9..6573dc5 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -199,6 +199,9 @@ int kvm_arch_run(CPUState *env) r = kvm_handle_tpr_access(env); break; #endif + case KVM_EXIT_HLT: + r = kvm_handle_halt(env); + break; default: r = 1; break; @@ -1377,17 +1380,6 @@ int kvm_arch_init_vcpu(CPUState *cenv) return 0; } -int kvm_arch_halt(CPUState *env) -{ - - if (!((env->interrupt_request & CPU_INTERRUPT_HARD) && - (env->eflags & IF_MASK)) && - !(env->interrupt_request & CPU_INTERRUPT_NMI)) { - env->halted = 1; - } - return 1; -} - void kvm_arch_pre_kvm_run(void *opaque, CPUState *env) { if (!kvm_irqchip_in_kernel()) diff --git a/qemu-kvm.c b/qemu-kvm.c index b8ae4d8..42ead38 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1002,9 +1002,6 @@ int kvm_run(CPUState *env) case KVM_EXIT_MMIO: r = handle_mmio(env); break; - case KVM_EXIT_HLT: - r = kvm_arch_halt(env); - break; case KVM_EXIT_IRQ_WINDOW_OPEN: break; case KVM_EXIT_SHUTDOWN: diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 1cf0dc3..de10ef1 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -761,6 +761,7 @@ int kvm_arch_post_run(CPUState *env, struct kvm_run *run) return 0; } +#endif static int kvm_handle_halt(CPUState *env) { @@ -775,6 +776,7 @@ static int kvm_handle_halt(CPUState *env) return 1; } +#ifdef KVM_UPSTREAM int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run) { int ret = 0;