Xen HVM Support
The following enables support for running SeaBIOS as the virtual BIOS in a Xen HVM (fully-virtualised) guest.
In this series SeaBIOS is loaded by hvmloader (the Xen early firmware) rather than directly as was previously tried. This approach turned out to be far less intrusive on the SeaBIOS side and leaves knowledge of the virtual hardware setup encapsulated within hvmloader which is updated in lock step with the hypervisor and associated tools.
BIOS tables are built by hvmloader and passed to SeaBIOS via a simple in memory data structure. The tables are identified by scanning for their signatures which is hopefully extensible enough but the core structure can also be extended as necessary.
The associated hvmloader series was only posted on xen-devel can be found at:
http://marc.info/?l=xen-devel&m=130692187111154
the most interesting patch is probably:
http://marc.info/?l=xen-devel&m=130692182011054
Ian.
PATCH 1/2 Move support for copying out BIOS tables into its own file.
I'd like to use it for Xen support.
--- Makefile | 2 +- src/biostables.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/coreboot.c | 75 ------------------------------------------------ src/util.h | 5 +++ 4 files changed, 89 insertions(+), 76 deletions(-) create mode 100644 src/biostables.c
Makefile +1 -1
@@ -20,7 +20,7 @@ SRC16=$(SRCBOTH) system.c disk.c font.c SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \ acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \ lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c dev-i440fx.c \ - pci_region.c + pci_region.c biostables.c SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
src/biostables.c new file +83 -0
83 lines not on this page · raw message
src/coreboot.c +0 -75
87 lines not on this page · raw message
src/util.h +5 -0
@@ -405,6 +405,11 @@ void coreboot_copy_biostable(void);void cbfs_payload_setup (void );void coreboot_setup (void ); +// biostable.c +void copy_pir (void *pos); +void copy_mptable (void *pos); +void copy_acpi_rsdp (void *pos); +// vgahooks.c extern int VGAbdf;void handle_155f (struct bregs *regs);
Signature · 1 line
1.7.2.5
PATCH 2/2 Add support for use as Xen HVM BIOS.
In reply to Ian CampbellSeaBIOS is called by Xen's hvmloader which does the basic platform setup (PCI, APIC, etc) and provides the various BIOS tables. Therefore avoid re-doing that setup and copy out the tables as necessary. A simple data structure is defined to pass the addresses of these tables.
This patch also establishes the basic infrastructure to make hypercalls, although it currently only uses it to query the hypervisor version.
--- Makefile | 2 +- src/Kconfig | 6 ++ src/biostables.c | 22 ++++++++ src/mtrr.c | 3 +- src/pciinit.c | 5 +- src/post.c | 10 ++++ src/shadow.c | 5 +- src/util.h | 1 + src/xen.c | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/xen.h | 135 ++++++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 332 insertions(+), 6 deletions(-) create mode 100644 src/xen.c create mode 100644 src/xen.h
Makefile +1 -1
@@ -20,7 +20,7 @@ SRC16=$(SRCBOTH) system.c disk.c font.c SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \ acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \ lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c dev-i440fx.c \ - pci_region.c biostables.c + pci_region.c biostables.c xen.c SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
src/Kconfig +6 -0
@@ -10,6 +10,12 @@ menu "General Features" help Configure as a coreboot payload. + config XEN + bool "Build for Xen HVM" + default n + help + Configure to be used by xen hvmloader, for a HVM guest. + config THREADS bool "Parallelize hardware init" default y
src/biostables.c +22 -0
@@ -9,6 +9,7 @@#include "pci.h" // struct pir_header #include "acpi.h" // struct rsdp_descriptor #include "mptable.h" // MPTABLE_SIGNATURE +#include "smbios.h" // struct smbios_entry_point void copy_pir (void *pos)
@@ -81,3 +82,24 @@ copy_acpi_rsdp(void *pos)memcpy (newpos, pos, length); RsdpAddr = newpos; } + +void +copy_smbios (void *pos) +{ +struct smbios_entry_point *p = pos; +if (memcmp (p->anchor_string,"_SM_" ,4 )) +return ; +if (checksum (pos,0x10 ) !=0 ) +return ; +if (memcmp (p->intermediate_anchor_string,"_DMI_" ,5 )) +return ; +if (checksum (pos+0x10 , p->length-0x10 ) !=0 ) +return ; +struct smbios_entry_point *newpos =malloc_fseg (sizeof (p->length)); +if (!newpos) { +warn_noalloc (); +return ; + } +dprintf (1 ,"Copying SMBIOS entry point from %p to %p\n" , pos, newpos); +memcpy (newpos, pos, p->length); +}
src/mtrr.c +2 -1
@@ -6,6 +6,7 @@#include "util.h" // dprintf #include "biosvar.h" // GET_EBDA +#include "xen.h" // usingXen #define MSR_MTRRcap 0x000000fe#define MSR_MTRRfix64K_00000 0x00000250
@@ -32,7 +33,7 @@void mtrr_setup (void ) { -if (!CONFIG_MTRR_INIT ||CONFIG_COREBOOT ) +if (!CONFIG_MTRR_INIT ||CONFIG_COREBOOT ||usingXen ())return ;u32 eax, ebx, ecx, edx, cpuid_features;
src/pciinit.c +3 -2
@@ -11,6 +11,7 @@#include "pci_ids.h" // PCI_VENDOR_ID_INTEL #include "pci_regs.h" // PCI_COMMAND #include "dev-i440fx.h" +#include "xen.h" // usingXen #define PCI_ROM_SLOT 6#define PCI_NUM_REGIONS 7
@@ -396,8 +397,8 @@ pci_bios_init_bus(void)void pci_setup (void ) { -if (CONFIG_COREBOOT ) -// Already done by coreboot. +if (CONFIG_COREBOOT ||usingXen ()) +// Already done by coreboot or Xen. return ;dprintf (3 ,"pci setup\n" );
src/post.c +10 -0
@@ -23,6 +23,7 @@#include "usb.h" // usb_setup #include "smbios.h" // smbios_init #include "paravirt.h" // qemu_cfg_port_probe +#include "xen.h" // xen_probe_hvm_info #include "ps2port.h" // ps2port_setup #include "virtio-blk.h" // virtio_blk_setup
@@ -101,6 +102,8 @@ ram_probe(void)dprintf (3 ,"Find memory size\n" );if (CONFIG_COREBOOT ) {coreboot_setup (); + }else if (usingXen ()) { +xen_setup (); }else {// On emulators, get memory size from nvram. u32 rs = ((inb_cmos(CMOS_MEM_EXTMEM2_LOW) << 16)
@@ -158,6 +161,10 @@ init_bios_tables(void)coreboot_copy_biostable ();return ; } +if (usingXen ()) { +xen_copy_biostables (); +return ; + }create_pirtable ();
@@ -380,6 +387,9 @@ _start(void)// This is a soft reboot - invoke a hard reboot. tryReboot (); +// Check if we are running under Xen. +xen_probe (); +// Allow writes to modify bios area (0xf0000) make_bios_writable (); HaveRunPost =1 ;
src/shadow.c +3 -2
@@ -10,6 +10,7 @@#include "config.h" // CONFIG_* #include "pci_ids.h" // PCI_VENDOR_ID_INTEL #include "dev-i440fx.h" +#include "xen.h" // usingXen // On the emulators, the bios at 0xf0000 is also at 0xffff0000 #define BIOS_SRC_OFFSET 0xfff00000
@@ -102,7 +103,7 @@ static const struct pci_device_id dram_controller_make_writable_tbl[] = {void make_bios_writable (void ) { -if (CONFIG_COREBOOT ) +if (CONFIG_COREBOOT ||usingXen ())return ;dprintf (3 ,"enabling shadow ram\n" );
@@ -127,7 +128,7 @@ static const struct pci_device_id dram_controller_make_readonly_tbl[] = {void make_bios_readonly (void ) { -if (CONFIG_COREBOOT ) +if (CONFIG_COREBOOT ||usingXen ())return ;dprintf (3 ,"locking shadow ram\n" );
src/util.h +1 -0
@@ -409,6 +409,7 @@ void coreboot_setup(void);void copy_pir (void *pos);void copy_mptable (void *pos);void copy_acpi_rsdp (void *pos); +void copy_smbios (void *pos);// vgahooks.c extern int VGAbdf;
src/xen.c new file +149 -0
149 lines not on this page · raw message
src/xen.h new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
1.7.2.5
Quoted 9 lines · Ian Campbell
The following enables support for running SeaBIOS as the virtual BIOS in a Xen HVM (fully-virtualised) guest.
In this series SeaBIOS is loaded by hvmloader (the Xen early firmware) rather than directly as was previously tried. This approach turned out to be far less intrusive on the SeaBIOS side and leaves knowledge of the virtual hardware setup encapsulated within hvmloader which is updated in lock step with the hypervisor and associated tools.
Quoted 4 lines
BIOS tables are built by hvmloader and passed to SeaBIOS via a simple in memory data structure. The tables are identified by scanning for their signatures which is hopefully extensible enough but the core structure can also be extended as necessary.
It looks okay to me.
Thanks,
-Kevin
Quoted 10 lines · Kevin O'Connor
Quoted 9 lines · Ian Campbell
The following enables support for running SeaBIOS as the virtual BIOS in a Xen HVM (fully-virtualised) guest.
In this series SeaBIOS is loaded by hvmloader (the Xen early firmware) rather than directly as was previously tried. This approach turned out to be far less intrusive on the SeaBIOS side and leaves knowledge of the virtual hardware setup encapsulated within hvmloader which is updated in lock step with the hypervisor and associated tools.
Quoted 6 lines
Quoted 4 lines
BIOS tables are built by hvmloader and passed to SeaBIOS via a simple in memory data structure. The tables are identified by scanning for their signatures which is hopefully extensible enough but the core structure can also be extended as necessary.
It looks okay to me.
Thanks.
All the Xen side pieces are in place already (although not set in stone if you find something you would like done different).
Ian.
Quoted 16 lines · Ian Campbell
Quoted 15 lines · Kevin O'Connor
Quoted 13 lines · Ian Campbell
The following enables support for running SeaBIOS as the virtual BIOS in a Xen HVM (fully-virtualised) guest.
In this series SeaBIOS is loaded by hvmloader (the Xen early firmware) rather than directly as was previously tried. This approach turned out to be far less intrusive on the SeaBIOS side and leaves knowledge of the virtual hardware setup encapsulated within hvmloader which is updated in lock step with the hypervisor and associated tools.
BIOS tables are built by hvmloader and passed to SeaBIOS via a simple in memory data structure. The tables are identified by scanning for their signatures which is hopefully extensible enough but the core structure can also be extended as necessary.
Quoted 6 lines
Quoted 1 line
It looks okay to me.
Thanks.
All the Xen side pieces are in place already (although not set in stone if you find something you would like done different).
I've committed this.
Thanks,
-Kevin
Quoted 17 lines · Kevin O'Connor
Quoted 16 lines · Ian Campbell
Quoted 15 lines · Kevin O'Connor
Quoted 13 lines · Ian Campbell
The following enables support for running SeaBIOS as the virtual BIOS in a Xen HVM (fully-virtualised) guest.
In this series SeaBIOS is loaded by hvmloader (the Xen early firmware) rather than directly as was previously tried. This approach turned out to be far less intrusive on the SeaBIOS side and leaves knowledge of the virtual hardware setup encapsulated within hvmloader which is updated in lock step with the hypervisor and associated tools.
BIOS tables are built by hvmloader and passed to SeaBIOS via a simple in memory data structure. The tables are identified by scanning for their signatures which is hopefully extensible enough but the core structure can also be extended as necessary.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
It looks okay to me.
Thanks.
All the Xen side pieces are in place already (although not set in stone if you find something you would like done different).
I've committed this.
Thanks Kevin!
Ian.
Hi,
yesterday i tried to boot Windows7 64bit with the new "Upstream Qemu with Seabios" HVM loader under xen unstable (yesterdays hg pull)
The Windows Installer booted fine from the ISO (after enabling El-Torrito Emulation in Seabios menuconfig), but the Windows Installer soon gave up with a BSOD (STOP 0xA5), much like stated here http://www.coreboot.org/SeaBIOS under "Windows".
I have a Screenshot from the BSOD in case the adresses are of any interest.
Any hints, or is this supposed to not work (yet) ?
Greetings
Tobias
Am Dienstag, 14. Juni 2011, 10:19:26 schrieb Ian Campbell:
Quoted 38 lines · Kevin O'Connor
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Kevin O'Connor
Quoted 16 lines · Ian Campbell
Quoted 14 lines
The following enables support for running SeaBIOS as the virtual BIOS in a Xen HVM (fully-virtualised) guest.
In this series SeaBIOS is loaded by hvmloader (the Xen early firmware) rather than directly as was previously tried. This approach turned out to be far less intrusive on the SeaBIOS side and leaves knowledge of the virtual hardware setup encapsulated within hvmloader which is updated in lock step with the hypervisor and associated tools.
BIOS tables are built by hvmloader and passed to SeaBIOS via a simple in memory data structure. The tables are identified by scanning for their signatures which is hopefully extensible enough but the core structure can also be extended as necessary.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
It looks okay to me.
Thanks.
All the Xen side pieces are in place already (although not set in stone if you find something you would like done different).
I've committed this.
Thanks Kevin!
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · Tobias Geiger
Hi,
yesterday i tried to boot Windows7 64bit with the new "Upstream Qemu with Seabios" HVM loader under xen unstable (yesterdays hg pull)
Quoted 7 lines
The Windows Installer booted fine from the ISO (after enabling El-Torrito Emulation in Seabios menuconfig), but the Windows Installer soon gave up with a BSOD (STOP
0xA5), much like stated here http://www.coreboot.org/SeaBIOS under "Windows".
I have a Screenshot from the BSOD in case the adresses are of any interest.Any hints, or is this supposed to not work (yet) ?
We haven't yet tested the whole range of possible guests and I haven't personally tried Windows 7 with new qemu+SeaBIOS.
The Wikipage suggests that the issue is related to the ACPI tables and under Xen these are the same as those used by old qemu+ROMBIOS so it may not be the exact same issue. Have you tried the same OS under old qemu? (although I'm sure we would know already if Windows 7 support was broken in xen-unstable...)
The screenshot would probably be useful to see.
Ian.
Hello Ian,
The BSOD was a ACPI related one, yes.
unfortunatly the Screenshot is @home - i will upload it when back there again.
with "standard" qemu (i.e. the one shipped with xen) win7-64 installs and works fine, yes.
Greetings!
Tobias
Am Freitag, 22. Juli 2011, 11:32:34 schrieb Ian Campbell:
Quoted 33 lines · Tobias Geiger
Quoted 5 lines
Hi,
yesterday i tried to boot Windows7 64bit with the new "Upstream Qemu with Seabios" HVM loader under xen unstable (yesterdays hg pull)
Quoted 8 lines
The Windows Installer booted fine from the ISO (after enabling El-Torrito Emulation in Seabios menuconfig), but the Windows Installer soon gave up with a BSOD (STOP
0xA5), much like stated here
http://www.coreboot.org/SeaBIOS under "Windows".
I have a Screenshot from the BSOD in case the adresses are of any interest.Any hints, or is this supposed to not work (yet) ?
We haven't yet tested the whole range of possible guests and I haven't personally tried Windows 7 with new qemu+SeaBIOS.
The Wikipage suggests that the issue is related to the ACPI tables and under Xen these are the same as those used by old qemu+ROMBIOS so it may not be the exact same issue. Have you tried the same OS under old qemu? (although I'm sure we would know already if Windows 7 support was broken in xen-unstable...)
The screenshot would probably be useful to see.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel