Skip to contentSkip to conversation

Make iPXE a standalone ROM

PATCH In review Anoob Soman 5 participants 25 messages Mar 15, 2018 – Mar 26, 2018

lore
Share & tools
lore
#0 lore raw

Make the iPXE ROM be built as a standalone ROM, rather than being embedded into hvmloader and pass the iPXE ROM to hvmloader via module, in the same way as OVMF/SeaBIOS are currently passed

Introduce a ./configure --with-system-ipxe=$path option

This allows us to disentangle iPXE from hvmloader, and allows us to edit/modify/upgrade iPXE independently of Xen.

Anoob Soman (5):
tools/firmware: Build ipxe as a standalone ROM tools/firmware: #define IPXE_PATH
libxc: Allow loading of firmware modules for HVM guest
libxl: Load iPXE ROM from a file
hvmloader: Use iPXE ROM loaded from a standalone file

 config/Tools.mk.in                   |  2 ++
 tools/configure.ac                   | 18 ++++++++++++++++++
 tools/firmware/Makefile              |  5 ++++-
 tools/firmware/hvmloader/Makefile    | 18 +++++++++++-------
 tools/firmware/hvmloader/config.h    |  5 +++++
 tools/firmware/hvmloader/hvmloader.c |  9 ++++++++-
 tools/firmware/hvmloader/rombios.c   | 13 +++++++++----
 tools/libxc/xc_dom_x86.c             | 13 +++++++++++++
 tools/libxl/libxl_dom.c              | 12 ++++++++++++
 tools/libxl/libxl_internal.h         |  1 +
 tools/libxl/libxl_paths.c            |  9 +++++++++
 11 files changed, 92 insertions(+), 13 deletions(-)
Signature · 7 lines
1.8.3.1


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

PATCH 1/5 tools/firmware: Build ipxe as a standalone ROM

This patches doesn't get rid of etherboot[] from roms.inc. Instead, makes a standalone iPXE rom, which will later be used by hvmloader (when all the plubming to use standalone iPXE rom are in place)

---
 tools/firmware/Makefile           | 3 +++
 tools/firmware/hvmloader/Makefile | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
tools/firmware/Makefile +3 -0
index 5a7cf77..20cab38 100644
@@ -59,6 +59,9 @@ 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
 endif
+ifeq ($(CONFIG_ROMBIOS),y)
+	$(INSTALL_DATA) etherboot/ipxe/src/bin/ipxe.bin $(INST_DIR)/ipxe.bin
+endif
 
 .PHONY: uninstall
 uninstall:
tools/firmware/hvmloader/Makefile +7 -1
index a5b4c32..087b41d 100644
@@ -52,6 +52,7 @@ 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 := 
@@ -71,7 +72,7 @@ all: acpi subdirs-all
 acpi:
 	$(MAKE) -C $(ACPI_PATH)  ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES)"
 
-rombios.o: roms.inc
+rombios.o: $(ETHERBOOT_ROM) roms.inc
 smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
 
 ACPI_PATH = ../../libacpi
@@ -113,6 +114,11 @@ endif
 
 	mv [email protected] $@
 
+ifneq ($(ETHERBOOT_ROMS),)
+$(ETHERBOOT_ROM): $(ETHERBOOT_ROMS)
+	cat $^ > $@
+endif
+
 .PHONY: clean
 clean: subdirs-clean
 	rm -f roms.inc roms.inc.new acpi.h
Signature · 7 lines
1.8.3.1


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

PATCH 1/5 tools/firmware: Build ipxe as a standalone ROM

tools/firmware/hvmloader/Makefile all: acpi subdirs-all · line 75

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 18:31, <[email protected]> wrote:
tools/firmware/hvmloader/Makefile +1 -1
@@ -71,7 +72,7 @@ all: acpi subdirs-all
 acpi:
 	$(MAKE) -C $(ACPI_PATH)  ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES)"
 
-rombios.o: roms.inc
+rombios.o: $(ETHERBOOT_ROM) roms.inc

Please don't introduce dead dependencies: If a need for this arises in a later patch, add the dependency there.

tools/firmware/hvmloader/Makefile endif · line 120

Quoted 8 lines
tools/firmware/hvmloader/Makefile +4 -0
@@ -113,6 +114,11 @@ endif
 
 	mv [email protected] $@
 
+ifneq ($(ETHERBOOT_ROMS),)
+$(ETHERBOOT_ROM): $(ETHERBOOT_ROMS)
+	cat $^ > $@
+endif

I don't understand this: How can the bare concatenation of multiple binary blobs produce anything usable? How will the consumer know where the boundaries are, and which one is which?

Jan

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

#3 lore raw

Re: [PATCH 1/5] tools/firmware: Build ipxe as a standalone ROM

Quoted 5 lines · Jan Beulich
Quoted 5 lines
tools/firmware/hvmloader/Makefile +0 -0
@@ -113,6 +114,11 @@ endif
 
 	mv [email protected] $@
 
Quoted 7 lines

tools/firmware/hvmloader/Makefile endif · line 120

Quoted 4 lines
tools/firmware/hvmloader/Makefile +4 -0
+ifneq ($(ETHERBOOT_ROMS),)
+$(ETHERBOOT_ROM): $(ETHERBOOT_ROMS)
+	cat $^ > $@
+endif

I don't understand this: How can the bare concatenation of multiple binary blobs produce anything usable? How will the consumer know where the boundaries are, and which one is which?

These details are all covered in the option ROM/PnP metadata.  See scan_etherboot_nic()/scan_option_rom() in hvmloader.

~Andrew

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

#4 lore raw

Re: [PATCH 1/5] tools/firmware: Build ipxe as a standalone ROM

In reply to Jan Beulich
Quoted 10 lines · Jan Beulich

tools/firmware/hvmloader/Makefile all: acpi subdirs-all · line 75

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 18:31, <[email protected]> wrote:
tools/firmware/hvmloader/Makefile +1 -1
@@ -71,7 +72,7 @@ all: acpi subdirs-all
 acpi:
 	$(MAKE) -C $(ACPI_PATH)  ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES)"
 
-rombios.o: roms.inc
+rombios.o: $(ETHERBOOT_ROM) roms.inc

Please don't introduce dead dependencies: If a need for this arises in a later patch, add the dependency there.

Well this is what's creating the ipxe.bin that's being installed in the section you snipped out.

But I kind of agree. I feels like patch 1 & 2 belong together maybe?

Signature · 6 lines
Doug Goldstein

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

Re: [PATCH 1/5] tools/firmware: Build ipxe as a standalone ROM

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 18.03.18 at 02:30, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 18:31, <[email protected]> wrote:
tools/firmware/hvmloader/Makefile +0 -0
@@ -71,7 +72,7 @@ all: acpi subdirs-all
 acpi:
 	$(MAKE) -C $(ACPI_PATH)  ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES)"
 
Quoted 8 lines
Quoted 5 lines

tools/firmware/hvmloader/Makefile all: acpi subdirs-all · line 75

Quoted 2 lines
tools/firmware/hvmloader/Makefile +1 -1
-rombios.o: roms.inc
+rombios.o: $(ETHERBOOT_ROM) roms.inc

Please don't introduce dead dependencies: If a need for this arises in a later patch, add the dependency there.

Well this is what's creating the ipxe.bin that's being installed in the section you snipped out.

I don't understand: The question isn't what is being generated, but whether rombios.o really depends on that binary blob, and nothing in the patch here suggests it does. If the goal is simply to have a dependency triggering the creation of the blob, then this should be done via e.g. TARGET, and the whole logic should rather sit in firmware/Makefile (matching the installation of it done there).

Jan

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

#6 lore raw

Re: [PATCH 1/5] tools/firmware: Build ipxe as a standalone ROM

Quoted 16 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 18.03.18 at 02:30, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 18:31, <[email protected]> wrote:
tools/firmware/hvmloader/Makefile +0 -0
@@ -71,7 +72,7 @@ all: acpi subdirs-all
 acpi:
 	$(MAKE) -C $(ACPI_PATH)  ACPI_BUILD_DIR=$(CURDIR) DSDT_FILES="$(DSDT_FILES)"
 
Quoted 8 lines
Quoted 5 lines

tools/firmware/hvmloader/Makefile all: acpi subdirs-all · line 75

Quoted 2 lines
tools/firmware/hvmloader/Makefile +1 -1
-rombios.o: roms.inc
+rombios.o: $(ETHERBOOT_ROM) roms.inc

Please don't introduce dead dependencies: If a need for this arises in a later patch, add the dependency there.

Well this is what's creating the ipxe.bin that's being installed in the section you snipped out.

Quoted 9 lines

I don't understand: The question isn't what is being generated, but whether rombios.o really depends on that binary blob, and nothing in the patch here suggests it does. If the goal is simply to have a dependency triggering the creation of the blob, then this should be done via e.g. TARGET, and the whole logic should rather sit in firmware/Makefile (matching the installation of it done there).

Jan

Oh, 100% agreement there.

Signature · 6 lines
Doug Goldstein

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

PATCH 2/5 tools/firmware: #define IPXE_PATH

In reply to Anoob Soman

--with-system-ipxe allows the user to specify ipxe rom. If this option is given, use system supplied ipxe instead of building and installing our own version

Plumbing for using iPXE roms, specified with --with-system-ipxe, doesn't exist and will be added in future commits.

Re-run of autoconf is needed.

---
 config/Tools.mk.in                |  2 ++
 tools/configure.ac                | 18 ++++++++++++++++++
 tools/firmware/Makefile           |  4 ++--
 tools/firmware/hvmloader/Makefile |  3 +++
 4 files changed, 25 insertions(+), 2 deletions(-)
config/Tools.mk.in +2 -0
index 0f79f4e..dc6eae8 100644
@@ -24,6 +24,7 @@ AWK                 := @AWK@
 FETCHER             := @FETCHER@
 SEABIOS_PATH        := @seabios_path@
 OVMF_PATH           := @ovmf_path@
+IPXE_PATH           := @ipxe_path@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
@@ -59,6 +60,7 @@ CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_BLKTAP2      := @blktap2@
 CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@
 CONFIG_LIBNL        := @libnl@
+CONFIG_IPXE         := @ipxe@
 
 CONFIG_SYSTEMD      := @systemd@
 SYSTEMD_CFLAGS      := @SYSTEMD_CFLAGS@
tools/configure.ac +18 -0
index 06eb16d..022a2f9 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/firmware/Makefile +2 -2
index 20cab38..ca333a9 100644
@@ -15,7 +15,7 @@ SUBDIRS-$(CONFIG_OVMF) += ovmf-dir
 SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
 SUBDIRS-$(CONFIG_ROMBIOS) += rombios
 SUBDIRS-$(CONFIG_ROMBIOS) += vgabios
-SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
+SUBDIRS-$(CONFIG_IPXE)    += etherboot
 SUBDIRS-$(CONFIG_PV_SHIM) += xen-dir
 SUBDIRS-y += hvmloader
 
@@ -59,7 +59,7 @@ 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
 endif
-ifeq ($(CONFIG_ROMBIOS),y)
+ifeq ($(CONFIG_IPXE),y)
 	$(INSTALL_DATA) etherboot/ipxe/src/bin/ipxe.bin $(INST_DIR)/ipxe.bin
 endif
 
tools/firmware/hvmloader/Makefile +3 -0
index 087b41d..fa1bf30 100644
@@ -51,6 +51,9 @@ CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.debug.bin
 else
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
+endif
+
+ifeq ($(CONFIG_IPXE),y)
 ETHERBOOT_ROMS := $(addprefix ../etherboot/ipxe/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
 ETHERBOOT_ROM  := ../etherboot/ipxe/src/bin/ipxe.bin
 endif
Signature · 7 lines
1.8.3.1


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

Re: [PATCH 2/5] tools/firmware: #define IPXE_PATH

Quoted 10 lines · Anoob Soman

--with-system-ipxe allows the user to specify ipxe rom. If this option is given, use system supplied ipxe instead of building and installing our own version

Plumbing for using iPXE roms, specified with --with-system-ipxe, doesn't exist and will be added in future commits.

Re-run of autoconf is needed.

This looks fine. But it should probably be squashed to one of the other patches.

Wei.

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

#9 lore raw

Re: [PATCH 2/5] tools/firmware: #define IPXE_PATH

Quoted 5 lines · Wei Liu
Quoted 4 lines · Anoob Soman

--with-system-ipxe allows the user to specify ipxe rom. If this option is given, use system supplied ipxe instead of building and installing our own version

Quoted 7 lines
Quoted 6 lines

Plumbing for using iPXE roms, specified with --with-system-ipxe, doesn't exist and will be added in future commits.

Re-run of autoconf is needed.

This looks fine. But it should probably be squashed to one of the other

Sure, let me see what I can do.

Quoted 3 lines

patches.

Wei.

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

#10 lore raw

PATCH 3/5 libxc: Allow loading of firmware modules for HVM guest

In reply to Anoob Soman

This allows to load iPXE rom as a firmware module, instead of requiring it to be embedded into hvmloader.

---
 tools/libxc/xc_dom_x86.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tools/libxc/xc_dom_x86.c +13 -0
index 0b65dab..be06d43 100644
@@ -1723,6 +1723,19 @@ static int bootlate_hvm(struct xc_dom_image *dom)
     {
         add_module_to_list(dom, &dom->system_firmware_module, "firmware",
                            modlist, 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;
+            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);
+        }
     }
 
     if ( start_info->nr_modules )
Signature · 7 lines
1.8.3.1


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

Re: [PATCH 3/5] libxc: Allow loading of firmware modules for HVM guest

Quoted 13 lines · Anoob Soman

This allows to load iPXE rom as a firmware module, instead of requiring it to be embedded into hvmloader.

---
 tools/libxc/xc_dom_x86.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tools/libxc/xc_dom_x86.c +0 -0
index 0b65dab..be06d43 100644

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

Quoted 8 lines
tools/libxc/xc_dom_x86.c +5 -0
@@ -1723,6 +1723,19 @@ static int bootlate_hvm(struct xc_dom_image *dom)
     {
         add_module_to_list(dom, &dom->system_firmware_module, "firmware",
                            modlist, start_info);
+        for ( i = 0; i < dom->num_modules; i++ )
+        {
+            struct xc_hvm_firmware_module mod;
+
+            DOMPRINTF("Adding module %u", i);

nothing more helpful for debugging than the for loop's number available?

Signature · 6 lines
Doug Goldstein

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

Re: [PATCH 3/5] libxc: Allow loading of firmware modules for HVM guest

Quoted 9 lines · Doug Goldstein
Quoted 8 lines · Anoob Soman

This allows to load iPXE rom as a firmware module, instead of requiring it to be embedded into hvmloader.

---
  tools/libxc/xc_dom_x86.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
Quoted 15 lines

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

Quoted 13 lines
tools/libxc/xc_dom_x86.c +5 -0
index 0b65dab..be06d43 100644
@@ -1723,6 +1723,19 @@ static int bootlate_hvm(struct xc_dom_image *dom)
      {
          add_module_to_list(dom, &dom->system_firmware_module, "firmware",
                             modlist, start_info);
+        for ( i = 0; i < dom->num_modules; i++ )
+        {
+            struct xc_hvm_firmware_module mod;
+
+            DOMPRINTF("Adding module %u", i);

nothing more helpful for debugging than the for loop's number available?

I will add guest_addr_out, cmdline and length to DOMPRINTF.

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

#13 lore raw

Re: [PATCH 3/5] libxc: Allow loading of firmware modules for HVM guest

In reply to Anoob Soman
Quoted 13 lines · Anoob Soman

This allows to load iPXE rom as a firmware module, instead of requiring it to be embedded into hvmloader.

---
 tools/libxc/xc_dom_x86.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tools/libxc/xc_dom_x86.c +0 -0
index 0b65dab..be06d43 100644

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

Quoted 10 lines
tools/libxc/xc_dom_x86.c +7 -0
@@ -1723,6 +1723,19 @@ static int bootlate_hvm(struct xc_dom_image *dom)
     {
         add_module_to_list(dom, &dom->system_firmware_module, "firmware",
                            modlist, 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;

Shouldn't this be dom->modules[i].seg.vstart - dom->parms.virt_base?

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

Quoted 6 lines
tools/libxc/xc_dom_x86.c +6 -0
+            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);
+        }

Now that both paths of the if ... else ... structure contain the same code it should be lifted outside of the loop.

Wei.

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

#14 lore raw

Re: [PATCH 3/5] libxc: Allow loading of firmware modules for HVM guest

Quoted 10 lines · Wei Liu

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

Quoted 8 lines · Anoob Soman
                             modlist, start_info);
tools/libxc/xc_dom_x86.c +7 -0
+        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;

Shouldn't this be dom->modules[i].seg.vstart - dom->parms.virt_base?

It didn't work when guest_addr_out = seg.vstart - virt_base. I will try to figure out why.

Quoted 9 lines

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

Quoted 7 lines
tools/libxc/xc_dom_x86.c +6 -0
+            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);
+        }

Now that both paths of the if ... else ... structure contain the same code it should be lifted outside of the loop.

Sure, I can do that.

-Anoob

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

#15 lore raw

PATCH 4/5 libxl: Load iPXE ROM from a file

In reply to Anoob Soman

Load iPXE ROM from a file pointed to by IPXE_PATH. If --with-system-ipxe is not specified default Xen firmware directory is picked up as IPXE_PATH

---
 tools/libxl/libxl_dom.c      | 12 ++++++++++++
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/libxl_paths.c    |  9 +++++++++
 3 files changed, 22 insertions(+)
tools/libxl/libxl_dom.c +12 -0
index 2e29b52..104d6a0 100644
@@ -1003,6 +1003,7 @@ static int libxl__domain_firmware(libxl__gc *gc,
     int datalen = 0;
     void *data;
     const char *bios_filename = NULL;
+    const char *ipxe_filename = NULL;
 
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         if (info->u.hvm.firmware) {
@@ -1094,6 +1095,17 @@ static int libxl__domain_firmware(libxl__gc *gc,
         assert(info->type == LIBXL_DOMAIN_TYPE_HVM);
         rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,
                                                  libxl__xenfirmwaredir_path()));
+        if (rc) {
+            LOGE(ERROR, "xc_dom_kernel_file failed");
+            goto out;
+        }
+        if ((ipxe_filename = libxl__ipxe_path())) {
+            rc = xc_dom_module_file(dom, ipxe_filename, "ipxe");
+            if (rc) {
+                LOGE(ERROR, "xc_dom_ipxe_module_file failed");
+                goto out;
+            }
+       }
     }
 
     if (rc != 0) {
tools/libxl/libxl_internal.h +1 -0
index 506687f..f649696 100644
@@ -2359,6 +2359,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 +9 -0
index 0643c1b..3f6a336 100644
@@ -53,6 +53,15 @@ const char *libxl__ovmf_path(void)
 #endif
 }
 
+const char *libxl__ipxe_path(void)
+{
+#ifdef IPXE_PATH
+    return IPXE_PATH;
+#else
+    return NULL;
+#endif
+}
+
 /*
  * Local variables:
  * mode: C
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 4/5
#16 lore raw

Re: [PATCH 4/5] libxl: Load iPXE ROM from a file

Quoted 5 lines · Anoob Soman

Load iPXE ROM from a file pointed to by IPXE_PATH. If --with-system-ipxe is not specified default Xen firmware directory is picked up as IPXE_PATH

Signature · 6 lines
Doug Goldstein

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

Re: [PATCH 4/5] libxl: Load iPXE ROM from a file

In reply to Anoob Soman
Quoted 26 lines · Anoob Soman

Load iPXE ROM from a file pointed to by IPXE_PATH. If --with-system-ipxe is not specified default Xen firmware directory is picked up as IPXE_PATH

---
 tools/libxl/libxl_dom.c      | 12 ++++++++++++
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/libxl_paths.c    |  9 +++++++++
 3 files changed, 22 insertions(+)
tools/libxl/libxl_dom.c +1 -0
index 2e29b52..104d6a0 100644
@@ -1003,6 +1003,7 @@ static int libxl__domain_firmware(libxl__gc *gc,
     int datalen = 0;
     void *data;
     const char *bios_filename = NULL;
+    const char *ipxe_filename = NULL;
 
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         if (info->u.hvm.firmware) {
@@ -1094,6 +1095,17 @@ static int libxl__domain_firmware(libxl__gc *gc,
         assert(info->type == LIBXL_DOMAIN_TYPE_HVM);
         rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,

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

Quoted 10 lines
tools/libxl/libxl_dom.c +9 -0
                                                  libxl__xenfirmwaredir_path()));
+        if (rc) {
+            LOGE(ERROR, "xc_dom_kernel_file failed");
+            goto out;
+        }
+        if ((ipxe_filename = libxl__ipxe_path())) {
+            rc = xc_dom_module_file(dom, ipxe_filename, "ipxe");
+            if (rc) {
+                LOGE(ERROR, "xc_dom_ipxe_module_file failed");
+                goto out;

This is the wrong place. Being an HVM guest doesn't mean ipxe should be loaded. You probably need to look a few lines down and add code in appropriate places like when ROMBIOS is picked.

Wei.

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

#18 lore raw

Re: [PATCH 4/5] libxl: Load iPXE ROM from a file

Quoted 9 lines · Wei Liu

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

Quoted 9 lines
tools/libxl/libxl_dom.c +8 -0
+            LOGE(ERROR, "xc_dom_kernel_file failed");
+            goto out;
+        }
+        if ((ipxe_filename = libxl__ipxe_path())) {
+            rc = xc_dom_module_file(dom, ipxe_filename, "ipxe");
+            if (rc) {
+                LOGE(ERROR, "xc_dom_ipxe_module_file failed");
+                goto out;
Quoted 3 lines

This is the wrong place. Being an HVM guest doesn't mean ipxe should be loaded. You probably need to look a few lines down and add code in appropriate places like when ROMBIOS is picked.

Sure, I will fix it up.

Quoted 2 lines

Wei.

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

#19 lore raw

PATCH 5/5 hvmloader: Use iPXE ROM loaded from a standalone file

In reply to Anoob Soman

splatering of mkhex-ed etherboot inside hvmloader/rombios is removed, instead hvmloader/rombios now relies on iPXE ROM to be added,loaded as a module.

---
 tools/firmware/hvmloader/Makefile    |  7 +------
 tools/firmware/hvmloader/config.h    |  5 +++++
 tools/firmware/hvmloader/hvmloader.c |  9 ++++++++-
 tools/firmware/hvmloader/rombios.c   | 13 +++++++++----
 4 files changed, 23 insertions(+), 11 deletions(-)
tools/firmware/hvmloader/Makefile +1 -6
index fa1bf30..f347cb4 100644
@@ -64,7 +64,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)
 endif
 
 .PHONY: all
@@ -109,11 +109,6 @@ ifneq ($(CIRRUSVGA_ROM),)
 	sh ../../misc/mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> [email protected]
 	echo "#endif" >> [email protected]
 endif
-ifneq ($(ETHERBOOT_ROMS),)
-	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> [email protected]
-	sh ../../misc/mkhex etherboot $(ETHERBOOT_ROMS) >> [email protected]
-	echo "#endif" >> [email protected]
-endif
 
 	mv [email protected] $@
 
tools/firmware/hvmloader/config.h +5 -0
index 6e00413..8f5d1040 100644
@@ -33,6 +33,11 @@ struct bios_config {
     void (*create_mp_tables)(void);
     void (*create_smbios_tables)(void);
     void (*create_pir_tables)(void);
+
+    /* Physical address of iPXE ROM, loaded by domain builder
+     * when using ROMBIOS
+     */
+    unsigned int *ipxe_rom_addresss;
 };
 
 extern struct bios_config rombios_config;
tools/firmware/hvmloader/hvmloader.c +8 -1
index f603f68..731cd81 100644
@@ -323,6 +323,8 @@ int main(void)
     const struct bios_config *bios;
     int acpi_enabled;
     const struct hvm_modlist_entry *bios_module;
+    const struct hvm_modlist_entry *ipxe_module = NULL;
+    unsigned int ipxe_rom_addresss = 0;
 
     /* Initialise hypercall stubs with RET, rendering them no-ops. */
     memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE);
@@ -368,7 +370,12 @@ int main(void)
 #ifdef ENABLE_ROMBIOS
     else if ( bios == &rombios_config )
     {
-        bios->bios_load(bios, NULL, 0);
+        ipxe_module = get_module_entry(hvm_start_info, "ipxe");
+
+        if ( ipxe_module )
+            ipxe_rom_addresss = ipxe_module->paddr;
+
+        bios->bios_load(bios, (void *)ipxe_rom_addresss, 0);
     }
 #endif
     else
tools/firmware/hvmloader/rombios.c +9 -4
index c736fd9..c0e04cb 100644
@@ -95,9 +95,12 @@ 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);
+
+    if ( rombios_config.ipxe_rom_addresss )
+        etherboot_sz = scan_etherboot_nic(OPTIONROM_PHYSICAL_END,
+                                          etherboot_phys_addr,
+                                          rombios_config.ipxe_rom_addresss);
+
 
     option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
     option_rom_sz = pci_load_option_roms(OPTIONROM_PHYSICAL_END,
@@ -119,7 +122,7 @@ static void rombios_load_roms(void)
 }
 
 static void rombios_load(const struct bios_config *config,
-                         void *unused_addr, uint32_t unused_size)
+                         void *ipxe_rom_addr, uint32_t unused_size)
 {
     uint32_t bioshigh;
     struct rombios_info *info;
@@ -133,6 +136,8 @@ static void rombios_load(const struct bios_config *config,
 
     info = (struct rombios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
     info->bios32_entry = bioshigh;
+
+    rombios_config.ipxe_rom_addresss = ipxe_rom_addr;
 }
 
 /*
Signature · 7 lines
1.8.3.1


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

Re: [PATCH 5/5] hvmloader: Use iPXE ROM loaded from a standalone file

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

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 18:31, <[email protected]> wrote:
tools/firmware/hvmloader/config.h +5 -0
@@ -33,6 +33,11 @@ struct bios_config {
     void (*create_mp_tables)(void);
     void (*create_smbios_tables)(void);
     void (*create_pir_tables)(void);
+
+    /* Physical address of iPXE ROM, loaded by domain builder
+     * when using ROMBIOS
+     */
+    unsigned int *ipxe_rom_addresss;

Comment style. And can the pointer be to const?

tools/firmware/hvmloader/config.h int main(void) · line 380

Quoted 13 lines
tools/firmware/hvmloader/config.h +6 -1
@@ -368,7 +370,12 @@ int main(void)
 #ifdef ENABLE_ROMBIOS
     else if ( bios == &rombios_config )
     {
-        bios->bios_load(bios, NULL, 0);
+        ipxe_module = get_module_entry(hvm_start_info, "ipxe");
+
+        if ( ipxe_module )
+            ipxe_rom_addresss = ipxe_module->paddr;
+
+        bios->bios_load(bios, (void *)ipxe_rom_addresss, 0);
     }
 #endif

Considering the #ifdef around here - is this whole series an enhancement for qemu-trad only? I don't think we mean to make any such enhancements anymore.

Jan

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

#21 lore raw

Re: [PATCH 5/5] hvmloader: Use iPXE ROM loaded from a standalone file

Quoted 14 lines · Jan Beulich

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

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 18:31, <[email protected]> wrote:
tools/firmware/hvmloader/config.h +5 -0
@@ -33,6 +33,11 @@ struct bios_config {
     void (*create_mp_tables)(void);
     void (*create_smbios_tables)(void);
     void (*create_pir_tables)(void);
+
+    /* Physical address of iPXE ROM, loaded by domain builder
+     * when using ROMBIOS
+     */
+    unsigned int *ipxe_rom_addresss;

Comment style. And can the pointer be to const?

Quoted 16 lines

tools/firmware/hvmloader/config.h int main(void) · line 380

Quoted 13 lines
tools/firmware/hvmloader/config.h +6 -1
@@ -368,7 +370,12 @@ int main(void)
 #ifdef ENABLE_ROMBIOS
     else if ( bios == &rombios_config )
     {
-        bios->bios_load(bios, NULL, 0);
+        ipxe_module = get_module_entry(hvm_start_info, "ipxe");
+
+        if ( ipxe_module )
+            ipxe_rom_addresss = ipxe_module->paddr;
+
+        bios->bios_load(bios, (void *)ipxe_rom_addresss, 0);
     }
 #endif

Considering the #ifdef around here - is this whole series an enhancement for qemu-trad only? I don't think we mean to make any such enhancements anymore.

It is for several important reasons, including allowing distros to remove their qemu-trad packages completely.

The main purpose is to have iPXE as a ROM not embedded in hvmloader, and finishes some incomplete earlier work by Anthony to split the SeaBIOS and OVMF roms out of HVMLoader (and then later some work which Boris offered to do, but time hasn't materialised yet).

This means that distros don't need to rebuild and redeploy their Xen packages every time they want to change their iPXE package and/or don't need to maintain multiple iPXE packages.

It also removes the final non-stubdom bit of the build which downloads a random tarball from the web, which is something downstreams have been crying out for for years.

As for the Qemu side of things, RomBIOS functions perfectly well with qemu-upstream, and is the only viable transition mechanism available for downstreams wishing to purge themselves of qemu-trad entirely, while keeping older VMs working.

~Andrew

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

#22 lore raw

Re: [PATCH 5/5] hvmloader: Use iPXE ROM loaded from a standalone file

Quoted 41 lines · Andrew Cooper
Quoted 14 lines · Jan Beulich

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

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 18:31, <[email protected]> wrote:
tools/firmware/hvmloader/config.h +5 -0
@@ -33,6 +33,11 @@ struct bios_config {
     void (*create_mp_tables)(void);
     void (*create_smbios_tables)(void);
     void (*create_pir_tables)(void);
+
+    /* Physical address of iPXE ROM, loaded by domain builder
+     * when using ROMBIOS
+     */
+    unsigned int *ipxe_rom_addresss;

Comment style. And can the pointer be to const?

Quoted 16 lines

tools/firmware/hvmloader/config.h int main(void) · line 380

Quoted 13 lines
tools/firmware/hvmloader/config.h +6 -1
@@ -368,7 +370,12 @@ int main(void)
 #ifdef ENABLE_ROMBIOS
     else if ( bios == &rombios_config )
     {
-        bios->bios_load(bios, NULL, 0);
+        ipxe_module = get_module_entry(hvm_start_info, "ipxe");
+
+        if ( ipxe_module )
+            ipxe_rom_addresss = ipxe_module->paddr;
+
+        bios->bios_load(bios, (void *)ipxe_rom_addresss, 0);
     }
 #endif

Considering the #ifdef around here - is this whole series an enhancement for qemu-trad only? I don't think we mean to make any such enhancements anymore.

It is for several important reasons, including allowing distros to remove their qemu-trad packages completely.

The main purpose is to have iPXE as a ROM not embedded in hvmloader, and finishes some incomplete earlier work by Anthony to split the SeaBIOS and OVMF roms out of HVMLoader (and then later some work which Boris offered to do, but time hasn't materialised yet).

Quoted 6 lines

This means that distros don't need to rebuild and redeploy their Xen packages every time they want to change their iPXE package and/or don't need to maintain multiple iPXE packages.>
It also removes the final non-stubdom bit of the build which downloads a random tarball from the web, which is something downstreams have been crying out for for years.

I was originally asking if this was the case on the cover letter. I'll lend a +1 to the overall series here. As someone that packages Xen in two source based distros whose package managers run the build in a separate phase from the fetch stage this is a welcome change. I've been hacking around this and am glad to drop that.

Signature · 6 lines
Doug Goldstein

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

Re: [PATCH 5/5] hvmloader: Use iPXE ROM loaded from a standalone file

In reply to Jan Beulich
Quoted 6 lines · Jan Beulich

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

Quoted 5 lines
tools/firmware/hvmloader/config.h +4 -0
+    /* Physical address of iPXE ROM, loaded by domain builder
+     * when using ROMBIOS
+     */
+    unsigned int *ipxe_rom_addresss;

Comment style. And can the pointer be to const?

I will fixup the comment style and but making ipxe_rom_address a pointer to const will require codes changes in hvmloader/rombios.c, hvmloader/optionroms.c to make all function that use ipxe_rom_address const as well. Are you fine with changing these files/functions.

-Anoob

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

#24 lore raw

Re: [PATCH 5/5] hvmloader: Use iPXE ROM loaded from a standalone file

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 19.03.18 at 15:24, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
tools/firmware/hvmloader/config.h +4 -0
+    /* Physical address of iPXE ROM, loaded by domain builder
+     * when using ROMBIOS
+     */
+    unsigned int *ipxe_rom_addresss;
Quoted 6 lines
Quoted 1 line

Comment style. And can the pointer be to const?

I will fixup the comment style and but making ipxe_rom_address a pointer to const will require codes changes in hvmloader/rombios.c, hvmloader/optionroms.c to make all function that use ipxe_rom_address const as well. Are you fine with changing these files/functions.

In a separate patch, yes. If you don't want to create a separate patch, I'm also fine with your explanation of why it can't be const for now.

Jan

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