[PATCH 2/9] embed kvm_create_context into kvm_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is no reason why kvm_create_context is placed outside kvm_init().
After we call kvm_init(), no extra initialization step should be necessary.

This patch folds kvm_create_context into it, simplifying vl.c code.

Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx>
---
 qemu-kvm.c |    6 ++++--
 qemu-kvm.h |    1 -
 vl.c       |    7 -------
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index db28126..c3af59c 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -419,6 +419,8 @@ int kvm_dirty_pages_log_reset(kvm_context_t kvm)
 }
 
 
+static int kvm_create_context(void);
+
 int kvm_init(int smp_cpus)
 {
 	int fd;
@@ -478,7 +480,7 @@ int kvm_init(int smp_cpus)
 	}
 
     pthread_mutex_lock(&qemu_mutex);
-	return 0;
+    return kvm_create_context();
 
  out_close:
 	close(fd);
@@ -2249,7 +2251,7 @@ int kvm_arch_init_irq_routing(void)
 }
 #endif
 
-int kvm_qemu_create_context(void)
+static int kvm_create_context()
 {
     int r;
 
diff --git a/qemu-kvm.h b/qemu-kvm.h
index d5291a3..4fc2847 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -930,7 +930,6 @@ struct kvm_pit_state { };
 
 int kvm_main_loop(void);
 int kvm_qemu_init(void);
-int kvm_qemu_create_context(void);
 int kvm_init_ap(void);
 int kvm_vcpu_inited(CPUState *env);
 void kvm_load_registers(CPUState *env);
diff --git a/vl.c b/vl.c
index 7701488..f4e4d0f 100644
--- a/vl.c
+++ b/vl.c
@@ -5838,13 +5838,6 @@ int main(int argc, char **argv, char **envp)
     if (ram_size == 0)
         ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
 
-    if (kvm_enabled()) {
-	    if (kvm_qemu_create_context() < 0) {
-		    fprintf(stderr, "Could not create KVM context\n");
-		    exit(1);
-	    }
-    }
-
 #ifdef CONFIG_KQEMU
     /* FIXME: This is a nasty hack because kqemu can't cope with dynamic
        guest ram allocation.  It needs to go away.  */
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux