kvm tools, seabios: Add support for SeaBIOS debugging output

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 --firmware /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.

Acked-by Cyrill Gorcunov <gorcunov@openvz.org>
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: Asias He <asias.hejun@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Pekka Enberg
2015-06-01 16:39:51 +01:00
committed by Will Deacon
parent 5ad8db5edc
commit ce08f2afa8
+18
View File
@@ -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);
}