diff mbox

[5/9] fold second pass of kvm initialization

Message ID 1248131416-11272-6-git-send-email-glommer@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Glauber Costa July 20, 2009, 11:10 p.m. UTC
From: Glauber Costa <glommer@t60.(none)>

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 <glommer@t60.(none)>
---
 qemu-kvm.c |   20 ++++++++++++++++++++
 vl.c       |   22 ----------------------
 2 files changed, 20 insertions(+), 22 deletions(-)
diff mbox

Patch

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);