]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Move CPU initialization to kvm_cpu__start()
authorPekka Enberg <penberg@kernel.org>
Sat, 9 Apr 2011 10:48:01 +0000 (13:48 +0300)
committerPekka Enberg <penberg@kernel.org>
Sat, 9 Apr 2011 10:49:53 +0000 (13:49 +0300)
Move CPUID setup and CPU reset code to kvm_cpu__start() so that CPU state is
setup in one place.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/kvm-cpu.c
tools/kvm/kvm-run.c

index 392fad3297254e4f6cb80e5526bab2008f38488c..4cbe5978ca8bf92a44857ce1234dcf74779ed093 100644 (file)
@@ -373,6 +373,9 @@ void kvm_cpu__run(struct kvm_cpu *self)
 
 int kvm_cpu__start(struct kvm_cpu *cpu)
 {
+       kvm_cpu__setup_cpuid(cpu);
+       kvm_cpu__reset_vcpu(cpu);
+
        for (;;) {
                kvm_cpu__run(cpu);
 
index 9a0400bb082b4a1a8e15735aa32e0dc95acc1af9..8a9747b8782a80066457b2e7504afdb949a2d004 100644 (file)
@@ -143,8 +143,6 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
                        die("unable to load disk image %s", image_filename);
        }
 
-       kvm_cpu__setup_cpuid(cpu);
-
        strcpy(real_cmdline, "notsc nolapic noacpi pci=conf1 console=ttyS0 ");
        if (!kernel_cmdline || !strstr(kernel_cmdline, "root=")) {
                strlcat(real_cmdline, "root=/dev/vda rw ",
@@ -160,13 +158,8 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
                                real_cmdline))
                die("unable to load kernel %s", kernel_filename);
 
-       kvm_cpu__reset_vcpu(cpu);
-
        kvm__setup_bios(kvm);
 
-       if (single_step)
-               kvm_cpu__enable_singlestep(cpu);
-
        serial8250__init(kvm);
 
        pci__init();
@@ -177,6 +170,9 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
 
        kvm__start_timer(kvm);
 
+       if (single_step)
+               kvm_cpu__enable_singlestep(cpu);
+
        if (kvm_cpu__start(cpu))
                goto panic_kvm;