From patchwork Mon May 23 11:19:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 808342 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 p4NBJg1K001859 for ; Mon, 23 May 2011 11:19:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753007Ab1EWLTf (ORCPT ); Mon, 23 May 2011 07:19:35 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:63794 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505Ab1EWLTd (ORCPT ); Mon, 23 May 2011 07:19:33 -0400 Received: by wya21 with SMTP id 21so4109456wya.19 for ; Mon, 23 May 2011 04:19:32 -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=ddVDhZ1kw92lP8V/VjI9E4dJ9T6xq1vKCvKh1tKpfd4=; b=Q/SxFGrwkVhux6g775LQCJz6xj29OVDnB3P/Emkp5lSMu/4znGd0fqbxdV3mCx2XDO kQrPa5z7qJP0FSQ1yB81GszNW/IMAYwNTRTiabZhSOioKIWdk1bWd6RoZ8g7IkbDN6pP dX6+l9F6OIn2NkR0GLE5xc5kkUeyeVoq6mx8M= 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=SBntpKLi34Vy71OdtYkTFnyno72wnAJrgv5jcMMPlgEKhl7lM6VAdWDC5vRomGmimI VHqXGJXRNnycXxr9YcKFTOAAokYJO8X5tXPWHklK03vlT4A9/0p9l6/nWxT4XsxZtJij xr7rFa2lI+khEo6YfMGdqJ8HEoWGdiH78kLaM= Received: by 10.216.81.69 with SMTP id l47mr2059210wee.78.1306149572799; Mon, 23 May 2011 04:19:32 -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 r29sm3208804weq.21.2011.05.23.04.19.31 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 May 2011 04:19:32 -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 2/5 V2] kvm tools: Add video mode to kernel initialization Date: Mon, 23 May 2011 14:19:10 +0300 Message-Id: <1306149553-26793-2-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.rc3 In-Reply-To: <1306149553-26793-1-git-send-email-levinsasha928@gmail.com> References: <1306149553-26793-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 (demeter1.kernel.org [140.211.167.41]); Mon, 23 May 2011 11:19:43 +0000 (UTC) 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);