public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: kvm@vger.kernel.org
Cc: Pekka Enberg <penberg@kernel.org>,
	Asias He <asias.hejun@gmail.com>,
	Cyrill Gorcunov <gorcunov@gmail.com>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 2/2] kvm tools: Move CPU initialization to kvm_cpu__start()
Date: Sat,  9 Apr 2011 13:51:07 +0300	[thread overview]
Message-ID: <1302346267-457-2-git-send-email-penberg@kernel.org> (raw)
In-Reply-To: <1302346267-457-1-git-send-email-penberg@kernel.org>

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 |    3 +++
 tools/kvm/kvm-run.c |   10 +++-------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c
index 392fad3..4cbe597 100644
--- a/tools/kvm/kvm-cpu.c
+++ b/tools/kvm/kvm-cpu.c
@@ -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);
 
diff --git a/tools/kvm/kvm-run.c b/tools/kvm/kvm-run.c
index 9a0400b..8a9747b 100644
--- a/tools/kvm/kvm-run.c
+++ b/tools/kvm/kvm-run.c
@@ -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;
 
-- 
1.7.0.4


      reply	other threads:[~2011-04-09 10:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 10:51 [PATCH 1/2] kvm tools: Extract kvm_cpu__start() function Pekka Enberg
2011-04-09 10:51 ` Pekka Enberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302346267-457-2-git-send-email-penberg@kernel.org \
    --to=penberg@kernel.org \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox