public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: kvm@vger.kernel.org
Cc: Pekka Enberg <penberg@kernel.org>, Yang Bai <hamo.by@gmail.com>,
	Matt Evans <matt@ozlabs.org>, Ron Minnich <rminnich@gmail.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	John Floren <john@jfloren.net>,
	Sasha Levin <levinsasha928@gmail.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Asias He <asias.hejun@gmail.com>, Ingo Molnar <mingo@elte.hu>
Subject: [RFC/PATCH 2/2] kvm tools, seabios: Add support for SeaBIOS debugging output
Date: Fri, 24 Feb 2012 17:05:30 +0200	[thread overview]
Message-ID: <1330095930-1839-2-git-send-email-penberg@kernel.org> (raw)
In-Reply-To: <1330095930-1839-1-git-send-email-penberg@kernel.org>

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)

  <hangs here>

Once we have SeaBIOS fully operational, we probably should hide the feature
under "--debug-seabios" command line option.

Cc: Yang Bai <hamo.by@gmail.com>
Cc: Matt Evans <matt@ozlabs.org>
Cc: Ron Minnich <rminnich@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Asias He <asias.hejun@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 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 <stdlib.h>
+#include <stdio.h>
 
 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


  reply	other threads:[~2012-02-24 15:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24 15:05 [RFC/PATCH 1/2] kvm tools, seabios: Add "--bios" option to "vm run" Pekka Enberg
2012-02-24 15:05 ` Pekka Enberg [this message]
2012-02-24 15:13 ` Cyrill Gorcunov
2012-02-24 15:23 ` Anthony Liguori
2012-02-24 16:27   ` ron minnich
2012-02-24 16:41     ` John Floren
2012-02-24 18:54       ` Pekka Enberg
2012-02-24 19:01         ` Pekka Enberg
2012-02-24 19:18           ` Pekka Enberg
2012-02-24 19:29             ` John Floren
2012-02-25  1:14               ` John Floren
2012-02-27 10:44             ` Gerd Hoffmann
2012-02-27 11:15               ` Gleb Natapov
2012-02-27 16:24                 ` ron minnich
2012-02-27 16:38                   ` Gleb Natapov
2012-02-27 16:46                     ` ron minnich
2012-02-27 17:25                       ` Gleb Natapov
2012-02-27 17:29                         ` ron minnich
2012-02-27 10:37         ` Gerd Hoffmann
2012-02-24 18:00     ` Pekka Enberg
2012-02-24 19:07       ` ron minnich
2012-02-24 19:13         ` Pekka Enberg
2012-02-24 17:58   ` Pekka Enberg
2012-02-25 23:35   ` Matt Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330095930-1839-2-git-send-email-penberg@kernel.org \
    --to=penberg@kernel.org \
    --cc=aliguori@us.ibm.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@openvz.org \
    --cc=hamo.by@gmail.com \
    --cc=john@jfloren.net \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=matt@ozlabs.org \
    --cc=mingo@elte.hu \
    --cc=rminnich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox