From patchwork Mon Jul 20 23:10:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 36423 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 n6KNAVKf021882 for ; Mon, 20 Jul 2009 23:10:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754327AbZGTXK2 (ORCPT ); Mon, 20 Jul 2009 19:10:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754329AbZGTXK1 (ORCPT ); Mon, 20 Jul 2009 19:10:27 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53381 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753842AbZGTXKT (ORCPT ); Mon, 20 Jul 2009 19:10:19 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6KNAJO1029403; Mon, 20 Jul 2009 19:10:19 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6KNAI5Q002974; Mon, 20 Jul 2009 19:10:19 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6KNAGki028980; Mon, 20 Jul 2009 19:10:18 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: avi@redhat.com, Glauber Costa Subject: [PATCH 5/9] fold second pass of kvm initialization Date: Mon, 20 Jul 2009 19:10:12 -0400 Message-Id: <1248131416-11272-6-git-send-email-glommer@redhat.com> In-Reply-To: <1248131416-11272-5-git-send-email-glommer@redhat.com> References: <1248131416-11272-1-git-send-email-glommer@redhat.com> <1248131416-11272-2-git-send-email-glommer@redhat.com> <1248131416-11272-3-git-send-email-glommer@redhat.com> <1248131416-11272-4-git-send-email-glommer@redhat.com> <1248131416-11272-5-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Glauber Costa There is no reason why kvm_init_ap() and friends are placed outside kvm_init(). After we call kvm_init(), no extra initialization step should be necessary. There are now no references to KVM_UPSTREAM outside of kvm*.c files Signed-off-by: Glauber Costa --- qemu-kvm.c | 20 ++++++++++++++++++++ vl.c | 22 ---------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index c3af59c..26cac25 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -2251,6 +2251,8 @@ int kvm_arch_init_irq_routing(void) } #endif +extern int no_hpet; + static int kvm_create_context() { int r; @@ -2283,6 +2285,24 @@ static int kvm_create_context() return r; } + kvm_init_ap(); + if (kvm_irqchip) { + if (!qemu_kvm_has_gsi_routing()) { + irq0override = 0; +#ifdef TARGET_I386 + /* if kernel can't do irq routing, interrupt source + * override 0->2 can not be set up as required by hpet, + * so disable hpet. + */ + no_hpet=1; + } else if (!qemu_kvm_has_pit_state2()) { + no_hpet=1; + } +#else + } +#endif + } + return 0; } diff --git a/vl.c b/vl.c index ae9e0b4..92ae881 100644 --- a/vl.c +++ b/vl.c @@ -5997,28 +5997,6 @@ int main(int argc, char **argv, char **envp) module_call_init(MODULE_INIT_DEVICE); - if (kvm_enabled()) { - kvm_init_ap(); -#ifdef CONFIG_KVM - if (kvm_irqchip) { - if (!qemu_kvm_has_gsi_routing()) { - irq0override = 0; -#ifdef TARGET_I386 - /* if kernel can't do irq routing, interrupt source - * override 0->2 can not be set up as required by hpet, - * so disable hpet. - */ - no_hpet=1; - } else if (!qemu_kvm_has_pit_state2()) { - no_hpet=1; - } -#else - } -#endif - } -#endif - } - machine->init(ram_size, boot_devices, kernel_filename, kernel_cmdline, initrd_filename, cpu_model);