From patchwork Mon May 23 12:15:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 808482 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4NCHDeb032608 for ; Mon, 23 May 2011 12:17:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754760Ab1EWMRH (ORCPT ); Mon, 23 May 2011 08:17:07 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:60127 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754745Ab1EWMRG (ORCPT ); Mon, 23 May 2011 08:17:06 -0400 Received: by wwa36 with SMTP id 36so6131004wwa.1 for ; Mon, 23 May 2011 05:17:05 -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 :in-reply-to:references; bh=fiKadCtDNU+KK4s269NzPXIlzsQM5uh/EmypR1P5Jh8=; b=B2KYctd7hHNmupZXoVDKXcrOD/6e13OeC1qqC37GiNdNuQwlQTtvD1J+vNnaF9tB+I ME3U5cTveBFUho3lw02hrnTSA4DwTTiImyZqORcl2nyHuI1z5XypM+ppMaZ+CBOWW9DX y+Hb140yTPx/sfPERnCtaRVUwpLxyXINziNaM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=Kl8pp/Syp3Wb6VxUrYO/H8A6i40eMxghqoJsmtCYmp23WVAd1aWwqx094cC3/ypnQW yy0QaaYcYpMK8DwR6GRoVr/zA17Zsoe7yyIx4mPNHLOydaUL19WgtesNfn44KMvFcJre EACN9fjvgLwEG3IkUt9wRULhLpYGMCo5UtrdY= Received: by 10.217.7.70 with SMTP id z48mr2192320wes.57.1306153025113; Mon, 23 May 2011 05:17:05 -0700 (PDT) Received: from localhost.localdomain (bzq-79-179-199-121.red.bezeqint.net [79.179.199.121]) by mx.google.com with ESMTPS id r29sm3236685weq.45.2011.05.23.05.17.03 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 May 2011 05:17:04 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: john@jfloren.net, kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, Sasha Levin Subject: [PATCH V3 2/5] kvm tools: Add video mode to kernel initialization Date: Mon, 23 May 2011 15:15:15 +0300 Message-Id: <1306152918-29944-2-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.rc3 In-Reply-To: <1306152918-29944-1-git-send-email-levinsasha928@gmail.com> References: <1306152918-29944-1-git-send-email-levinsasha928@gmail.com> 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 (demeter2.kernel.org [140.211.167.43]); Mon, 23 May 2011 12:17:13 +0000 (UTC) From: John Floren Allow setting video mode in guest kernel. For possible values see Documentation/fb/vesafb.txt Signed-off-by: John Floren [ turning code into patches and cleanup ] Signed-off-by: Sasha Levin --- tools/kvm/include/kvm/kvm.h | 2 +- tools/kvm/kvm.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h index 08c6fda..f951f2d 100644 --- a/tools/kvm/include/kvm/kvm.h +++ b/tools/kvm/include/kvm/kvm.h @@ -41,7 +41,7 @@ int kvm__max_cpus(struct kvm *kvm); void kvm__init_ram(struct kvm *kvm); void kvm__delete(struct kvm *kvm); bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename, - const char *initrd_filename, const char *kernel_cmdline); + const char *initrd_filename, const char *kernel_cmdline, u16 vidmode); void kvm__setup_bios(struct kvm *kvm); void kvm__start_timer(struct kvm *kvm); void kvm__stop_timer(struct kvm *kvm); diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index 4393a41..7284211 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -320,7 +320,7 @@ static int load_flat_binary(struct kvm *kvm, int fd) static const char *BZIMAGE_MAGIC = "HdrS"; static bool load_bzimage(struct kvm *kvm, int fd_kernel, - int fd_initrd, const char *kernel_cmdline) + int fd_initrd, const char *kernel_cmdline, u16 vidmode) { struct boot_params *kern_boot; unsigned long setup_sects; @@ -383,6 +383,7 @@ static bool load_bzimage(struct kvm *kvm, int fd_kernel, kern_boot->hdr.type_of_loader = 0xff; kern_boot->hdr.heap_end_ptr = 0xfe00; kern_boot->hdr.loadflags |= CAN_USE_HEAP; + kern_boot->hdr.vid_mode = vidmode; /* * Read initrd image into guest memory @@ -441,7 +442,7 @@ static bool initrd_check(int fd) } bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename, - const char *initrd_filename, const char *kernel_cmdline) + const char *initrd_filename, const char *kernel_cmdline, u16 vidmode) { bool ret; int fd_kernel = -1, fd_initrd = -1; @@ -459,7 +460,7 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename, die("%s is not an initrd", initrd_filename); } - ret = load_bzimage(kvm, fd_kernel, fd_initrd, kernel_cmdline); + ret = load_bzimage(kvm, fd_kernel, fd_initrd, kernel_cmdline, vidmode); if (initrd_filename) close(fd_initrd);