From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH for-next 4/5] tools: load IPXE from standalone file
Date: Tue, 15 May 2018 19:22:42 +0100 [thread overview]
Message-ID: <20180515182243.3339-5-wei.liu2@citrix.com> (raw)
In-Reply-To: <20180515182243.3339-1-wei.liu2@citrix.com>
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.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
tools/firmware/Makefile | 6 ++++++
tools/firmware/hvmloader/Makefile | 9 +--------
tools/firmware/hvmloader/hvmloader.c | 8 +++++++-
tools/firmware/hvmloader/rombios.c | 23 ++++++++++++++++-------
tools/libxl/libxl_dom.c | 10 ++++++++++
tools/libxl/libxl_internal.h | 1 +
tools/libxl/libxl_paths.c | 5 +++++
7 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile
index 5a7cf7766d..0bef579637 100644
--- a/tools/firmware/Makefile
+++ b/tools/firmware/Makefile
@@ -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
diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
index 16255ebddd..496ac72b77 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -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) >> $@.new
echo "#endif" >> $@.new
endif
-ifneq ($(ETHERBOOT_ROM),)
- echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
- sh ../../misc/mkhex etherboot $(ETHERBOOT_ROM) >> $@.new
- echo "#endif" >> $@.new
-endif
-
mv $@.new $@
.PHONY: clean
diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index f603f68ded..f546cfb3ab 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -368,7 +368,13 @@ int main(void)
#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, (void*)paddr, 0 /* unused */);
}
#endif
else
diff --git a/tools/firmware/hvmloader/rombios.c b/tools/firmware/hvmloader/rombios.c
index c736fd9dea..8c44839ce3 100644
--- a/tools/firmware/hvmloader/rombios.c
+++ b/tools/firmware/hvmloader/rombios.c
@@ -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,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_addr, uint32_t unused_size)
{
uint32_t bioshigh;
struct rombios_info *info;
@@ -133,6 +139,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;
}
/*
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index f0fd5fd3a3..1b9e45c492 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -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;
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index c582894589..518b75592c 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -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 -----*/
diff --git a/tools/libxl/libxl_paths.c b/tools/libxl/libxl_paths.c
index 0643c1b3a4..8498f82781 100644
--- a/tools/libxl/libxl_paths.c
+++ b/tools/libxl/libxl_paths.c
@@ -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
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-05-15 18:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 18:22 [PATCH for-next 0/5] Load ipxe from a standalone file Wei Liu
2018-05-15 18:22 ` [PATCH for-next 1/5] Tools.mk.in: drop unused variables Wei Liu
2018-05-15 18:22 ` [PATCH for-next 2/5] ipxe: produce a single binary from its build Wei Liu
2018-05-18 15:38 ` Jan Beulich
2018-05-21 8:55 ` Wei Liu
2018-05-15 18:22 ` [PATCH for-next 3/5] libxc: allow HVM guest to have modules Wei Liu
2018-05-15 18:22 ` Wei Liu [this message]
2018-05-18 15:49 ` [PATCH for-next 4/5] tools: load IPXE from standalone file Jan Beulich
2018-06-04 13:47 ` Anthony PERARD
2018-06-25 8:16 ` Wei Liu
2018-06-25 9:04 ` Jan Beulich
2018-05-15 18:22 ` [PATCH for-next 5/5] tools: provide --with-system-ipxe Wei Liu
2018-06-04 13:59 ` Anthony PERARD
2018-06-25 8:14 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180515182243.3339-5-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).