From patchwork Tue Dec 6 03:40:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Evans X-Patchwork-Id: 129507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A1EEC1007D6 for ; Tue, 6 Dec 2011 14:40:04 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932923Ab1LFDjl (ORCPT ); Mon, 5 Dec 2011 22:39:41 -0500 Received: from ozlabs.org ([203.10.76.45]:43759 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932871Ab1LFDjl (ORCPT ); Mon, 5 Dec 2011 22:39:41 -0500 Received: from [10.61.2.183] (ibmaus65.lnk.telstra.net [165.228.126.9]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id A017B1007D4; Tue, 6 Dec 2011 14:39:39 +1100 (EST) Message-ID: <4EDD8EAD.6060307@ozlabs.org> Date: Tue, 06 Dec 2011 14:40:29 +1100 From: Matt Evans User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15 MIME-Version: 1.0 To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Subject: [PATCH 12/28] kvm tools: Move arch-specific cmdline init into kvm__arch_set_cmdline() References: In-Reply-To: Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Different systems will want different base kernel commandlines, e.g. non-x86 systems probably don't need noapic, i8042.* etc., so set the commandline up in arch-specific code. Then, if the resulting commandline is empty, don't strcat a space onto the front. Signed-off-by: Matt Evans --- tools/kvm/builtin-run.c | 12 +++++------- tools/kvm/include/kvm/kvm.h | 1 + tools/kvm/x86/kvm.c | 11 +++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index 9ef331e..a67bd8c 100644 --- a/tools/kvm/builtin-run.c +++ b/tools/kvm/builtin-run.c @@ -835,13 +835,11 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix) vidmode = 0; memset(real_cmdline, 0, sizeof(real_cmdline)); - strcpy(real_cmdline, "noapic noacpi pci=conf1 reboot=k panic=1 i8042.direct=1 " - "i8042.dumbkbd=1 i8042.nopnp=1"); - if (vnc || sdl) { - strcat(real_cmdline, " video=vesafb console=tty0"); - } else - strcat(real_cmdline, " console=ttyS0 earlyprintk=serial i8042.noaux=1"); - strcat(real_cmdline, " "); + kvm__arch_set_cmdline(real_cmdline, vnc || sdl); + + if (strlen(real_cmdline) > 0) + strcat(real_cmdline, " "); + if (kernel_cmdline) strlcat(real_cmdline, kernel_cmdline, sizeof(real_cmdline)); diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h index 60842d5..fae2ba9 100644 --- a/tools/kvm/include/kvm/kvm.h +++ b/tools/kvm/include/kvm/kvm.h @@ -53,6 +53,7 @@ int kvm__get_sock_by_instance(const char *name); int kvm__enumerate_instances(int (*callback)(const char *name, int pid)); void kvm__remove_socket(const char *name); +void kvm__arch_set_cmdline(char *cmdline, bool video); void kvm__arch_init(struct kvm *kvm, const char *kvm_dev, u64 ram_size, const char *name); void kvm__arch_setup_firmware(struct kvm *kvm); bool kvm__arch_cpu_supports_vm(void); diff --git a/tools/kvm/x86/kvm.c b/tools/kvm/x86/kvm.c index 45dcb77..7071dc6 100644 --- a/tools/kvm/x86/kvm.c +++ b/tools/kvm/x86/kvm.c @@ -149,6 +149,17 @@ void kvm__init_ram(struct kvm *kvm) } } +/* Arch-specific commandline setup */ +void kvm__arch_set_cmdline(char *cmdline, bool video) +{ + strcpy(cmdline, "noapic noacpi pci=conf1 reboot=k panic=1 i8042.direct=1 " + "i8042.dumbkbd=1 i8042.nopnp=1"); + if (video) { + strcat(cmdline, " video=vesafb console=tty0"); + } else + strcat(cmdline, " console=ttyS0 earlyprintk=serial i8042.noaux=1"); +} + /* Architecture-specific KVM init */ void kvm__arch_init(struct kvm *kvm, const char *kvm_dev, u64 ram_size, const char *name) {