hvmloader: Make ROM dependencies optional
v3 cover hvmloader: Make ROM dependencies optional
This patch set mainly allows the user to build a seabios or rombios only version of hvmloader.
In addition, when building a seabios only hvmloader, Option ROMs like vgabios and etherboot are no longer required, and therefore can be disabled from the build. Dependency on the bcc compiler can also be avoided the same way.
v2: Separate patches for separate issues
Introduced config option to select which NIC to build ROM for Fixed initial patch to build multiple etherboot ROMs in hvmloader Option ROMs are keyed off wether or not rombios is enabled, rather than
on an individual basis
Introduced config options to select support for rombios/seabios
v3: Fix mkhex script to take several file arguments on the command line
Reorganize hvmloader option ROM loading code to make it optionnal, and
make bios->load_roms a callback that the BIOS support code has to implement if option ROM loading is desired.
Cosmetic change in tools/firmware/Makefile in the way seabios-dir is
created.
Julian Pidancet (5):
hvmloader: Only compile 32bitbios_support.c when rombios is enabled
hvmloader: Allow the mkhex command to take several file arguments
firmware: Use mkhex from hvmloader directory for etherboot ROMs
hvmloader: Move option ROM loading into a separate optionnal file
firmware: Introduce CONFIG_ROMBIOS and CONFIG_SEABIOS options
Config.mk | 5 + tools/firmware/Makefile | 18 ++-- tools/firmware/etherboot/Config | 2 - tools/firmware/etherboot/Makefile | 13 +-- tools/firmware/hvmloader/Makefile | 39 ++++--- tools/firmware/hvmloader/config.h | 3 +- tools/firmware/hvmloader/hvmloader.c | 218 +-------------------------------- tools/firmware/hvmloader/mkhex | 3 +- tools/firmware/hvmloader/option_rom.h | 7 + tools/firmware/hvmloader/optionroms.c | 189 ++++++++++++++++++++++++++++ tools/firmware/hvmloader/rombios.c | 63 +++++++++- tools/firmware/hvmloader/seabios.c | 5 +- 12 files changed, 302 insertions(+), 263 deletions(-) create mode 100644 tools/firmware/hvmloader/optionroms.c
Signature · 1 line
Julian Pidancet
PATCH v3 1/5 hvmloader: Only compile 32bitbios_support.c when rombios is enabled
32bitbios_support.c only contains code specific to rombios, and should not be built-in when building hvmloader for SeaBIOS only (as for rombios.c).
--- tools/firmware/hvmloader/Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
tools/firmware/hvmloader/Makefile +2 -2
@@ -29,7 +29,7 @@ LOADADDR = 0x100000 CFLAGS += $(CFLAGS_xeninclude) OBJS = hvmloader.o mp_tables.o util.o smbios.o -OBJS += 32bitbios_support.o smp.o cacheattr.o xenbus.o +OBJS += smp.o cacheattr.o xenbus.o OBJS += e820.o pci.o pir.o ctype.o ifeq ($(debug),y) OBJS += tests.o
@@ -39,7 +39,7 @@ CIRRUSVGA_DEBUG ?= n ROMBIOS_DIR := ../rombios ifneq ($(ROMBIOS_DIR),) -OBJS += rombios.o +OBJS += 32bitbios_support.o rombios.o CFLAGS += -DENABLE_ROMBIOS ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest endif
Signature · 1 line
Julian Pidancet
Re: [PATCH v3 1/5] hvmloader: Only compile 32bitbios_support.c when rombios is enabled
Quoted 5 lines · Julian Pidancet
32bitbios_support.conly contains code specific to rombios, and should not be built-in when building hvmloader for SeaBIOS only (as forrombios.c).Signed-off-by Julian Pidancet <[email protected]>
I acked this patch last time too -- please collate Acks in repostings where no substantial change has been made to a patch so reviewers can save the effort.
Ian.
Quoted 26 lines
--- tools/firmware/hvmloader/Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)tools/firmware/hvmloader/Makefile +2
-2@@ -29,7 +29,7 @@ LOADADDR = 0x100000 CFLAGS += $(CFLAGS_xeninclude) OBJS = hvmloader.o mp_tables.o util.o smbios.o -OBJS += 32bitbios_support.o smp.o cacheattr.o xenbus.o +OBJS += smp.o cacheattr.o xenbus.o OBJS += e820.o pci.o pir.o ctype.o ifeq ($(debug),y) OBJS += tests.o@@ -39,7 +39,7 @@ CIRRUSVGA_DEBUG ?= n ROMBIOS_DIR := ../rombios ifneq ($(ROMBIOS_DIR),) -OBJS += rombios.o +OBJS += 32bitbios_support.o rombios.o CFLAGS += -DENABLE_ROMBIOS ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest endif
PATCH v3 2/5 hvmloader: Allow the mkhex command to take several file arguments
In reply to Julian Pidancet--- tools/firmware/hvmloader/mkhex | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
tools/firmware/hvmloader/mkhex +2 -1
@@ -21,6 +21,7 @@ # echo "unsigned $1[] = {" -od -v -t x $2 | sed 's/^[0-9]* */0x/' | sed 's/ */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//' +shift +od -v -t x $@ | sed 's/^[0-9]* */0x/' | sed 's/ */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//' echo "};"
Signature · 1 line
Julian Pidancet
Re: [PATCH v3 2/5] hvmloader: Allow the mkhex command to take several file arguments
Quoted 1 line · Julian Pidancet
Signed-off-by Julian Pidancet <[email protected]>
Quoted 17 lines
--- tools/firmware/hvmloader/mkhex | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)tools/firmware/hvmloader/mkhex +2
-1@@ -21,6 +21,7 @@ # echo "unsigned $1[] = {" -od -v -t x $2 | sed 's/^[0-9]* */0x/' | sed 's/ */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//' +shift +od -v -t x $@ | sed 's/^[0-9]* */0x/' | sed 's/ */, 0x/g' | sed 's/$/,/' | sed 's/0x,//' | sed 's/^[0-9]*,//' echo "};"
PATCH v3 3/5 firmware: Use mkhex from hvmloader directory for etherboot ROMs
In reply to Julian PidancetTo remain consistent with how other ROMs are built into hvmloader, call mkhex on etherboot ROMs from the hvmloader directory, instead of the etherboot directory. In other words, eb-roms.h is not used any more.
Introduce ETHERBOOT_NICS config option to choose which ROMs should be built (kept rtl8139 and 8086100e per default as before).
--- Config.mk | 2 ++ tools/firmware/etherboot/Config | 2 -- tools/firmware/etherboot/Makefile | 13 +++---------- tools/firmware/hvmloader/Makefile | 9 ++++++--- 4 files changed, 11 insertions(+), 15 deletions(-)
Config.mk +2 -0
@@ -222,6 +222,8 @@ endif QEMU_UPSTREAM_REVISION ?= master SEABIOS_UPSTREAM_TAG ?= rel-1.6.3.1 +ETHERBOOT_NICS ?= rtl8139 8086100e + # Specify which qemu-dm to use. This may be `ioemu' to use the old # Mercurial in-tree version, or a local directory, or a git URL. # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
tools/firmware/etherboot/Config +0 -2
@@ -1,6 +1,4 @@ -NICS = rtl8139 8086100e - CFLAGS += -UPXE_DHCP_STRICT CFLAGS += -DPXE_DHCP_STRICT
tools/firmware/etherboot/Makefile +3 -10
@@ -17,23 +17,16 @@ IPXE_TARBALL_URL := $(XEN_EXTFILES_URL)/ipxe-git-$(IPXE_GIT_TAG).tar.gz D=ipxe T=ipxe.tar.gz -ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(NICS))) +ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS))) .NOTPARALLEL: .PHONY: all -all: eb-roms.h +all: $(ROMS) %.rom: $D/src/arch/i386/Makefile $(MAKE) -C $D/src bin/$(*F).rom -eb-roms.h.new: $(ROMS) - cat $^ | ../hvmloader/mkhex etherboot >$@ - -eb-roms.h: Config - $(MAKE) NO_WERROR=1 [email protected] - mv -f [email protected] $@ - $T: if ! wget -O _$T $(IPXE_TARBALL_URL); then \ $(GIT) clone $(IPXE_GIT_URL) $D.git; \
@@ -56,7 +49,7 @@ $D/src/bin/NIC: $D/src/arch/i386/Makefile .PHONY: clean clean: - rm -rf $D $D.git *~ eb-roms.h _$T $T + rm -rf $D $D.git *~ _$T $T .PHONY: distclean distclean: clean
tools/firmware/hvmloader/Makefile +6 -3
@@ -58,6 +58,8 @@ else CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin endif +ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS))) + .PHONY: all all: subdirs-all $(MAKE) hvmloader
@@ -70,7 +72,7 @@ hvmloader: $(OBJS) acpi/acpi.a $(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) $(ETHERBOOT_ROMS) echo "/* Autogenerated file. DO NOT EDIT */" > [email protected] ifneq ($(ROMBIOS_ROM),)
@@ -95,10 +97,11 @@ ifneq ($(CIRRUSVGA_ROM),) sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected] echo "#endif" >> [email protected] endif - +ifneq ($(ETHERBOOT_ROMS),) echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> [email protected] - cat ../etherboot/eb-roms.h >> [email protected] + sh ./mkhex etherboot $(ETHERBOOT_ROMS) >> [email protected] echo "#endif" >> [email protected] +endif mv [email protected] $@
Signature · 1 line
Julian Pidancet
Re: [PATCH v3 3/5] firmware: Use mkhex from hvmloader directory for etherboot ROMs
Quoted 8 lines · Julian Pidancet
To remain consistent with how other ROMs are built into hvmloader, call mkhex on etherboot ROMs from the hvmloader directory, instead of the etherboot directory. In other words,
eb-roms.his not used any more.Introduce
ETHERBOOT_NICSconfig option to choose which ROMs should be built (kept rtl8139 and8086100eper default as before).Signed-off-by Julian Pidancet <[email protected]>
Quoted 106 lines
--- Config.mk | 2 ++ tools/firmware/etherboot/Config | 2 -- tools/firmware/etherboot/Makefile | 13 +++---------- tools/firmware/hvmloader/Makefile | 9 ++++++--- 4 files changed, 11 insertions(+), 15 deletions(-)Config.mk +2
-0@@ -222,6 +222,8 @@ endif QEMU_UPSTREAM_REVISION ?= master SEABIOS_UPSTREAM_TAG ?= rel-1.6.3.1 +ETHERBOOT_NICS ?= rtl8139 8086100e + # Specify which qemu-dm to use. This may be `ioemu' to use the old # Mercurial in-tree version, or a local directory, or a git URL. # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.gittools/firmware/etherboot/Config +0
-2@@ -1,6 +1,4 @@ -NICS = rtl8139 8086100e - CFLAGS += -UPXE_DHCP_STRICT CFLAGS += -DPXE_DHCP_STRICTtools/firmware/etherboot/Makefile +3
-10@@ -17,23 +17,16 @@ IPXE_TARBALL_URL := $(XEN_EXTFILES_URL)/ipxe-git-$(IPXE_GIT_TAG).tar.gz D=ipxe T=ipxe.tar.gz -ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(NICS))) +ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS))) .NOTPARALLEL: .PHONY: all -all: eb-roms.h +all: $(ROMS) %.rom: $D/src/arch/i386/Makefile $(MAKE) -C $D/src bin/$(*F).rom -eb-roms.h.new: $(ROMS) - cat $^ | ../hvmloader/mkhex etherboot >$@ - -eb-roms.h: Config - $(MAKE) NO_WERROR=1 [email protected] - mv -f [email protected] $@ - $T: if ! wget -O _$T $(IPXE_TARBALL_URL); then \ $(GIT) clone $(IPXE_GIT_URL) $D.git; \@@ -56,7 +49,7 @@ $D/src/bin/NIC: $D/src/arch/i386/Makefile .PHONY: clean clean: - rm -rf $D $D.git *~ eb-roms.h _$T $T + rm -rf $D $D.git *~ _$T $T .PHONY: distclean distclean: cleantools/firmware/hvmloader/Makefile +6
-3@@ -58,6 +58,8 @@ else CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin endif +ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS))) + .PHONY: all all: subdirs-all $(MAKE) hvmloader@@ -70,7 +72,7 @@ hvmloader: $(OBJS) acpi/acpi.a $(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) $(ETHERBOOT_ROMS) echo "/* Autogenerated file. DO NOT EDIT */" > [email protected] ifneq ($(ROMBIOS_ROM),)@@ -95,10 +97,11 @@ ifneq ($(CIRRUSVGA_ROM),) sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected] echo "#endif" >> [email protected] endif - +ifneq ($(ETHERBOOT_ROMS),) echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> [email protected] - cat ../etherboot/eb-roms.h >> [email protected] + sh ./mkhex etherboot $(ETHERBOOT_ROMS) >> [email protected] echo "#endif" >> [email protected] +endif mv [email protected] $@
PATCH v3 4/5 hvmloader: Move option ROM loading into a separate optionnal file
In reply to Julian PidancetMake load_rom field in struct bios_config an optionnal callback rather than a boolean value. It allow BIOS specific code to implement it's own option ROM loading methods.
Facilities to scan PCI devices, extract an deploy ROMs are moved into a separate file that can be compiled optionnaly.
--- tools/firmware/hvmloader/Makefile | 2 +- tools/firmware/hvmloader/config.h | 3 +- tools/firmware/hvmloader/hvmloader.c | 218 +-------------------------------- tools/firmware/hvmloader/option_rom.h | 7 + tools/firmware/hvmloader/optionroms.c | 189 ++++++++++++++++++++++++++++ tools/firmware/hvmloader/rombios.c | 63 +++++++++- tools/firmware/hvmloader/seabios.c | 5 +- 7 files changed, 259 insertions(+), 228 deletions(-) create mode 100644 tools/firmware/hvmloader/optionroms.c
tools/firmware/hvmloader/Makefile +1 -1
@@ -39,7 +39,7 @@ CIRRUSVGA_DEBUG ?= n ROMBIOS_DIR := ../rombios ifneq ($(ROMBIOS_DIR),) -OBJS += 32bitbios_support.o rombios.o +OBJS += optionroms.o 32bitbios_support.o rombios.o CFLAGS += -DENABLE_ROMBIOS ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest endif
tools/firmware/hvmloader/config.h +1 -2
@@ -18,8 +18,7 @@ struct bios_config {unsigned int bios_address;/* ROMS */ -int load_roms; -unsigned int optionrom_start, optionrom_end; +void (*load_roms)(void );void (*bios_load)(const struct bios_config *config);
tools/firmware/hvmloader/hvmloader.c +1 -217
253 lines not on this page · raw message
tools/firmware/hvmloader/option_rom.h +7 -0
@@ -47,6 +47,13 @@ struct option_rom_pci_header {uint16_t reserved; } __attribute__ ((packed)); +#define round_option_rom (x) (((x) + 2047) & ~2047) +int scan_etherboot_nic (unsigned int option_rom_end, +uint32_t copy_rom_dest, +void *etherboot_rom); +int pci_load_option_roms (unsigned int option_rom_end, +uint32_t rom_base_addr); +#endif /* __HVMLOADER_OPTION_ROM_H__ */ /*
tools/firmware/hvmloader/optionroms.c new file +189 -0
189 lines not on this page · raw message
tools/firmware/hvmloader/rombios.c +59 -4
85 lines not on this page · raw message
tools/firmware/hvmloader/seabios.c +1 -4
@@ -143,10 +143,7 @@ struct bios_config seabios_config = { .bios_address = SEABIOS_PHYSICAL_ADDRESS, - .load_roms = 0, - - .optionrom_start = 0, - .optionrom_end = 0, + .load_roms = NULL, .bios_load = NULL,
Signature · 1 line
Julian Pidancet
Re: [PATCH v3 4/5] hvmloader: Move option ROM loading into a separate optionnal file
Quoted 8 lines · Julian Pidancet
Make
load_romfield in structbios_configan optionnal callback rather than a boolean value. It allow BIOS specific code to implement it's own option ROM loading methods.Facilities to scan PCI devices, extract an deploy ROMs are moved into a separate file that can be compiled optionnaly.
Signed-off-by Julian Pidancet <[email protected]>
Presuming this to be mostly code motion I didn't review in depth but:
Quoted 624 lines
--- tools/firmware/hvmloader/Makefile | 2 +- tools/firmware/hvmloader/config.h | 3 +- tools/firmware/hvmloader/hvmloader.c | 218 +-------------------------------- tools/firmware/hvmloader/option_rom.h | 7 + tools/firmware/hvmloader/optionroms.c | 189 ++++++++++++++++++++++++++++ tools/firmware/hvmloader/rombios.c | 63 +++++++++- tools/firmware/hvmloader/seabios.c | 5 +- 7 files changed, 259 insertions(+), 228 deletions(-) create mode 100644 tools/firmware/hvmloader/optionroms.ctools/firmware/hvmloader/Makefile +1
-1@@ -39,7 +39,7 @@ CIRRUSVGA_DEBUG ?= n ROMBIOS_DIR := ../rombios ifneq ($(ROMBIOS_DIR),) -OBJS += 32bitbios_support.o rombios.o +OBJS += optionroms.o 32bitbios_support.o rombios.o CFLAGS += -DENABLE_ROMBIOS ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest endiftools/firmware/hvmloader/config.h +1
-2@@ -18,8 +18,7 @@ struct bios_config {unsigned int bios_address;/* ROMS */ -int load_roms; -unsigned int optionrom_start, optionrom_end; +void (*load_roms)(void );void (*bios_load)(const struct bios_config *config);tools/firmware/hvmloader/hvmloader.c +1
-217@@ -24,16 +24,11 @@#include "hypercall.h" #include "config.h" #include "pci_regs.h" -#include "option_rom.h" #include "apic_regs.h" #include "acpi/acpi2_0.h" #include <xen/version.h> #include <xen/hvm/params.h> -#define ROM_INCLUDE_VGABIOS -#define ROM_INCLUDE_ETHERBOOT -#include "roms.inc" - asm (" .text \n" " .globl _start \n"@@ -147,169 +142,6 @@ static void init_hypercalls(void)printf ("Detected Xen v%u.%u%s\n" , eax >>16 , eax &0xffff , extraversion); } -/* -* Scan the list of Option ROMs at @roms for one which supports -* PCI (@vendor_id, @device_id) found at slot @devfn. If one is found, -* copy it to @dest and return its size rounded up to a multiple 2kB. This -* function will not copy ROMs beyond address option_rom_end. -*/ -#define round_option_rom (x) (((x) + 2047) & ~2047) -static int scan_option_rom ( -unsigned int option_rom_end, -uint8_t devfn,uint16_t vendor_id,uint16_t device_id, -void *roms,uint32_t dest) -{ -struct option_rom_header *rom; -struct option_rom_pnp_header *pnph; -struct option_rom_pci_header *pcih; -uint8_t csum; -int i; - -static uint32_t orom_ids[64 ]; -static int nr_roms; - -/* Avoid duplicate ROMs. */ -for ( i =0 ; i < nr_roms; i++ ) -if ( orom_ids[i] == (vendor_id | ((uint32_t )device_id <<16 )) ) -return 0 ; - - rom = roms; -for ( ; ; ) - { -/* Invalid signature means we're out of option ROMs. */ -if (strncmp ((char *)rom->signature,"\x55\xaa" ,2 ) || - (rom->rom_size ==0 ) ) -break ; - -/* Invalid checksum means we're out of option ROMs. */ - csum =0 ; -for ( i =0 ; i < (rom->rom_size *512 ); i++ ) - csum += ((uint8_t *)rom)[i]; -if ( csum !=0 ) -break ; - -/* Check the PCI PnP header (if any) for a match. */ - pcih = (struct option_rom_pci_header *) - ((char *)rom + rom->pci_header_offset); -if ( (rom->pci_header_offset !=0 ) && - !strncmp ((char *)pcih->signature,"PCIR" ,4 ) && - (pcih->vendor_id == vendor_id) && - (pcih->device_id == device_id) ) - goto found; - - rom = (struct option_rom_header *) - ((char *)rom + rom->rom_size *512 ); - } - -return 0 ; - - found: -/* Find the PnP expansion header (if any). */ - pnph = ((rom->expansion_header_offset !=0 ) - ? ((struct option_rom_pnp_header *) - ((char *)rom + rom->expansion_header_offset)) - : ((struct option_rom_pnp_header *)NULL )); -while ( (pnph !=NULL ) &&strncmp ((char *)pnph->signature,"$PnP" ,4 ) ) - pnph = ((pnph->next_header_offset !=0 ) - ? ((struct option_rom_pnp_header *) - ((char *)rom + pnph->next_header_offset)) - : ((struct option_rom_pnp_header *)NULL )); - -printf ("Loading PCI Option ROM ...\n" ); -if ( (pnph !=NULL ) && (pnph->manufacturer_name_offset !=0 ) ) -printf (" - Manufacturer: %s\n" , - (char *)rom + pnph->manufacturer_name_offset); -if ( (pnph !=NULL ) && (pnph->product_name_offset !=0 ) ) -printf (" - Product name: %s\n" , - (char *)rom + pnph->product_name_offset); - -if ( (dest + rom->rom_size *512 +1 ) > option_rom_end ) - { -printf ("Option ROM size %x exceeds available space\n" , - rom->rom_size *512 ); -return 0 ; - } - - orom_ids[nr_roms++] = vendor_id | ((uint32_t )device_id <<16 ); -memcpy ((void *)dest, rom, rom->rom_size *512 ); - *(uint8_t *)(dest + rom->rom_size *512 ) = devfn; -return round_option_rom (rom->rom_size *512 +1 ); -} - -/* -* Scan the PCI bus for the first NIC supported by etherboot, and copy -* the corresponding rom data to *copy_rom_dest. Returns the length of the -* selected rom, or 0 if no NIC found. -*/ -static int scan_etherboot_nic (unsigned int option_rom_end, -uint32_t copy_rom_dest) -{ -uint16_t class, vendor_id, device_id, devfn; -int rom_size =0 ; - -for ( devfn =0 ; (devfn <256 ) && !rom_size; devfn++ ) - { - class =pci_readw (devfn,PCI_CLASS_DEVICE ); - vendor_id =pci_readw (devfn,PCI_VENDOR_ID ); - device_id =pci_readw (devfn,PCI_DEVICE_ID ); - -/* We're only interested in NICs. */ -if ( (vendor_id !=0xffff ) && - (device_id !=0xffff ) && - (class ==0x0200 ) ) - rom_size =scan_option_rom ( - option_rom_end, - devfn, vendor_id, device_id, etherboot, copy_rom_dest); - } - -return rom_size; -} - -/* -* Scan the PCI bus for the devices that have an option ROM, and copy -* the corresponding rom data to rom_phys_addr. -*/ -static int pci_load_option_roms (unsigned int option_rom_end, -uint32_t rom_base_addr) -{ -uint32_t option_rom_addr, rom_phys_addr = rom_base_addr; -uint16_t vendor_id, device_id, devfn, class; - -for ( devfn =0 ; devfn <256 ; devfn++ ) - { - class =pci_readb (devfn,PCI_CLASS_DEVICE +1 ); - vendor_id =pci_readw (devfn,PCI_VENDOR_ID ); - device_id =pci_readw (devfn,PCI_DEVICE_ID ); - -if ( (vendor_id ==0xffff ) && (device_id ==0xffff ) ) -continue ; - -/* -* Currently only scan options from mass storage devices and serial -* bus controller (Fibre Channel included). -*/ -if ( (class !=0x1 ) && (class !=0xc ) ) -continue ; - - option_rom_addr =pci_readl (devfn,PCI_ROM_ADDRESS ); -if ( !option_rom_addr ) -continue ; - -/* Ensure Expansion Bar is enabled before copying */ -pci_writel (devfn,PCI_ROM_ADDRESS , option_rom_addr |0x1 ); - - rom_phys_addr +=scan_option_rom ( - option_rom_end, - devfn, vendor_id, device_id, - (void *)(option_rom_addr & ~2047 ), rom_phys_addr); - -/* Restore the default original value of Expansion Bar */ -pci_writel (devfn,PCI_ROM_ADDRESS , option_rom_addr); - } - -return rom_phys_addr - rom_base_addr; -} -/* Replace possibly erroneous memory-size CMOS fields with correct values. */ static void cmos_write_memory_size (void ) {@@ -421,8 +253,6 @@ static void acpi_enable_sci(void)int main (void ) {const struct bios_config *bios; -int option_rom_sz =0 , vgabios_sz =0 , etherboot_sz =0 ; -uint32_t etherboot_phys_addr =0 , option_rom_phys_addr =0 ;int acpi_enabled;/* Initialise hypercall stubs with RET, rendering them no-ops. */ @@ -471,41 +301,7 @@ int main(void) }if ( bios->load_roms ) - { -switch ( virtual_vga ) - { -case VGA_cirrus: -printf ("Loading Cirrus VGABIOS ...\n" ); -memcpy ((void *)VGABIOS_PHYSICAL_ADDRESS , - vgabios_cirrusvga,sizeof (vgabios_cirrusvga)); - vgabios_sz =round_option_rom (sizeof (vgabios_cirrusvga)); -break ; -case VGA_std: -printf ("Loading Standard VGABIOS ...\n" ); -memcpy ((void *)VGABIOS_PHYSICAL_ADDRESS , - vgabios_stdvga,sizeof (vgabios_stdvga)); - vgabios_sz =round_option_rom (sizeof (vgabios_stdvga)); -break ; -case VGA_pt: -printf ("Loading VGABIOS of passthroughed gfx ...\n" ); - vgabios_sz =round_option_rom ( - (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS +2 )) *512 ); -break ; -default : -printf ("No emulated VGA adaptor ...\n" ); -break ; - } - - etherboot_phys_addr =VGABIOS_PHYSICAL_ADDRESS + vgabios_sz; -if ( etherboot_phys_addr < bios->optionrom_start ) - etherboot_phys_addr = bios->optionrom_start; - etherboot_sz =scan_etherboot_nic (bios->optionrom_end, - etherboot_phys_addr); - - option_rom_phys_addr = etherboot_phys_addr + etherboot_sz; - option_rom_sz =pci_load_option_roms (bios->optionrom_end, - option_rom_phys_addr); - } + bios->load_roms (); acpi_enabled = !strncmp (xenstore_read ("platform/acpi" ,"1" ),"1" ,1 );@@ -536,18 +332,6 @@ int main(void)if (SCRATCH_PHYSICAL_ADDRESS != scratch_start )printf (" %05x-%05lx: Scratch space\n" ,SCRATCH_PHYSICAL_ADDRESS , scratch_start); -if ( vgabios_sz ) -printf (" %05x-%05x: VGA BIOS\n" , -VGABIOS_PHYSICAL_ADDRESS , -VGABIOS_PHYSICAL_ADDRESS + vgabios_sz -1 ); -if ( etherboot_sz ) -printf (" %05x-%05x: Etherboot ROM\n" , - etherboot_phys_addr, - etherboot_phys_addr + etherboot_sz -1 ); -if ( option_rom_sz ) -printf (" %05x-%05x: PCI Option ROMs\n" , - option_rom_phys_addr, - option_rom_phys_addr + option_rom_sz -1 );printf (" %05x-%05x: Main BIOS\n" , bios->bios_address, bios->bios_address + bios->image_size -1 );tools/firmware/hvmloader/option_rom.h +7
-0@@ -47,6 +47,13 @@ struct option_rom_pci_header {uint16_t reserved; } __attribute__ ((packed)); +#define round_option_rom (x) (((x) + 2047) & ~2047) +int scan_etherboot_nic (unsigned int option_rom_end, +uint32_t copy_rom_dest, +void *etherboot_rom); +int pci_load_option_roms (unsigned int option_rom_end, +uint32_t rom_base_addr); +#endif /* __HVMLOADER_OPTION_ROM_H__ */ /* tools/firmware/hvmloader/optionroms.c new file +189
-0@@ -0,0 +1,189 @@ +/* +* optionroms.c: Option ROM loading support. +* +* Leendert van Doorn, [email protected] +* Copyright (c) 2005, International Business Machines Corporation. +* +* Copyright (c) 2006, Keir Fraser, XenSource Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; if not, write to the Free Software Foundation, Inc., 59 Temple +* Place - Suite 330, Boston, MA 02111-1307 USA. +*/ + +#include "config.h" +#include "option_rom.h" +#include "util.h" +#include "pci_regs.h" + +/* +* Scan the list of Option ROMs at @roms for one which supports +* PCI (@vendor_id, @device_id) found at slot @devfn. If one is found, +* copy it to @dest and return its size rounded up to a multiple 2kB. This +* function will not copy ROMs beyond address option_rom_end. +*/ +static int scan_option_rom ( +unsigned int option_rom_end, +uint8_t devfn,uint16_t vendor_id,uint16_t device_id, +void *roms,uint32_t dest) +{ +struct option_rom_header *rom; +struct option_rom_pnp_header *pnph; +struct option_rom_pci_header *pcih; +uint8_t csum; +int i; + +static uint32_t orom_ids[64 ]; +static int nr_roms; + +/* Avoid duplicate ROMs. */ +for ( i =0 ; i < nr_roms; i++ ) +if ( orom_ids[i] == (vendor_id | ((uint32_t )device_id <<16 )) ) +return 0 ; + + rom = roms; +for ( ; ; ) + { +/* Invalid signature means we're out of option ROMs. */ +if (strncmp ((char *)rom->signature,"\x55\xaa" ,2 ) || + (rom->rom_size ==0 ) ) +break ; + +/* Invalid checksum means we're out of option ROMs. */ + csum =0 ; +for ( i =0 ; i < (rom->rom_size *512 ); i++ ) + csum += ((uint8_t *)rom)[i]; +if ( csum !=0 ) +break ; + +/* Check the PCI PnP header (if any) for a match. */ + pcih = (struct option_rom_pci_header *) + ((char *)rom + rom->pci_header_offset); +if ( (rom->pci_header_offset !=0 ) && + !strncmp ((char *)pcih->signature,"PCIR" ,4 ) && + (pcih->vendor_id == vendor_id) && + (pcih->device_id == device_id) ) + goto found; + + rom = (struct option_rom_header *) + ((char *)rom + rom->rom_size *512 ); + } + +return 0 ; + + found: +/* Find the PnP expansion header (if any). */ + pnph = ((rom->expansion_header_offset !=0 ) + ? ((struct option_rom_pnp_header *) + ((char *)rom + rom->expansion_header_offset)) + : ((struct option_rom_pnp_header *)NULL )); +while ( (pnph !=NULL ) &&strncmp ((char *)pnph->signature,"$PnP" ,4 ) ) + pnph = ((pnph->next_header_offset !=0 ) + ? ((struct option_rom_pnp_header *) + ((char *)rom + pnph->next_header_offset)) + : ((struct option_rom_pnp_header *)NULL )); + +printf ("Loading PCI Option ROM ...\n" ); +if ( (pnph !=NULL ) && (pnph->manufacturer_name_offset !=0 ) ) +printf (" - Manufacturer: %s\n" , + (char *)rom + pnph->manufacturer_name_offset); +if ( (pnph !=NULL ) && (pnph->product_name_offset !=0 ) ) +printf (" - Product name: %s\n" , + (char *)rom + pnph->product_name_offset); + +if ( (dest + rom->rom_size *512 +1 ) > option_rom_end ) + { +printf ("Option ROM size %x exceeds available space\n" , + rom->rom_size *512 ); +return 0 ; + } + + orom_ids[nr_roms++] = vendor_id | ((uint32_t )device_id <<16 ); +memcpy ((void *)dest, rom, rom->rom_size *512 ); + *(uint8_t *)(dest + rom->rom_size *512 ) = devfn; +return round_option_rom (rom->rom_size *512 +1 ); +} + +/* +* Scan the PCI bus for the first NIC supported by etherboot, and copy +* the corresponding rom data to *copy_rom_dest. Returns the length of the +* selected rom, or 0 if no NIC found. +*/ +int scan_etherboot_nic (unsigned int option_rom_end, +uint32_t copy_rom_dest, +void *etherboot_rom) +{ +uint16_t class, vendor_id, device_id, devfn; +int rom_size =0 ; + +for ( devfn =0 ; (devfn <256 ) && !rom_size; devfn++ ) + { + class =pci_readw (devfn,PCI_CLASS_DEVICE ); + vendor_id =pci_readw (devfn,PCI_VENDOR_ID ); + device_id =pci_readw (devfn,PCI_DEVICE_ID ); + +/* We're only interested in NICs. */ +if ( (vendor_id !=0xffff ) && + (device_id !=0xffff ) && + (class ==0x0200 ) ) + rom_size =scan_option_rom ( + option_rom_end, + devfn, vendor_id, device_id, etherboot_rom, copy_rom_dest); + } + +return rom_size; +} + +/* +* Scan the PCI bus for the devices that have an option ROM, and copy +* the corresponding rom data to rom_phys_addr. +*/ +int pci_load_option_roms (unsigned int option_rom_end, +uint32_t rom_base_addr) +{ +uint32_t option_rom_addr, rom_phys_addr = rom_base_addr; +uint16_t vendor_id, device_id, devfn, class; + +for ( devfn =0 ; devfn <256 ; devfn++ ) + { + class =pci_readb (devfn,PCI_CLASS_DEVICE +1 ); + vendor_id =pci_readw (devfn,PCI_VENDOR_ID ); + device_id =pci_readw (devfn,PCI_DEVICE_ID ); + +if ( (vendor_id ==0xffff ) && (device_id ==0xffff ) ) +continue ; + +/* +* Currently only scan options from mass storage devices and serial +* bus controller (Fibre Channel included). +*/ +if ( (class !=0x1 ) && (class !=0xc ) ) +continue ; + + option_rom_addr =pci_readl (devfn,PCI_ROM_ADDRESS ); +if ( !option_rom_addr ) +continue ; + +/* Ensure Expansion Bar is enabled before copying */ +pci_writel (devfn,PCI_ROM_ADDRESS , option_rom_addr |0x1 ); + + rom_phys_addr +=scan_option_rom ( + option_rom_end, + devfn, vendor_id, device_id, + (void *)(option_rom_addr & ~2047 ), rom_phys_addr); + +/* Restore the default original value of Expansion Bar */ +pci_writel (devfn,PCI_ROM_ADDRESS , option_rom_addr); + } + +return rom_phys_addr - rom_base_addr; +}tools/firmware/hvmloader/rombios.c +59
-4@@ -29,10 +29,13 @@#include "pci_regs.h" #include "util.h" #include "hypercall.h" +#include "option_rom.h" #include <xen/hvm/params.h> #define ROM_INCLUDE_ROMBIOS +#define ROM_INCLUDE_VGABIOS +#define ROM_INCLUDE_ETHERBOOT #include "roms.inc" #define ROMBIOS_BEGIN 0x000F0000@@ -64,6 +67,61 @@ static void rombios_setup_bios_info(void)memset (info,0 ,sizeof (*info)); } +static void rombios_load_roms (void ) +{ +int option_rom_sz =0 , vgabios_sz =0 , etherboot_sz =0 ; +uint32_t etherboot_phys_addr =0 , option_rom_phys_addr =0 ; + +switch ( virtual_vga ) + { +case VGA_cirrus: +printf ("Loading Cirrus VGABIOS ...\n" ); +memcpy ((void *)VGABIOS_PHYSICAL_ADDRESS , + vgabios_cirrusvga,sizeof (vgabios_cirrusvga)); + vgabios_sz =round_option_rom (sizeof (vgabios_cirrusvga)); +break ; +case VGA_std: +printf ("Loading Standard VGABIOS ...\n" ); +memcpy ((void *)VGABIOS_PHYSICAL_ADDRESS , + vgabios_stdvga,sizeof (vgabios_stdvga)); + vgabios_sz =round_option_rom (sizeof (vgabios_stdvga)); +break ; +case VGA_pt: +printf ("Loading VGABIOS of passthroughed gfx ...\n" ); + vgabios_sz =round_option_rom ( + (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS +2 )) *512 ); +break ; +default : +printf ("No emulated VGA adaptor ...\n" ); +break ; + } + + etherboot_phys_addr =VGABIOS_PHYSICAL_ADDRESS + vgabios_sz; +if ( etherboot_phys_addr <OPTIONROM_PHYSICAL_ADDRESS ) + etherboot_phys_addr =OPTIONROM_PHYSICAL_ADDRESS ; + etherboot_sz =scan_etherboot_nic (OPTIONROM_PHYSICAL_END , + etherboot_phys_addr, + etherboot); + + option_rom_phys_addr = etherboot_phys_addr + etherboot_sz; + option_rom_sz =pci_load_option_roms (OPTIONROM_PHYSICAL_END , + option_rom_phys_addr); + +printf ("Option ROMs:\n" ); +if ( vgabios_sz ) +printf (" %05x-%05x: VGA BIOS\n" , +VGABIOS_PHYSICAL_ADDRESS , +VGABIOS_PHYSICAL_ADDRESS + vgabios_sz -1 ); +if ( etherboot_sz ) +printf (" %05x-%05x: Etherboot ROM\n" , + etherboot_phys_addr, + etherboot_phys_addr + etherboot_sz -1 ); +if ( option_rom_sz ) +printf (" %05x-%05x: PCI Option ROMs\n" , + option_rom_phys_addr, + option_rom_phys_addr + option_rom_sz -1 ); +} +static void rombios_load (const struct bios_config *config) {uint32_t bioshigh;@@ -158,10 +216,7 @@ struct bios_config rombios_config = { .bios_address = ROMBIOS_PHYSICAL_ADDRESS, - .load_roms = 1, - - .optionrom_start = OPTIONROM_PHYSICAL_ADDRESS, - .optionrom_end = OPTIONROM_PHYSICAL_END, + .load_roms = rombios_load_roms, .bios_load = rombios_load,tools/firmware/hvmloader/seabios.c +1
-5@@ -143,10 +143,7 @@ struct bios_config seabios_config = { .bios_address = SEABIOS_PHYSICAL_ADDRESS, - .load_roms = 0, - - .optionrom_start = 0, - .optionrom_end = 0, + .load_roms = NULL, .bios_load = NULL, --Julian Pidancet
PATCH v3 5/5 firmware: Introduce CONFIG_ROMBIOS and CONFIG_SEABIOS options
In reply to Julian PidancetThis patch introduces configuration options allowing to built either a rombios only or a seabios only hvmloader.
Building option ROMs like vgabios or etherboot is only enabled for a rombios hvmloader, since SeaBIOS takes care or extracting option ROMs itself from the PCI devices (these option ROMs are provided by the device model and do not need to be built in hvmloader).
The Makefile in tools/firmware/ now only checks for bcc if rombios is enabled.
These two configuration options are left on by default to remain compatible.
--- Config.mk | 3 +++ tools/firmware/Makefile | 18 ++++++++++-------- tools/firmware/hvmloader/Makefile | 32 +++++++++++++++++++------------- 3 files changed, 32 insertions(+), 21 deletions(-)
Config.mk +3 -0
@@ -224,6 +224,9 @@ SEABIOS_UPSTREAM_TAG ?= rel-1.6.3.1 ETHERBOOT_NICS ?= rtl8139 8086100e +CONFIG_ROMBIOS ?= y +CONFIG_SEABIOS ?= y + # Specify which qemu-dm to use. This may be `ioemu' to use the old # Mercurial in-tree version, or a local directory, or a git URL. # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
tools/firmware/Makefile +10 -8
@@ -5,19 +5,20 @@ include $(XEN_ROOT)/tools/Rules.mk TARGET := hvmloader/hvmloader INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR) -SUBDIRS := -SUBDIRS += seabios-dir -SUBDIRS += rombios -SUBDIRS += vgabios -SUBDIRS += etherboot -SUBDIRS += hvmloader +SUBDIRS-y := +SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir +SUBDIRS-$(CONFIG_ROMBIOS) += rombios +SUBDIRS-$(CONFIG_ROMBIOS) += vgabios +SUBDIRS-$(CONFIG_ROMBIOS) += etherboot +SUBDIRS-y += hvmloader seabios-dir: GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir cp seabios-config seabios-dir/.config; .PHONY: all -all: seabios-dir +all: $(SUBDIRS-y) +ifeq ($(CONFIG_ROMBIOS),y) @set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \ echo "==========================================================================="; \ echo "Require dev86 rpm or bin86 & bcc debs version >= 0.16.14 to build firmware!"; \
@@ -25,7 +26,8 @@ all: seabios-dir echo "==========================================================================="; \ false ; \ fi - $(MAKE) subdirs-$@; \ +endif + $(MAKE) subdirs-$@ .PHONY: install
tools/firmware/hvmloader/Makefile +19 -13
@@ -38,27 +38,33 @@ endif CIRRUSVGA_DEBUG ?= n ROMBIOS_DIR := ../rombios -ifneq ($(ROMBIOS_DIR),) -OBJS += optionroms.o 32bitbios_support.o rombios.o -CFLAGS += -DENABLE_ROMBIOS -ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest -endif - SEABIOS_DIR := ../seabios-dir -ifneq ($(SEABIOS_DIR),) -OBJS += seabios.o -CFLAGS += -DENABLE_SEABIOS -SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin -endif +ifeq ($(CONFIG_ROMBIOS),y) STDVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.bin ifeq ($(CIRRUSVGA_DEBUG),y) CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin else CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin endif - ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS))) +endif + +ROMS := + +ifeq ($(CONFIG_ROMBIOS),y) +OBJS += optionroms.o 32bitbios_support.o rombios.o +CFLAGS += -DENABLE_ROMBIOS +ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest +ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS) +endif + +ifeq ($(CONFIG_SEABIOS),y) +OBJS += seabios.o +CFLAGS += -DENABLE_SEABIOS +SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin +ROMS += $(SEABIOS_ROM) +endif .PHONY: all all: subdirs-all
@@ -72,7 +78,7 @@ hvmloader: $(OBJS) acpi/acpi.a $(OBJCOPY) hvmloader.tmp hvmloader rm -f hvmloader.tmp -roms.inc: $(ROMBIOS_ROM) $(SEABIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS) +roms.inc: $(ROMS) echo "/* Autogenerated file. DO NOT EDIT */" > [email protected] ifneq ($(ROMBIOS_ROM),)
Signature · 1 line
Julian Pidancet
Re: [PATCH v3 5/5] firmware: Introduce CONFIG_ROMBIOS and CONFIG_SEABIOS options
Quoted 8 lines · Julian Pidancet
This patch introduces configuration options allowing to built either a rombios only or a seabios only hvmloader.
Building option ROMs like vgabios or etherboot is only enabled for a rombios hvmloader, since SeaBIOS takes care or extracting option ROMs itself from the PCI devices (these option ROMs are provided by the device model and do not need to be built in hvmloader).
Quoted 7 lines
The
Makefileintools/firmware/now only checks for bcc if rombios is enabled.These two configuration options are left on by default to remain compatible.
Signed-off-by Julian Pidancet <[email protected]>
Keir Fraser
AppliedQuoted 6 lines · Julian Pidancet
This patch set mainly allows the user to build a seabios or rombios only version of hvmloader.
In addition, when building a seabios only hvmloader, Option ROMs like vgabios and etherboot are no longer required, and therefore can be disabled from the build. Dependency on the bcc compiler can also be avoided the same way.
Applied, but I wonder why we still have the rombios support? Could we switch over to seabios for 4.2 and get rid of the crufty old rombios code entirely?
-- Keir
Quoted 36 lines
v2: Separate patches for separate issues
Introduced config option to select which NIC to build ROM for Fixed initial patch to build multiple etherboot ROMs in hvmloader Option ROMs are keyed off wether or not rombios is enabled, rather than
on an individual basis
Introduced config options to select support for rombios/seabiosv3: Fix mkhex script to take several file arguments on the command line
Reorganize hvmloader option ROM loading code to make it optionnal, and
makebios->load_romsa callback that the BIOS support code has to implement if option ROM loading is desired.
Cosmetic change intools/firmware/Makefilein the way seabios-dir is
created.Julian Pidancet (5):
hvmloader: Only compile32bitbios_support.cwhen rombios is enabled
hvmloader: Allow the mkhex command to take several file arguments
firmware: Use mkhex from hvmloader directory for etherboot ROMs
hvmloader: Move option ROM loading into a separate optionnal file
firmware: IntroduceCONFIG_ROMBIOSandCONFIG_SEABIOSoptionsConfig.mk | 5 + tools/firmware/Makefile | 18 ++-- tools/firmware/etherboot/Config | 2 - tools/firmware/etherboot/Makefile | 13 +-- tools/firmware/hvmloader/Makefile | 39 ++++--- tools/firmware/hvmloader/config.h | 3 +- tools/firmware/hvmloader/hvmloader.c | 218 +-------------------------------- tools/firmware/hvmloader/mkhex | 3 +- tools/firmware/hvmloader/option_rom.h | 7 + tools/firmware/hvmloader/optionroms.c | 189 ++++++++++++++++++++++++++++ tools/firmware/hvmloader/rombios.c | 63 +++++++++- tools/firmware/hvmloader/seabios.c | 5 +- 12 files changed, 302 insertions(+), 263 deletions(-) create mode 100644 tools/firmware/hvmloader/optionroms.c
Quoted 11 lines · Keir Fraser
Quoted 6 lines · Julian Pidancet
This patch set mainly allows the user to build a seabios or rombios only version of hvmloader.
In addition, when building a seabios only hvmloader, Option ROMs like vgabios and etherboot are no longer required, and therefore can be disabled from the build. Dependency on the bcc compiler can also be avoided the same way.Applied, but I wonder why we still have the rombios support? Could we switch over to seabios for 4.2 and get rid of the crufty old rombios code entirely?
We still use ROMBIOS with the traditional qemu-xen tree, I think we have to do that for compatibility with existing guests, for the same reason as we need to continue to support that traditional qemu-xen tree.
Post 4.2 we will be switching the default qemu to the upstream tree which uses SeaBIOS at which point the old-qemu+ROMBIOS combo becomes legacy/frozen etc. We don't support new-qemu+ROMBIOS nor old-qemu +SEABIOS.
Ian.
Quoted 41 lines
-- Keir
Quoted 36 lines
v2: Separate patches for separate issues
Introduced config option to select which NIC to build ROM for Fixed initial patch to build multiple etherboot ROMs in hvmloader Option ROMs are keyed off wether or not rombios is enabled, rather than
on an individual basis
Introduced config options to select support for rombios/seabiosv3: Fix mkhex script to take several file arguments on the command line
Reorganize hvmloader option ROM loading code to make it optionnal, and
makebios->load_romsa callback that the BIOS support code has to implement if option ROM loading is desired.
Cosmetic change intools/firmware/Makefilein the way seabios-dir is
created.Julian Pidancet (5):
hvmloader: Only compile32bitbios_support.cwhen rombios is enabled
hvmloader: Allow the mkhex command to take several file arguments
firmware: Use mkhex from hvmloader directory for etherboot ROMs
hvmloader: Move option ROM loading into a separate optionnal file
firmware: IntroduceCONFIG_ROMBIOSandCONFIG_SEABIOSoptionsConfig.mk | 5 + tools/firmware/Makefile | 18 ++-- tools/firmware/etherboot/Config | 2 - tools/firmware/etherboot/Makefile | 13 +-- tools/firmware/hvmloader/Makefile | 39 ++++--- tools/firmware/hvmloader/config.h | 3 +- tools/firmware/hvmloader/hvmloader.c | 218 +-------------------------------- tools/firmware/hvmloader/mkhex | 3 +- tools/firmware/hvmloader/option_rom.h | 7 + tools/firmware/hvmloader/optionroms.c | 189 ++++++++++++++++++++++++++++ tools/firmware/hvmloader/rombios.c | 63 +++++++++- tools/firmware/hvmloader/seabios.c | 5 +- 12 files changed, 302 insertions(+), 263 deletions(-) create mode 100644 tools/firmware/hvmloader/optionroms.c
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Keir Fraser
Quoted 6 lines · Julian Pidancet
This patch set mainly allows the user to build a seabios or rombios only version of hvmloader.
In addition, when building a seabios only hvmloader, Option ROMs like vgabios and etherboot are no longer required, and therefore can be disabled from the build. Dependency on the bcc compiler can also be avoided the same way.
Quoted 6 lines
Quoted 2 lines
Applied, but I wonder why we still have the rombios support? Could we switch over to seabios for 4.2 and get rid of the crufty old rombios code entirely?
We still use ROMBIOS with the traditional qemu-xen tree, I think we have to do that for compatibility with existing guests, for the same reason as we need to continue to support that traditional qemu-xen tree.
So guests that were installed with old qemu need to always boot with old qemu? Because if the compatibility issue is only with saved guests, then we don't need to keep old ROMBIOS around as it lives in saved-guest memory.
-- Keir
Quoted 50 lines
Post 4.2 we will be switching the default qemu to the upstream tree which uses SeaBIOS at which point the old-qemu+ROMBIOS combo becomes legacy/frozen etc. We don't support new-qemu+ROMBIOS nor old-qemu +SEABIOS.
Ian.
Quoted 41 lines
-- Keir
Quoted 36 lines
v2: Separate patches for separate issues
Introduced config option to select which NIC to build ROM for Fixed initial patch to build multiple etherboot ROMs in hvmloader Option ROMs are keyed off wether or not rombios is enabled, rather than
on an individual basis
Introduced config options to select support for rombios/seabiosv3: Fix mkhex script to take several file arguments on the command line
Reorganize hvmloader option ROM loading code to make it optionnal, and
makebios->load_romsa callback that the BIOS support code has to implement if option ROM loading is desired.
Cosmetic change intools/firmware/Makefilein the way seabios-dir is
created.Julian Pidancet (5):
hvmloader: Only compile32bitbios_support.cwhen rombios is enabled
hvmloader: Allow the mkhex command to take several file arguments
firmware: Use mkhex from hvmloader directory for etherboot ROMs
hvmloader: Move option ROM loading into a separate optionnal file
firmware: IntroduceCONFIG_ROMBIOSandCONFIG_SEABIOSoptionsConfig.mk | 5 + tools/firmware/Makefile | 18 ++-- tools/firmware/etherboot/Config | 2 - tools/firmware/etherboot/Makefile | 13 +-- tools/firmware/hvmloader/Makefile | 39 ++++--- tools/firmware/hvmloader/config.h | 3 +- tools/firmware/hvmloader/hvmloader.c | 218 +-------------------------------- tools/firmware/hvmloader/mkhex | 3 +- tools/firmware/hvmloader/option_rom.h | 7 + tools/firmware/hvmloader/optionroms.c | 189 ++++++++++++++++++++++++++++ tools/firmware/hvmloader/rombios.c | 63 +++++++++- tools/firmware/hvmloader/seabios.c | 5 +- 12 files changed, 302 insertions(+), 263 deletions(-) create mode 100644 tools/firmware/hvmloader/optionroms.c
Quoted 15 lines · Keir Fraser
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Keir Fraser
Quoted 6 lines · Julian Pidancet
This patch set mainly allows the user to build a seabios or rombios only version of hvmloader.
In addition, when building a seabios only hvmloader, Option ROMs like vgabios and etherboot are no longer required, and therefore can be disabled from the build. Dependency on the bcc compiler can also be avoided the same way.Applied, but I wonder why we still have the rombios support? Could we switch over to seabios for 4.2 and get rid of the crufty old rombios code entirely?
Quoted 6 lines
Quoted 3 lines
We still use ROMBIOS with the traditional qemu-xen tree, I think we have to do that for compatibility with existing guests, for the same reason as we need to continue to support that traditional qemu-xen tree.
So guests that were installed with old qemu need to always boot with old qemu?
That's the claim at least WRT guests like Windows where we aren't confident in the ability to change "motherboard" under its feet.
I think we've basically just taken the conservative decision to put qemu-xen-traditional+ROMBIOS into "deep freeze" and keep supporting them due to lack of concrete evidence and because "deep freeze" means (or should mean) very low effort.
If there were evidence that this kind of BIOS+motherboard upgrade doesn't make guests unhappy then it's an easy position to undo.
Ian.