diff mbox

kvm tools: Replace option --enable-virtio-console with --console

Message ID 1302498614-8722-1-git-send-email-asias.hejun@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Asias He April 11, 2011, 5:10 a.m. UTC
The default console is serial console.

You can use:
--console=virtio or -c virtio to enable virtio console
--console=serial or -c serial to enable serial console.

You can use only one console at a time.

Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/kvm-run.c |   14 ++++++++++----
 tools/kvm/term.c    |    2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/kvm-run.c b/tools/kvm/kvm-run.c
index 1944307..8f6ebdc 100644
--- a/tools/kvm/kvm-run.c
+++ b/tools/kvm/kvm-run.c
@@ -25,6 +25,7 @@ 
 #include <kvm/parse-options.h>
 
 #define DEFAULT_KVM_DEV		"/dev/kvm"
+#define DEFAULT_CONSOLE		"serial"
 
 #define MB_SHIFT		(20)
 #define MIN_RAM_SIZE_MB		(64ULL)
@@ -57,9 +58,9 @@  static const char *kernel_cmdline;
 static const char *kernel_filename;
 static const char *initrd_filename;
 static const char *image_filename;
+static const char *console;
 static const char *kvm_dev;
 static bool single_step;
-static bool virtio_console;
 extern bool ioport_debug;
 extern int  active_console;
 
@@ -84,8 +85,8 @@  static const struct option options[] = {
 			"Enable single stepping"),
 	OPT_BOOLEAN('g', "ioport-debug", &ioport_debug,
 			"Enable ioport debugging"),
-	OPT_BOOLEAN('c', "enable-virtio-console", &virtio_console,
-			"Enable the virtual IO console"),
+	OPT_STRING('c', "console", &console, "serial or virtio",
+			"Console to use"),
 	OPT_INTEGER('\0', "cpus", &nrcpus, "Number of CPUs"),
 	OPT_END()
 };
@@ -169,8 +170,13 @@  int kvm_cmd_run(int argc, const char **argv, const char *prefix)
 	if (!kvm_dev)
 		kvm_dev = DEFAULT_KVM_DEV;
 
-	if (virtio_console == true)
+	if (!console)
+		console = DEFAULT_CONSOLE;
+
+	if (!strncmp(console, "virtio", 6))
 		active_console  = CONSOLE_VIRTIO;
+	else
+		active_console  = CONSOLE_8250;
 
 	term_init();
 
diff --git a/tools/kvm/term.c b/tools/kvm/term.c
index 4adf9ef..2245c8d 100644
--- a/tools/kvm/term.c
+++ b/tools/kvm/term.c
@@ -14,7 +14,7 @@  static struct termios	orig_term;
 int term_escape_char	= 0x01; /* ctrl-a is used for escape */
 bool term_got_escape	= false;
 
-int active_console	= CONSOLE_8250;
+int active_console;
 
 int term_getc(int who)
 {