From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Enberg Subject: [RFC/PATCH 2/2] kvm tools, seabios: Add support for SeaBIOS debugging output Date: Fri, 24 Feb 2012 17:05:30 +0200 Message-ID: <1330095930-1839-2-git-send-email-penberg@kernel.org> References: <1330095930-1839-1-git-send-email-penberg@kernel.org> Cc: Pekka Enberg , Yang Bai , Matt Evans , Ron Minnich , Anthony Liguori , John Floren , Sasha Levin , Cyrill Gorcunov , Asias He , Ingo Molnar To: kvm@vger.kernel.org Return-path: Received: from mail-bk0-f46.google.com ([209.85.214.46]:38898 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756055Ab2BXPFl (ORCPT ); Fri, 24 Feb 2012 10:05:41 -0500 Received: by bkcjm19 with SMTP id jm19so2069630bkc.19 for ; Fri, 24 Feb 2012 07:05:40 -0800 (PST) In-Reply-To: <1330095930-1839-1-git-send-email-penberg@kernel.org> Sender: kvm-owner@vger.kernel.org List-ID: SeaBIOS outputs debugging messages to special debug port ("0x0402"). This patch unconditionally hooks the PIO port to LKVM so that when user specifies a SeaBIOS image, you'll see this for "vm run": [penberg@tux kvm]$ ./vm run --bios /usr/share/seabios/bios.bin # lkvm run -k ../../arch/x86/boot/bzImage -m 448 -c 4 --name guest-25983 Start bios (version 0.6.0) Unable to unlock ram - bridge not found Ram Size=0x00100000 (0x0000000000000000 high) Once we have SeaBIOS fully operational, we probably should hide the feature under "--debug-seabios" command line option. Cc: Yang Bai Cc: Matt Evans Cc: Ron Minnich Cc: Anthony Liguori Cc: John Floren Cc: Sasha Levin Cc: Cyrill Gorcunov Cc: Asias He Cc: Ingo Molnar Signed-off-by: Pekka Enberg --- tools/kvm/x86/ioport.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/tools/kvm/x86/ioport.c b/tools/kvm/x86/ioport.c index 8a91bf2..86302e6 100644 --- a/tools/kvm/x86/ioport.c +++ b/tools/kvm/x86/ioport.c @@ -1,6 +1,7 @@ #include "kvm/ioport.h" #include +#include static bool debug_io_out(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size) { @@ -11,6 +12,21 @@ static struct ioport_operations debug_ops = { .io_out = debug_io_out, }; +static bool seabios_debug_io_out(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size) +{ + char ch; + + ch = ioport__read8(data); + + putchar(ch); + + return true; +} + +static struct ioport_operations seabios_debug_ops = { + .io_out = seabios_debug_io_out, +}; + static bool dummy_io_in(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size) { return true; @@ -56,4 +72,6 @@ void ioport__setup_arch(void) /* PORT 03D4-03D5 - COLOR VIDEO - CRT CONTROL REGISTERS */ ioport__register(0x03D4, &dummy_read_write_ioport_ops, 1, NULL); ioport__register(0x03D5, &dummy_write_only_ioport_ops, 1, NULL); + + ioport__register(0x402, &seabios_debug_ops, 1, NULL); } -- 1.7.6.5