Skip to contentSkip to conversation

Load ipxe from a standalone file

PATCH Superseded Wei Liu 4 participants 18 messages Jun 25, 2018 – Jul 5, 2018

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Load ipxe from a standalone file

Addressed some comments in this new version.

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Anoob Soman <[email protected]>
Cc Doug Goldstein <[email protected]>

Wei Liu (6):
Tools.mk.in: drop unused variables
ipxe: produce a single binary from its build
libxc: allow HVM guest to have modules
tools: load IPXE from standalone file
tools: provide --with-system-ipxe
tools: --with-system-{ovmf,seabios,ipxe} should provide absolute paths

 config/Tools.mk.in                   |  3 +-
 tools/config.h.in                    |  3 ++
 tools/configure                      | 56 ++++++++++++++++++++++++++++++++++++
 tools/configure.ac                   | 21 ++++++++++++++
 tools/firmware/Makefile              |  6 ++++
 tools/firmware/etherboot/Makefile    |  7 ++++-
 tools/firmware/hvmloader/Makefile    |  9 +-----
 tools/firmware/hvmloader/config.h    |  3 +-
 tools/firmware/hvmloader/hvmloader.c | 10 +++++--
 tools/firmware/hvmloader/ovmf.c      |  3 +-
 tools/firmware/hvmloader/rombios.c   | 24 +++++++++++-----
 tools/firmware/hvmloader/seabios.c   |  3 +-
 tools/libxc/xc_dom_x86.c             | 32 ++++++++++++---------
 tools/libxl/libxl_dom.c              | 10 +++++++
 tools/libxl/libxl_internal.h         |  1 +
 tools/libxl/libxl_paths.c            |  9 ++++++
 16 files changed, 163 insertions(+), 37 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#1 lore raw

PATCH v2 1/6 Tools.mk.in: drop unused variables

---
Cc: Ian Jackson <[email protected]>

---
 config/Tools.mk.in | 2 --
 1 file changed, 2 deletions(-)
config/Tools.mk.in +0 -2
index 2d6c440324..4cc9f29090 100644
@@ -20,8 +20,6 @@ BCC                 := @BCC@
 IASL                := @IASL@
 AWK                 := @AWK@
 FETCHER             := @FETCHER@
-SEABIOS_PATH        := @seabios_path@
-OVMF_PATH           := @ovmf_path@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#5 lore raw

PATCH v2 3/6 libxc: allow HVM guest to have modules

In reply to Wei Liu

Lift the loading code out of PVH specific branch. Take the chance to make the debug message more useful.

IPXE will be loaded as a module of Rombios.

---
Cc: Ian Jackson <[email protected]>

---
 tools/libxc/xc_dom_x86.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)
tools/libxc/xc_dom_x86.c +18 -14
index e33a28847d..ed4973a997 100644
@@ -1698,20 +1698,6 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                                 ((uintptr_t)cmdline - (uintptr_t)start_info);
         }
 
-        for ( i = 0; i < dom->num_modules; i++ )
-        {
-            struct xc_hvm_firmware_module mod;
-
-            DOMPRINTF("Adding module %u", i);
-            mod.guest_addr_out =
-                dom->modules[i].seg.vstart - dom->parms.virt_base;
-            mod.length =
-                dom->modules[i].seg.vend - dom->modules[i].seg.vstart;
-
-            add_module_to_list(dom, &mod, dom->modules[i].cmdline,
-                               modlist, start_info);
-        }
-
         /* ACPI module 0 is the RSDP */
         start_info->rsdp_paddr = dom->acpi_modules[0].guest_addr_out ? : 0;
     }
@@ -1721,6 +1707,24 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                            modlist, start_info);
     }
 
+    for ( i = 0; i < dom->num_modules; i++ )
+    {
+        struct xc_hvm_firmware_module mod;
+        uint64_t base = dom->parms.virt_base != UNSET_ADDR ?
+            dom->parms.virt_base : 0;
+
+        mod.guest_addr_out =
+            dom->modules[i].seg.vstart - base;
+        mod.length =
+            dom->modules[i].seg.vend - dom->modules[i].seg.vstart;
+
+        DOMPRINTF("Adding module %u guest_addr %"PRIx64" len %u",
+                  i, mod.guest_addr_out, mod.length);
+
+        add_module_to_list(dom, &mod, dom->modules[i].cmdline,
+                           modlist, start_info);
+    }
+
     if ( start_info->nr_modules )
     {
         start_info->modlist_paddr = (dom->start_info_seg.pfn << PAGE_SHIFT) +
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#3 lore raw

PATCH v2 2/6 ipxe: produce a single binary from its build

In reply to Wei Liu

And switch hvmloader/Makefile to use that binary. This will help later when we change hvmloader to pick a user provided binary.

No functional change.

---
v2: use intermediary file

Cc Ian Jackson <[email protected]>
---
 tools/firmware/etherboot/Makefile | 7 ++++++-
 tools/firmware/hvmloader/Makefile | 8 ++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
tools/firmware/etherboot/Makefile +6 -1
index e33458d2fe..4de6d24a13 100644
@@ -18,11 +18,16 @@ D=ipxe
 T=ipxe.tar.gz
 
 ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
+ROM = $D/src/bin/ipxe.bin
 
 .NOTPARALLEL:
 
 .PHONY: all
-all: $(ROMS)
+all: $(ROM)
+
+$(ROM): $(ROMS)
+	cat $^ > [email protected]
+	mv -f [email protected] $@
 
 %.rom: $D/src/arch/i386/Makefile
 	$(MAKE) -C $D/src bin/$(*F).rom
tools/firmware/hvmloader/Makefile +4 -4
index a5b4c32c1a..16255ebddd 100644
@@ -51,7 +51,7 @@ 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)))
+ETHERBOOT_ROM := ../etherboot/ipxe/src/bin/ipxe.bin
 endif
 
 ROMS := 
@@ -60,7 +60,7 @@ 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)
+ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROM)
 endif
 
 .PHONY: all
@@ -105,9 +105,9 @@ ifneq ($(CIRRUSVGA_ROM),)
 	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
-ifneq ($(ETHERBOOT_ROMS),)
+ifneq ($(ETHERBOOT_ROM),)
 	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> [email protected]
-	sh ../../misc/mkhex etherboot $(ETHERBOOT_ROMS) >> [email protected]
+	sh ../../misc/mkhex etherboot $(ETHERBOOT_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#8 lore raw

PATCH v2 4/6 tools: load IPXE from standalone file

In reply to Wei Liu

Do not embed IPXE into Rombios anymore. Instead, it is loaded by the toolstack from a file as a separate module.

Ability to let user specify an IPXE blob will come later.

No user visible change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: [email protected]

---
 tools/firmware/Makefile              |  6 ++++++
 tools/firmware/hvmloader/Makefile    |  9 +--------
 tools/firmware/hvmloader/config.h    |  3 ++-
 tools/firmware/hvmloader/hvmloader.c | 10 ++++++++--
 tools/firmware/hvmloader/ovmf.c      |  3 ++-
 tools/firmware/hvmloader/rombios.c   | 24 +++++++++++++++++-------
 tools/firmware/hvmloader/seabios.c   |  3 ++-
 tools/libxl/libxl_dom.c              | 10 ++++++++++
 tools/libxl/libxl_internal.h         |  1 +
 tools/libxl/libxl_paths.c            |  5 +++++
 10 files changed, 54 insertions(+), 20 deletions(-)
tools/firmware/Makefile +6 -0
index 5a7cf7766d..0bef579637 100644
@@ -55,6 +55,9 @@ endif
 ifeq ($(CONFIG_OVMF),y)
 	$(INSTALL_DATA) ovmf-dir/ovmf.bin $(INST_DIR)/ovmf.bin
 endif
+ifeq ($(CONFIG_IPXE),y)
+	$(INSTALL_DATA) etherboot/ipxe/src/bin/ipxe.bin $(INST_DIR)/ipxe.bin
+endif
 ifeq ($(CONFIG_PV_SHIM),y)
 	$(INSTALL_DATA) xen-dir/xen-shim $(INST_DIR)/xen-shim
 	$(INSTALL_DATA) xen-dir/xen-shim-syms $(DEBG_DIR)/xen-shim-syms
@@ -69,6 +72,9 @@ endif
 ifeq ($(CONFIG_OVMF),y)
 	rm -f $(INST_DIR)/ovmf.bin
 endif
+ifeq ($(CONFIG_IPXE),y)
+	rm -r $(INST_DIR)/ipxe.bin
+endif
 ifeq ($(CONFIG_PV_SHIM),y)
 	rm -f $(INST_DIR)/xen-shim
 	rm -f $(DEBG_DIR)/xen-shim-syms
tools/firmware/hvmloader/Makefile +1 -8
index 16255ebddd..496ac72b77 100644
@@ -51,7 +51,6 @@ CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
 else
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
-ETHERBOOT_ROM := ../etherboot/ipxe/src/bin/ipxe.bin
 endif
 
 ROMS := 
@@ -60,7 +59,7 @@ 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_ROM)
+ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM)
 endif
 
 .PHONY: all
@@ -105,12 +104,6 @@ ifneq ($(CIRRUSVGA_ROM),)
 	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
-ifneq ($(ETHERBOOT_ROM),)
-	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> [email protected]
-	sh ../../misc/mkhex etherboot $(ETHERBOOT_ROM) >> [email protected]
-	echo "#endif" >> [email protected]
-endif
-
 	mv [email protected] $@
 
 .PHONY: clean
tools/firmware/hvmloader/config.h +2 -1
index 6e00413f2e..d9b4713d63 100644
@@ -22,7 +22,8 @@ struct bios_config {
     /* ROMS */
     void (*load_roms)(void);
 
-    void (*bios_load)(const struct bios_config *config, void *addr, uint32_t size);
+    void (*bios_load)(const struct bios_config *config, void *addr,
+                      uint32_t size, void *extra_addr);
 
     void (*bios_info_setup)(void);
     void (*bios_info_finish)(void);
tools/firmware/hvmloader/hvmloader.c +8 -2
index f603f68ded..ae8c6cf7c5 100644
@@ -363,12 +363,18 @@ int main(void)
     {
         uint32_t paddr = bios_module->paddr;
 
-        bios->bios_load(bios, (void*)paddr, bios_module->size);
+        bios->bios_load(bios, (void*)paddr, bios_module->size, 0);
     }
 #ifdef ENABLE_ROMBIOS
     else if ( bios == &rombios_config )
     {
-        bios->bios_load(bios, NULL, 0);
+        const struct hvm_modlist_entry *ipxe;
+        uint32_t paddr = 0;
+
+        ipxe = get_module_entry(hvm_start_info, "ipxe");
+        if ( ipxe )
+            paddr = ipxe->paddr;
+        bios->bios_load(bios, 0, 0, (void*)paddr);
     }
 #endif
     else
tools/firmware/hvmloader/ovmf.c +2 -1
index a17a11c2f9..23610a0717 100644
@@ -85,7 +85,8 @@ static void ovmf_finish_bios_info(void)
 }
 
 static void ovmf_load(const struct bios_config *config,
-                      void *bios_addr, uint32_t bios_length)
+                      void *bios_addr, uint32_t bios_length,
+                      void *unused_addr)
 {
     xen_pfn_t mfn;
     uint64_t addr = OVMF_END
tools/firmware/hvmloader/rombios.c +17 -7
index c736fd9dea..46f331e465 100644
@@ -63,6 +63,8 @@ static void rombios_setup_bios_info(void)
     memset(info, 0, sizeof(*info));
 }
 
+static void *ipxe_module_addr;
+
 static void rombios_load_roms(void)
 {
     int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
@@ -95,13 +97,17 @@ static void rombios_load_roms(void)
     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);
+    if ( ipxe_module_addr )
+    {
+        etherboot_sz = scan_etherboot_nic(OPTIONROM_PHYSICAL_END,
+                                          etherboot_phys_addr,
+                                          ipxe_module_addr);
+
+        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 )
@@ -119,7 +125,8 @@ static void rombios_load_roms(void)
 }
 
 static void rombios_load(const struct bios_config *config,
-                         void *unused_addr, uint32_t unused_size)
+                         void *unused_addr, uint32_t unused_size,
+                         void *ipxe_addr)
 {
     uint32_t bioshigh;
     struct rombios_info *info;
@@ -133,6 +140,9 @@ static void rombios_load(const struct bios_config *config,
 
     info = (struct rombios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
     info->bios32_entry = bioshigh;
+
+    /* Stash ipxe address */
+    ipxe_module_addr = ipxe_addr;
 }
 
 /*
tools/firmware/hvmloader/seabios.c +2 -1
index 801516daf7..444d118ddb 100644
@@ -131,7 +131,8 @@ static void seabios_setup_e820(void)
 }
 
 static void seabios_load(const struct bios_config *bios,
-                         void *bios_addr, uint32_t bios_length)
+                         void *bios_addr, uint32_t bios_length,
+                         void *unused_addr)
 {
     unsigned int bios_dest = 0x100000 - bios_length;
 
tools/libxl/libxl_dom.c +10 -0
index f0fd5fd3a3..1b9e45c492 100644
@@ -1128,6 +1128,16 @@ static int libxl__domain_firmware(libxl__gc *gc,
         if (rc) goto out;
     }
 
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
+        info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS &&
+        libxl__ipxe_path())
+        rc = xc_dom_module_file(dom, libxl__ipxe_path(), "ipxe");
+
+    if (rc) {
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
     if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
         info->u.hvm.smbios_firmware) {
         data = NULL;
tools/libxl/libxl_internal.h +1 -0
index c582894589..518b75592c 100644
@@ -2362,6 +2362,7 @@ _hidden const char *libxl__lock_dir_path(void);
 _hidden const char *libxl__run_dir_path(void);
 _hidden const char *libxl__seabios_path(void);
 _hidden const char *libxl__ovmf_path(void);
+_hidden const char *libxl__ipxe_path(void);
 
 /*----- subprocess execution with timeout -----*/
 
tools/libxl/libxl_paths.c +5 -0
index 0643c1b3a4..8498f82781 100644
@@ -53,6 +53,11 @@ const char *libxl__ovmf_path(void)
 #endif
 }
 
+const char *libxl__ipxe_path(void)
+{
+    return XENFIRMWAREDIR "/ipxe.bin";
+}
+
 /*
  * Local variables:
  * mode: C
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#12 lore raw

PATCH v2 5/6 tools: provide --with-system-ipxe

In reply to Wei Liu

---
Cc: Ian Jackson <[email protected]>

---
 config/Tools.mk.in        |  1 +
 tools/config.h.in         |  3 +++
 tools/configure           | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac        | 18 ++++++++++++++++
 tools/libxl/libxl_paths.c |  6 +++++-
 5 files changed, 80 insertions(+), 1 deletion(-)
config/Tools.mk.in +1 -0
index 4cc9f29090..0964f6f9e9 100644
@@ -50,6 +50,7 @@ FLASK_POLICY        := @xsmpolicy@
 CONFIG_OVMF         := @ovmf@
 CONFIG_ROMBIOS      := @rombios@
 CONFIG_SEABIOS      := @seabios@
+CONFIG_IPXE         := @ipxe@
 CONFIG_QEMU_TRAD    := @qemu_traditional@
 CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_BLKTAP2      := @blktap2@
tools/config.h.in +3 -0
index c66a78c9b3..5987f087b8 100644
@@ -96,6 +96,9 @@
 /* libutil header file name */
 #undef INCLUDE_LIBUTIL_H
 
+/* IPXE path */
+#undef IPXE_PATH
+
 /* OVMF path */
 #undef OVMF_PATH
 
tools/configure +53 -0

95 lines not on this page · raw message

tools/configure.ac +18 -0
index 0826af8cbc..8e4b173d6f 100644
@@ -84,6 +84,7 @@ AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
 AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
+AX_ARG_DEFAULT_ENABLE([ipxe], [Disable IPXE])
 
 AC_ARG_WITH([linux-backend-modules],
     AS_HELP_STRING([--with-linux-backend-modules="mod1 mod2"],
@@ -241,6 +242,23 @@ AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [
                        [OVMF path])
 ])
 
+AC_ARG_WITH([system-ipxe],
+    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
+       [Use system supplied IPXE PATH instead of building and installing
+        our own version]),[
+    # Disable compilation of IPXE.
+    ipxe=n
+    case $withval in
+        no) ipxe_path= ;;
+        *)  ipxe_path=$withval ;;
+    esac
+],[])
+AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
+    AC_DEFINE_UNQUOTED([IPXE_PATH],
+                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
+                       [IPXE path])
+])
+
 AC_ARG_WITH([extra-qemuu-configure-args],
     AS_HELP_STRING([--with-extra-qemuu-configure-args@<:@="--ARG1 ..."@:>@],
        [List of additional configure options for upstream qemu]),[
tools/libxl/libxl_paths.c +5 -1
index 8498f82781..3f6a33628e 100644
@@ -55,7 +55,11 @@ const char *libxl__ovmf_path(void)
 
 const char *libxl__ipxe_path(void)
 {
-    return XENFIRMWAREDIR "/ipxe.bin";
+#ifdef IPXE_PATH
+    return IPXE_PATH;
+#else
+    return NULL;
+#endif
 }
 
 /*
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#15 lore raw

PATCH v2 6/6 tools: --with-system-{ovmf, seabios, ipxe} should provide absolute paths

In reply to Wei Liu

The paths shouldn't be set to "yes".

---
Cc: Ian Jackson <[email protected]>

new in v2

---
 tools/configure    | 3 +++
 tools/configure.ac | 3 +++
 2 files changed, 6 insertions(+)
tools/configure +3 -0
index 16960a425b..b40d6646fb 100755
@@ -4564,6 +4564,7 @@ if test "${with_system_seabios+set}" = set; then :
     seabios=n
     case $withval in
         no) seabios_path= ;;
+        yes) as_fn_error $? "Seabios specified, but is not an absolute path" "$LINENO" 5 ;;
         *)  seabios_path=$withval ;;
     esac
 
@@ -4587,6 +4588,7 @@ if test "${with_system_ovmf+set}" = set; then :
     ovmf=n
     case $withval in
         no) ovmf_path= ;;
+        yes) as_fn_error $? "OVMF specified, but is not an absolute path" "$LINENO" 5 ;;
         *)  ovmf_path=$withval ;;
     esac
 
@@ -4610,6 +4612,7 @@ if test "${with_system_ipxe+set}" = set; then :
     ipxe=n
     case $withval in
         no) ipxe_path= ;;
+        yes) as_fn_error $? "IPXE specified, but is not an absolute path" "$LINENO" 5 ;;
         *)  ipxe_path=$withval ;;
     esac
 
tools/configure.ac +3 -0
index 8e4b173d6f..aae7786ed7 100644
@@ -216,6 +216,7 @@ AC_ARG_WITH([system-seabios],
     seabios=n
     case $withval in
         no) seabios_path= ;;
+        yes) AC_MSG_ERROR([Seabios specified, but is not an absolute path]) ;;
         *)  seabios_path=$withval ;;
     esac
 ],[])
@@ -233,6 +234,7 @@ AC_ARG_WITH([system-ovmf],
     ovmf=n
     case $withval in
         no) ovmf_path= ;;
+        yes) AC_MSG_ERROR([OVMF specified, but is not an absolute path]) ;;
         *)  ovmf_path=$withval ;;
     esac
 ],[])
@@ -250,6 +252,7 @@ AC_ARG_WITH([system-ipxe],
     ipxe=n
     case $withval in
         no) ipxe_path= ;;
+        yes) AC_MSG_ERROR([IPXE specified, but is not an absolute path]) ;;
         *)  ipxe_path=$withval ;;
     esac
 ],[])
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v2 4/6
#9 lore raw

Re: [PATCH v2 4/6] tools: load IPXE from standalone file

In reply to Wei Liu

tools/firmware/hvmloader/config.h struct bios_config { · line 26

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 25.06.18 at 13:35, <[email protected]> wrote:
tools/firmware/hvmloader/config.h +2 -1
@@ -22,7 +22,8 @@ struct bios_config {
     /* ROMS */
     void (*load_roms)(void);
 
-    void (*bios_load)(const struct bios_config *config, void *addr, uint32_t size);
+    void (*bios_load)(const struct bios_config *config, void *addr,
+                      uint32_t size, void *extra_addr);

Okay, the new parameter is of pointer type.

tools/firmware/hvmloader/hvmloader.c int main(void) · line 366

Quoted 8 lines
tools/firmware/hvmloader/hvmloader.c +1 -1
@@ -363,12 +363,18 @@ int main(void)
     {
         uint32_t paddr = bios_module->paddr;
 
-        bios->bios_load(bios, (void*)paddr, bios_module->size);
+        bios->bios_load(bios, (void*)paddr, bios_module->size, 0);

With that, please pass NULL here, and please take the opportunity to add the missing blank in the cast.

tools/firmware/hvmloader/hvmloader.c int main(void) · line 377

Quoted 12 lines
tools/firmware/hvmloader/hvmloader.c +7 -1
     }
 #ifdef ENABLE_ROMBIOS
     else if ( bios == &rombios_config )
     {
-        bios->bios_load(bios, NULL, 0);
+        const struct hvm_modlist_entry *ipxe;
+        uint32_t paddr = 0;
+
+        ipxe = get_module_entry(hvm_start_info, "ipxe");
+        if ( ipxe )
+            paddr = ipxe->paddr;
+        bios->bios_load(bios, 0, 0, (void*)paddr);

Here you even (wrongly) convert NULL to 0 - please don't, and please correct the cast's style.

With that hvmloader parts

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v2 3/6
#6 lore raw

Re: [PATCH v2 3/6] libxc: allow HVM guest to have modules

In reply to Wei Liu
Quoted 2 lines · Wei Liu

Lift the loading code out of PVH specific branch. Take the chance to make the debug message more useful.

Would be nice to mention that you also account for virt_base being unset.

Quoted 3 lines

IPXE will be loaded as a module of Rombios.

Quoted 32 lines

---
Cc: Ian Jackson <[email protected]>

---
 tools/libxc/xc_dom_x86.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)
tools/libxc/xc_dom_x86.c +0 -14
index e33a28847d..ed4973a997 100644
@@ -1698,20 +1698,6 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                                 ((uintptr_t)cmdline - (uintptr_t)start_info);
         }
 
-        for ( i = 0; i < dom->num_modules; i++ )
-        {
-            struct xc_hvm_firmware_module mod;
-
-            DOMPRINTF("Adding module %u", i);
-            mod.guest_addr_out =
-                dom->modules[i].seg.vstart - dom->parms.virt_base;
-            mod.length =
-                dom->modules[i].seg.vend - dom->modules[i].seg.vstart;
-
-            add_module_to_list(dom, &mod, dom->modules[i].cmdline,
-                               modlist, start_info);
-        }
-
         /* ACPI module 0 is the RSDP */
         start_info->rsdp_paddr = dom->acpi_modules[0].guest_addr_out ? : 0;
     }

tools/libxc/xc_dom_x86.c static int bootlate_hvm(struct xc_dom_image *dom) · line 1714

Quoted 8 lines
tools/libxc/xc_dom_x86.c +5 -0
@@ -1721,6 +1707,24 @@ static int bootlate_hvm(struct xc_dom_image *dom)
                            modlist, start_info);
     }
 
+    for ( i = 0; i < dom->num_modules; i++ )
+    {
+        struct xc_hvm_firmware_module mod;
+        uint64_t base = dom->parms.virt_base != UNSET_ADDR ?
+            dom->parms.virt_base : 0;

For PVH/HVM virt_base should always be UNSET_ADDR and vstart/vend should be a physical address (ie: rename to pstart/pend). I guess other bits of the code already use virt_base if present so we need to use it here to in order to compensate.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

Re: [PATCH v2 4/6] tools: load IPXE from standalone file

In reply to Wei Liu
Quoted 7 lines · Wei Liu
tools/libxl/libxl_dom.c +0 -0
index f0fd5fd3a3..1b9e45c492 100644
@@ -1128,6 +1128,16 @@ static int libxl__domain_firmware(libxl__gc *gc,
         if (rc) goto out;
     }

tools/libxl/libxl_dom.c static int libxl__domain_firmware(libxl__gc *gc, · line 1139

Quoted 10 lines
tools/libxl/libxl_dom.c +9 -0
 
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
+        info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS &&
+        libxl__ipxe_path())
+        rc = xc_dom_module_file(dom, libxl__ipxe_path(), "ipxe");
+
+    if (rc) {
+        rc = ERROR_FAIL;
+        goto out;
+    }

IMO I would put the rc check inside the if. And add a LOG message if xc_dom_module_file fails.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [PATCH v2 5/6] tools: provide --with-system-ipxe

In reply to Wei Liu

tools/configure.ac AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools]) · line 87

Quoted 9 lines · Wei Liu
tools/configure.ac +1 -0
index 0826af8cbc..8e4b173d6f 100644
@@ -84,6 +84,7 @@ AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
 AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
+AX_ARG_DEFAULT_ENABLE([ipxe], [Disable IPXE])

Shouldn't ipxe default value be tied to rombios? Ie: don't build ipxe if rombios is not enabled?

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw

Re: [PATCH v2 6/6] tools: --with-system-{ovmf, seabios, ipxe} should provide absolute paths

In reply to Wei Liu
Quoted 1 line · Wei Liu

The paths shouldn't be set to "yes".

If you want to check if an absolute path is provided I would rather do:

case $withval in

    no) ovmf_path= ;;
    /*) ovmf_path=$withval ;;
    *)  AC_MSG_ERROR([OVMF specified, but is not an absolute path]) ;;

esac

The path would still allow anything else apart from 'yes' to still be considered and absolute path.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#7 lore raw

Re: [PATCH v2 3/6] libxc: allow HVM guest to have modules

In reply to Roger Pau Monné
Quoted 6 lines · Roger Pau Monné
Quoted 2 lines · Wei Liu

Lift the loading code out of PVH specific branch. Take the chance to make the debug message more useful.

Would be nice to mention that you also account for virt_base being unset.

NP.

Quoted 11 lines

tools/libxc/xc_dom_x86.c static int bootlate_hvm(struct xc_dom_image *dom) · line 1714

Quoted 6 lines
tools/libxc/xc_dom_x86.c +5 -0
+    for ( i = 0; i < dom->num_modules; i++ )
+    {
+        struct xc_hvm_firmware_module mod;
+        uint64_t base = dom->parms.virt_base != UNSET_ADDR ?
+            dom->parms.virt_base : 0;

For PVH/HVM virt_base should always be UNSET_ADDR and vstart/vend should be a physical address (ie: rename to pstart/pend). I guess other bits of the code already use virt_base if present so we need to use it here to in order to compensate.

The other half is PV code which relies on vstart for proper placement. Note this snippet is now common to all guest types.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#11 lore raw

Re: [PATCH v2 4/6] tools: load IPXE from standalone file

In reply to Roger Pau Monné
Quoted 9 lines · Roger Pau Monné
Quoted 8 lines · Wei Liu
tools/libxl/libxl_dom.c +0 -0
index f0fd5fd3a3..1b9e45c492 100644
@@ -1128,6 +1128,16 @@ static int libxl__domain_firmware(libxl__gc *gc,
         if (rc) goto out;
     }
 
Quoted 12 lines

tools/libxl/libxl_dom.c static int libxl__domain_firmware(libxl__gc *gc, · line 1139

Quoted 9 lines
tools/libxl/libxl_dom.c +9 -0
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
+        info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS &&
+        libxl__ipxe_path())
+        rc = xc_dom_module_file(dom, libxl__ipxe_path(), "ipxe");
+
+    if (rc) {
+        rc = ERROR_FAIL;
+        goto out;
+    }

IMO I would put the rc check inside the if. And add a LOG message if xc_dom_module_file fails.

Will change.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#17 lore raw

Re: [PATCH v2 6/6] tools: --with-system-{ovmf, seabios, ipxe} should provide absolute paths

In reply to Roger Pau Monné
Quoted 6 lines · Roger Pau Monné
Quoted 1 line · Wei Liu

The paths shouldn't be set to "yes".

If you want to check if an absolute path is provided I would rather do:

Quoted 8 lines

case $withval in

    no) ovmf_path= ;;
    /*) ovmf_path=$withval ;;
    *)  AC_MSG_ERROR([OVMF specified, but is not an absolute path]) ;;

esac

The path would still allow anything else apart from 'yes' to still be considered and absolute path.

Right, /* is better.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#14 lore raw

Re: [PATCH v2 5/6] tools: provide --with-system-ipxe

In reply to Roger Pau Monné
Quoted 13 lines · Roger Pau Monné

tools/configure.ac AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools]) · line 87

Quoted 9 lines · Wei Liu
tools/configure.ac +1 -0
index 0826af8cbc..8e4b173d6f 100644
@@ -84,6 +84,7 @@ AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
 AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
+AX_ARG_DEFAULT_ENABLE([ipxe], [Disable IPXE])

Shouldn't ipxe default value be tied to rombios? Ie: don't build ipxe if rombios is not enabled?

That would be nice. Let me see if I can encode the dependency somewhere.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v2 2/6
#4 lore raw

Re: [PATCH v2 2/6] ipxe: produce a single binary from its build

In reply to Wei Liu

Wei Liu writes ("[PATCH v2 2/6] ipxe: produce a single binary from its build"):

Quoted 7 lines

And switch hvmloader/Makefile to use that binary. This will help later when we change hvmloader to pick a user provided binary.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel