This is version 5 of Xen side patches. Patches that have been applied are not resent. Two patches to build system are added to this series. Still waiting for OVMF side patches to get merged. The main purpose for sending this series is to let people review the newly added build system patches. Wei. Changes in V5: * add patches for build system Changes in V4: * go back to dedicated OVMF info structure, 64 bit ready Changes in V3: * move seabios_info to common code * e820 entry number is 16 again, one can bump it when necessary * reserve low reset vector in E820 map in OVMF Changes in V2: * ovmf_info is now almost the same as seabios_info * bump e820 entry number to 128 * modify build_e820_table to avoid BIOS region reservation if there''s none Wei Liu (4): hvmloader/ovmf: setup ovmf_info hvmloader/ovmf: setup E820 map tools: enable OVMF build for Linux by default tools/ovmf-makefile: only build debug target when specified tools/configure | 24 ++++++++------- tools/configure.ac | 17 ++++++++++- tools/firmware/hvmloader/ovmf.c | 61 +++++++++++++++++++++++++++++++++++++-- tools/firmware/ovmf-makefile | 19 ++++++++---- 4 files changed, 101 insertions(+), 20 deletions(-) -- 1.7.10.4
OVMF info contains E820 map allocated by hvmloader. This info is passed to OVMF to help it do proper initialization. Currently only E820 is necessary, but we reserve spaces for other tables in ovmf_info for later usage. Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- tools/firmware/hvmloader/ovmf.c | 48 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c index a67a2de..d50e2b2 100644 --- a/tools/firmware/hvmloader/ovmf.c +++ b/tools/firmware/hvmloader/ovmf.c @@ -46,10 +46,54 @@ #define LOWCHUNK_SIZE 0x00010000 #define LOWCHUNK_MAXOFFSET 0x0000FFFF #define LOWCHUNK_END (OVMF_BEGIN + OVMF_SIZE) +#define OVMF_INFO_PHYSICAL_ADDRESS 0x00001000 extern unsigned char dsdt_anycpu[]; extern int dsdt_anycpu_len; +#define OVMF_INFO_MAX_TABLES 4 +struct ovmf_info { + char signature[14]; /* XenHVMOVMF\0\0\0\0 */ + uint8_t length; /* Length of this struct */ + uint8_t checksum; /* Set such that the sum over bytes 0..length == 0 */ + /* + * Physical address of an array of tables_nr elements. + * + * Each element is a 64 bit value containing the physical address + * of a BIOS table. + */ + uint64_t tables; + uint32_t tables_nr; + /* + * Physical address of the e820 table, contains e820_nr entries. + */ + uint64_t e820; + uint32_t e820_nr; +} __attribute__ ((packed)); + +static void ovmf_setup_bios_info(void) +{ + struct ovmf_info *info = (void *)OVMF_INFO_PHYSICAL_ADDRESS; + + memset(info, 0, sizeof(*info)); + + memcpy(info->signature, "XenHVMOVMF", sizeof(info->signature)); + info->length = sizeof(*info); +} + +static void ovmf_finish_bios_info(void) +{ + struct ovmf_info *info = (void *)OVMF_INFO_PHYSICAL_ADDRESS; + uint32_t i; + uint8_t checksum; + + checksum = 0; + for ( i = 0; i < info->length; i++ ) + checksum += ((uint8_t *)(info))[i]; + + info->checksum = -checksum; +} + static void ovmf_load(const struct bios_config *config) { xen_pfn_t mfn; @@ -104,8 +148,8 @@ struct bios_config ovmf_config = { .load_roms = 0, - .bios_info_setup = NULL, - .bios_info_finish = NULL, + .bios_info_setup = ovmf_setup_bios_info, + .bios_info_finish = ovmf_finish_bios_info, .e820_setup = NULL, -- 1.7.10.4
E820 map will be used by OVMF to create memory map. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> --- tools/firmware/hvmloader/ovmf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c index d50e2b2..28dd7bc 100644 --- a/tools/firmware/hvmloader/ovmf.c +++ b/tools/firmware/hvmloader/ovmf.c @@ -137,6 +137,17 @@ static void ovmf_create_smbios_tables(void) SMBIOS_PHYSICAL_END); } +static void ovmf_setup_e820(void) +{ + struct ovmf_info *info = (void *)OVMF_INFO_PHYSICAL_ADDRESS; + struct e820entry *e820 = scratch_alloc(sizeof(struct e820entry)*16, 0); + info->e820 = (uint32_t)e820; + + /* Reserve LOWCHUNK_BEGIN to 0x100000 as well, that''s reset vector. */ + info->e820_nr = build_e820_table(e820, 0, LOWCHUNK_BEGIN); + dump_e820_table(e820, info->e820_nr); +} + struct bios_config ovmf_config = { .name = "OVMF", @@ -151,7 +162,7 @@ struct bios_config ovmf_config = { .bios_info_setup = ovmf_setup_bios_info, .bios_info_finish = ovmf_finish_bios_info, - .e820_setup = NULL, + .e820_setup = ovmf_setup_e820, .acpi_build_tables = ovmf_acpi_build_tables, .create_mp_tables = NULL, -- 1.7.10.4
Wei Liu
2013-Dec-05 17:29 UTC
[PATCH V5 3/4] tools: enable OVMF build for Linux by default
Now OVMF can build on Linux, but not NetBSD. I suspect it won''t build on FreeBSD either. Even if we fix OVMF build script, it requires upstream QEMU, which to the best of my knowledge is not available in *BSD Xen build at the moment. So the simple thing to do is to only enable OVMF build for Linux. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Roger Pau Monne <roger.pau@citrix.com> --- tools/configure | 24 +++++++++++++----------- tools/configure.ac | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/tools/configure b/tools/configure index ff82b32..0bcc922 100755 --- a/tools/configure +++ b/tools/configure @@ -1422,7 +1422,8 @@ Optional Features: --enable-xenapi Enable Xen API Bindings (default is DISABLED) --disable-ocamltools Disable Ocaml tools (default is ENABLED) --disable-xsmpolicy Disable XSM policy compilation (default is ENABLED) - --enable-ovmf Enable OVMF (default is DISABLED) + --enable-ovmf Enable OVMF build, (DEFAULT is on for Linux, + otherwise off) --disable-rombios Disable ROM BIOS (default is ENABLED) --disable-seabios Disable SeaBIOS (default is ENABLED) --disable-debug Disable debug build of tools (default is ENABLED) @@ -3571,23 +3572,24 @@ xsmpolicy=$ax_cv_xsmpolicy # Check whether --enable-ovmf was given. if test "${enable_ovmf+set}" = set; then : enableval=$enable_ovmf; -fi - - -if test "x$enable_ovmf" = "xno"; then : +else - ax_cv_ovmf="n" + case $host_os in + linux*) + enable_ovmf="yes";; + *) enable_ovmf="no";; + esac -elif test "x$enable_ovmf" = "xyes"; then : +fi - ax_cv_ovmf="y" +if test "x$enable_ovmf" = "xyes"; then : -elif test -z $ax_cv_ovmf; then : + ovmf=y +else - ax_cv_ovmf="n" + ovmf=n fi -ovmf=$ax_cv_ovmf diff --git a/tools/configure.ac b/tools/configure.ac index b2941a4..c317932 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -53,7 +53,22 @@ AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools]) AX_ARG_DEFAULT_DISABLE([xenapi], [Enable Xen API Bindings]) AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools]) AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation]) -AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF]) + +AC_ARG_ENABLE([ovmf], + AS_HELP_STRING([--enable-ovmf], + [Enable OVMF build, (DEFAULT is on for Linux, otherwise off)]),,[ + case $host_os in + linux*) + enable_ovmf="yes";; + *) enable_ovmf="no";; + esac +]) +AS_IF([test "x$enable_ovmf" = "xyes"], [ + ovmf=y],[ + ovmf=n +]) +AC_SUBST(ovmf) + AX_ARG_DEFAULT_ENABLE([rombios], [Disable ROM BIOS]) AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS]) AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools]) -- 1.7.10.4
Wei Liu
2013-Dec-05 17:29 UTC
[PATCH V5 4/4] tools/ovmf-makefile: only build debug target when specified
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- tools/firmware/ovmf-makefile | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/firmware/ovmf-makefile b/tools/firmware/ovmf-makefile index 073ed44..1ad041f 100644 --- a/tools/firmware/ovmf-makefile +++ b/tools/firmware/ovmf-makefile @@ -1,16 +1,25 @@ # OVMF building system is not ready yet to run in parallel. # Force it to be serial in order to exploit parallelism for neighbors. +XEN_ROOT=$(CURDIR)/../../.. +include $(XEN_ROOT)/tools/Rules.mk + +ifeq ($(debug),y) +TARGET=DEBUG +else +TARGET=RELEASE +endif + .NOTPARALLEL: MAKEFLAGS += -j1 .PHONY: all -all: ovmf.bin +all: build -.PHONY: ovmf.bin -ovmf.bin: - OvmfPkg/build.sh -a X64 - cp Build/OvmfX64/DEBUG_GCC*/FV/OVMF.fd ovmf.bin +.PHONY: build +build: + OvmfPkg/build.sh -a X64 -b $(TARGET) + cp Build/OvmfX64/$(TARGET)_GCC*/FV/OVMF.fd ovmf.bin .PHONY: clean clean: -- 1.7.10.4
On Thu, 2013-12-05 at 17:29 +0000, Wei Liu wrote:> This is version 5 of Xen side patches. Patches that have been applied are not > resent. > > Two patches to build system are added to this series. > > Still waiting for OVMF side patches to get merged. The main purpose for sending > this series is to let people review the newly added build system patches.I''d already acked #2, the other 3 are now: Acked-by: Ian Campbell <ian.campbell@citrix.com> (you forgot to CC the maintainers and George, I''ve done it here)> > Wei. > > Changes in V5: > * add patches for build system > > Changes in V4: > * go back to dedicated OVMF info structure, 64 bit ready > > Changes in V3: > * move seabios_info to common code > * e820 entry number is 16 again, one can bump it when necessary > * reserve low reset vector in E820 map in OVMF > > Changes in V2: > * ovmf_info is now almost the same as seabios_info > * bump e820 entry number to 128 > * modify build_e820_table to avoid BIOS region reservation if there''s none > > Wei Liu (4): > hvmloader/ovmf: setup ovmf_info > hvmloader/ovmf: setup E820 map > tools: enable OVMF build for Linux by default > tools/ovmf-makefile: only build debug target when specified > > tools/configure | 24 ++++++++------- > tools/configure.ac | 17 ++++++++++- > tools/firmware/hvmloader/ovmf.c | 61 +++++++++++++++++++++++++++++++++++++-- > tools/firmware/ovmf-makefile | 19 ++++++++---- > 4 files changed, 101 insertions(+), 20 deletions(-) >
Il 05/12/2013 18:29, Wei Liu ha scritto:> This is version 5 of Xen side patches. Patches that have been applied are not > resent. > > Two patches to build system are added to this series. > > Still waiting for OVMF side patches to get merged. The main purpose for sending > this series is to let people review the newly added build system patches. > > Wei. > > Changes in V5: > * add patches for build system > > Changes in V4: > * go back to dedicated OVMF info structure, 64 bit ready > > Changes in V3: > * move seabios_info to common code > * e820 entry number is 16 again, one can bump it when necessary > * reserve low reset vector in E820 map in OVMF > > Changes in V2: > * ovmf_info is now almost the same as seabios_info > * bump e820 entry number to 128 > * modify build_e820_table to avoid BIOS region reservation if there''s none > > Wei Liu (4): > hvmloader/ovmf: setup ovmf_info > hvmloader/ovmf: setup E820 map > tools: enable OVMF build for Linux by default > tools/ovmf-makefile: only build debug target when specified > > tools/configure | 24 ++++++++------- > tools/configure.ac | 17 ++++++++++- > tools/firmware/hvmloader/ovmf.c | 61 +++++++++++++++++++++++++++++++++++++-- > tools/firmware/ovmf-makefile | 19 ++++++++---- > 4 files changed, 101 insertions(+), 20 deletions(-) >Is "libxl: bump LIBXL_MAXMEM_CONSTANT to 2048" patch no longer needed? Thanks for any reply.
On Fri, Dec 06, 2013 at 10:01:01AM +0100, Fabio Fantoni wrote:> Il 05/12/2013 18:29, Wei Liu ha scritto: > >This is version 5 of Xen side patches. Patches that have been applied are not > >resent. > > > >Two patches to build system are added to this series. > > > >Still waiting for OVMF side patches to get merged. The main purpose for sending > >this series is to let people review the newly added build system patches. > > > >Wei. > > > >Changes in V5: > >* add patches for build system > > > >Changes in V4: > >* go back to dedicated OVMF info structure, 64 bit ready > > > >Changes in V3: > >* move seabios_info to common code > >* e820 entry number is 16 again, one can bump it when necessary > >* reserve low reset vector in E820 map in OVMF > > > >Changes in V2: > >* ovmf_info is now almost the same as seabios_info > >* bump e820 entry number to 128 > >* modify build_e820_table to avoid BIOS region reservation if there''s none > > > >Wei Liu (4): > > hvmloader/ovmf: setup ovmf_info > > hvmloader/ovmf: setup E820 map > > tools: enable OVMF build for Linux by default > > tools/ovmf-makefile: only build debug target when specified > > > > tools/configure | 24 ++++++++------- > > tools/configure.ac | 17 ++++++++++- > > tools/firmware/hvmloader/ovmf.c | 61 +++++++++++++++++++++++++++++++++++++-- > > tools/firmware/ovmf-makefile | 19 ++++++++---- > > 4 files changed, 101 insertions(+), 20 deletions(-) > > > > Is "libxl: bump LIBXL_MAXMEM_CONSTANT to 2048" patch no longer needed? >No, it''s not necessary anymore. Wei.> Thanks for any reply.
On Thu, 2013-12-05 at 17:29 +0000, Wei Liu wrote:> This is version 5 of Xen side patches. Patches that have been applied are not > resent. > > Two patches to build system are added to this series. > > Still waiting for OVMF side patches to get merged. The main purpose for sending > this series is to let people review the newly added build system patches.As discussed in the 4.4 dev update thread I''ve applied #1, #2 and #4 leaving #3 (tools: enable OVMF build for Linux by default) until the OVMF side is committed upstream.