On Tue, 2011-08-09 at 13:56 +0100, Bei Guan wrote:
>
> >
> > # HG changeset patch
> > # User gbtju85@xxxxxxxxx
> > #
> >
> > Enable Xen-unstable hvmloader to load OVMF BIOS.
> > It supports OVMF BIOS in IA32 and X86 environment.
> >
> > Usage:
> > Add an option field in HVM config file.
> > # OVMF support. When enabled, hvmloader can load OVMF bios of
> IA32("ovmf-ia32") and X64("ovmf-x64")
> > hvmbios = "ovmf-ia32"
> > #hvmbios = "ovmf-x64"
> >
> > Note:
> > Enable the HVM guest ACPI: acpi=1
> > Use the OVMF to boot into a UEFI-aware OS, such as
> ubuntu-10.10-desktop-amd64.iso. Just set the "disk" option like this:
> > disk = [ 'file:/root/<img_name>.img,ioemu:hda,w',
> 'file:/root/ubuntu-10.10-desktop-amd64.iso,hdc:cdrom,r' ]
> >
> > diff -r 0f36c2eec2e1 tools/firmware/hvmloader/Makefile
> > --- a/tools/firmware/hvmloader/Makefile Thu Jul 28 15:40:54 2011
> +0100
> > +++ b/tools/firmware/hvmloader/Makefile Fri Aug 05 17:58:27 2011
> +0800
> > @@ -43,6 +43,19 @@
> > CFLAGS += -DENABLE_ROMBIOS
> > ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
> > endif
> > +OVMF_DIR := ../ovmf
> > +OVMF32_ROM := $(OVMF_DIR)/ovmf-ia32.bin
> > +OVMF64_ROM := $(OVMF_DIR)/ovmf-x64.bin
> > +OVMF32_CIRRUS_VGA_ROM := $(OVMF_DIR)/ovmf-ia32-cirrus-vga.bin
> > +OVMF64_CIRRUS_VGA_ROM := $(OVMF_DIR)/ovmf-x64-cirrus-vga.bin
> > +
> > +ifneq ($(OVMF32_ROM),)
> > +OBJS += ovmf.o
> > +endif
> > +
> > +ifneq ($(OVMF64_ROM),)
> > +OBJS += ovmf.o
> > +endif
> >
> > ifneq ($(SEABIOS_DIR),)
> > OBJS += seabios.o
> > @@ -69,7 +82,7 @@
> > $(OBJCOPY) hvmloader.tmp hvmloader
> > rm -f hvmloader.tmp
> >
> > -roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM)
> $(CIRRUSVGA_ROM) ../etherboot/eb-roms.h
> > +roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM)
> $(CIRRUSVGA_ROM) $(OVMF32_ROM) $(OVMF64_ROM) $(OVMF32_CIRRUS_VGA_ROM)
> $(OVMF64_CIRRUS_VGA_ROM) ../etherboot/eb-roms.h
> > echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
> >
> > ifneq ($(ROMBIOS_ROM),)
> > @@ -84,6 +97,30 @@
> > echo "#endif" >> $@.new
> > endif
> >
> > +ifneq ($(OVMF32_ROM),)
> > + echo "#ifdef ROM_INCLUDE_OVMF32" >> $@.new
> > + sh ./mkhex ovmf32 $(OVMF32_ROM) >> $@.new
> > + echo "#endif" >> $@.new
> > +endif
> > +
> > +ifneq ($(OVMF64_ROM),)
> > + echo "#ifdef ROM_INCLUDE_OVMF64" >> $@.new
> > + sh ./mkhex ovmf64 $(OVMF64_ROM) >> $@.new
> > + echo "#endif" >> $@.new
> > +endif
> > +
> > +ifneq ($(OVMF32_CIRRUS_VGA_ROM),)
> > + echo "#ifdef ROM_INCLUDE_OVMF32_CIRRUS_VGA" >> $@.new
> > + sh ./mkhex ovmf32_cirrus_vga $(OVMF32_CIRRUS_VGA_ROM) >> $@.new
> > + echo "#endif" >> $@.new
> > +endif
> > +
> > +ifneq ($(OVMF64_CIRRUS_VGA_ROM),)
> > + echo "#ifdef ROM_INCLUDE_OVMF64_CIRRUS_VGA" >> $@.new
> > + sh ./mkhex ovmf64_cirrus_vga $(OVMF64_CIRRUS_VGA_ROM) >> $@.new
> > + echo "#endif" >> $@.new
> > +endif
>
>
> What is the difference between these versions of the VGA BIOS and the
> existing one?
> I am unsure what is the difference between OVMF VGA BIOS and the existing one
> in firmware/vgabios. Maybe Andrei or Jordan can give the answer.
Yes please.
>
>
>
>
> It seems like you only checking the binaries, where is the source and
> what is its license?
> The source code of OVMF BIOS is available at
> https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/OvmfPkg/ .
> And the license is BSD license.
>
>
> Building the OVMF BIOS needs the environment edk2, whose source code is
> available at
> https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ .
> I am afraid OVMF source code can't be downloaded and built in Xen compiling
> environment.
> So, I just provide the binary files of OVMF VGA and OVMF BIOS firmware.
Oh, I see.
Generally we would like to avoid adding new external projects to the Xen
source tree. Long term we would instead like to see a kind of "meta"
build system which pulls together Xen and the various bits and pieces.
In the seabios case we decided not to pull any bits seabios into
xen.hg/tools/firmware/seabios/ but rather to provide a configuration
variable which would point to a built seabios.git tree. I think a
similar model would make sense for the OVMF support. IOW OVMF_DIR = ""
by default (OVMF disabled), users who want OVMF can obtain and build
OVMF and then set OVMF_DIR to point this built tree. (eventually this
step will be subsumed into the "meta" build system)
>
>
>
>
> With SeaBIOS we moved to a model of loading option ROMs from the
> emulated devices themselves (via the ROM BAR). Could this be used for
> OVMF too?
> Do you mean use the bios->load_roms to load OVMF VGA BIOS instead of loading
> it in bios_load?
No. Hardware devices have a special BAR which can be used to map their
option ROM. BIOSes (i.e. real ones on physical machines) use this in
order to map the option ROMs and copy or run them etc. SeaBIOS also
supports this and qemu supports emulating these BARs for the given
devices by providing the contents of a specific file on the host file
system and so we don't load any VGA BIOS in hvmloader in that case and
just let seabios and qemu take care of it via this mechanism.
So what I'm suggesting is that OVMF should (and possibly already does)
support this operation and should load the VGA rom itself from the VGA
devices ROM BAR. If the VGABIOS for OVMF needs to be different to what
would be normally need with a legacy BIOS then we can enhance QEMU to
provide the option to request alternative ROM images be used.
This model makes sense since a device's option-ROM is tied more to the
specific device than it is to the BIOS etc.
>
>
> > +
> > ifneq ($(STDVGA_ROM),)
> > echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
> > sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
> > diff -r 0f36c2eec2e1 tools/firmware/hvmloader/config.h
> > --- a/tools/firmware/hvmloader/config.h Thu Jul 28 15:40:54 2011
> +0100
> > +++ b/tools/firmware/hvmloader/config.h Fri Aug 05 17:58:27 2011
> +0800
> > @@ -3,7 +3,7 @@
> >
> > #include <stdint.h>
> >
> > -enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt };
> > +enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt,
> VGA_custom };
> > extern enum virtual_vga virtual_vga;
> >
> > struct bios_config {
> > @@ -27,6 +27,7 @@
> >
> > void (*vm86_setup)(void);
> > void (*e820_setup)(void);
> > + void (*pci_setup)(void);
> >
> > void (*acpi_build_tables)(void);
> > void (*create_mp_tables)(void);
> > @@ -36,6 +37,8 @@
> >
> > extern struct bios_config rombios_config;
> > extern struct bios_config seabios_config;
> > +extern struct bios_config ovmf32_config;
> > +extern struct bios_config ovmf64_config;
> >
> > #define PAGE_SHIFT 12
> > #define PAGE_SIZE (1ul << PAGE_SHIFT)
> > diff -r 0f36c2eec2e1 tools/firmware/hvmloader/hvmloader.c
> > --- a/tools/firmware/hvmloader/hvmloader.c Thu Jul 28 15:40:54
> 2011 +0100
> > +++ b/tools/firmware/hvmloader/hvmloader.c Fri Aug 05 17:58:27
> 2011 +0800
> > @@ -361,6 +361,8 @@
> > #ifdef ENABLE_SEABIOS
> > { "seabios", &seabios_config, },
> > #endif
> > + { "ovmf-ia32", &ovmf32_config, },
> > + { "ovmf-x64", &ovmf64_config, },
>
>
> I suppose these (asymmetric) names are OVMF-isms?
> Yes, these two are the names of OVMF BIOS in platform IA32 and X64.
Ick, but oh well...
Is there any reason to prefer one to the other? How do I choose which
one I want? Can it be autodetected?
> > +
> > +/*
> > + * Ideally this function should just adjust the low memory size so
> MMIO fits,
> > + * everything else should be done in UEFI code
> > + */
> > +static void ovmf_pci_setup(void)
> > +{
>
> > [...]
> > +}
>
> This function looks very similar to (a slightly out of date version
> of)
> the standard pci_setup. What (if any) are the actual differences?
> The difference is that in ovmf_pci_setup(), we remove the code related to VGA
> setup, because we need to use the OVMF VGA bios.
> However, after Keir's comments, we have some testing and find that
> pci_setup() also works well for loading OVMF BIOS.
> So, we will remove the ovmf_pci_setup() and use the existing pci_setup()
> function.
Great.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|