From patchwork Mon Apr 11 05:10:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 697561 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3B5DtP5006572 for ; Mon, 11 Apr 2011 05:13:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754033Ab1DKFNw (ORCPT ); Mon, 11 Apr 2011 01:13:52 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:64438 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753972Ab1DKFNw (ORCPT ); Mon, 11 Apr 2011 01:13:52 -0400 Received: by pvg12 with SMTP id 12so1865416pvg.19 for ; Sun, 10 Apr 2011 22:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=zZBK52dJiF6S4TzVIALNuU8aKMMfx2ntKbpH2PxtrhE=; b=KiC7BZ/9ZbB3Azc0sjiKRUxdKSS+YHvKvfDk95ZQQQZFpbP6Ml+rX6H/mfjqRvYgJp JUmAtMccAVLYJdSC9FVbTpR2K1adniewr3dyt5DgNmTgjLXSpT/eBAex0kGmZprL5Hau rxerFI3QUFzE47o9jpQ5pwZKn+3PLVTLkdUYw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=c9JkupkegHsL4yStxULPRhqbK3b4w0xWHWFTZDeEwk/95pOIKqfabibZtLHURYZKmf 7fV3b7qganGXVWAS+D1vZ+7Z3ATxiq70xH+41RbExZMd6zOj0HFrQctScXpqlpC7pCg3 ymxjnnyFIXVCV7Y2ckYZ+KVGN2kb+LSSzd5pM= Received: by 10.143.21.42 with SMTP id y42mr5173028wfi.294.1302498831839; Sun, 10 Apr 2011 22:13:51 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id o1sm7763056wfl.9.2011.04.10.22.13.48 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Apr 2011 22:13:50 -0700 (PDT) From: Asias He To: Pekka Enberg , Cyrill Gorcunov , Ingo Molnar Cc: kvm@vger.kernel.org, Asias He Subject: [PATCH] kvm tools: Replace option --enable-virtio-console with --console Date: Mon, 11 Apr 2011 13:10:14 +0800 Message-Id: <1302498614-8722-1-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.4.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 11 Apr 2011 05:13:57 +0000 (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 Signed-off-by: Asias He --- tools/kvm/kvm-run.c | 14 ++++++++++---- tools/kvm/term.c | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) 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 #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) {