* [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader.
@ 2015-09-16 17:19 Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 1/5] libxc: Load BIOS and ACPI table into guest memory Anthony PERARD
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Anthony PERARD @ 2015-09-16 17:19 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD
Hi all,
I've start to look at loading the BIOS and the ACPI tables via the
toolstack instead of having them embedded in the hvmloader binary. This is
done by using the same mechanics as the one used to load extra ACPI tables
or SMBIOS.
- libxl load the blob into it's memory and add it to
struct xc_hvm_build_args.bios_module
- libxc load the blob into the guest memory and give back the guest address
of the blob.
- libxl store the location of the blob (and it's lenght) into xenstore, in
/local/domain/$domid/hvmloader/$blob_name/{address,length} ($blob_name
would be "bios" or "acpi_table"; there is already "acpi" and "smbios"
that exist)
- hvmloader read the addresses from xenstore and put the blob at the right
place.
How this is looking?
Right now, this patch series would only work for SeaBIOS.
TODOs:
- load the bios from the right place.
- have a bios_firmware config option, same for the acpi_tables
- cleanup and factoring the duplication of code
Anthony PERARD (5):
libxc: Load BIOS and ACPI table into guest memory.
libxl: Load guest BIOS and ACPI table from file.
hvmloader: Load BIOS from where libxc left it.
hvmloader: Load ACPI table from here libxc left it.
hvmloader: Keep BIOS and ACPI blob in separated files.
tools/firmware/Makefile | 20 ++++++++-
tools/firmware/hvmloader/acpi/Makefile | 8 ++--
tools/firmware/hvmloader/config.h | 11 +----
tools/firmware/hvmloader/hvmloader.c | 34 +++++++++------
tools/firmware/hvmloader/seabios.c | 33 +++++++-------
tools/libxc/include/xenguest.h | 4 ++
tools/libxc/xc_hvm_build_x86.c | 46 +++++++++++++++----
tools/libxl/libxl_dom.c | 80 ++++++++++++++++++++++++++++++++++
8 files changed, 185 insertions(+), 51 deletions(-)
--
Anthony PERARD
^ permalink raw reply [flat|nested] 11+ messages in thread
* [RFC PATCH 1/5] libxc: Load BIOS and ACPI table into guest memory.
2015-09-16 17:19 [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Anthony PERARD
@ 2015-09-16 17:19 ` Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 2/5] libxl: Load guest BIOS and ACPI table from file Anthony PERARD
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Anthony PERARD @ 2015-09-16 17:19 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD
---
tools/libxc/include/xenguest.h | 4 ++++
tools/libxc/xc_hvm_build_x86.c | 46 +++++++++++++++++++++++++++++++++---------
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index 1a1a185..42acbfd 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -229,6 +229,10 @@ struct xc_hvm_build_args {
uint64_t lowmem_end;
uint64_t highmem_end;
uint64_t mmio_start;
+
+ /* BIOS as module */
+ struct xc_hvm_firmware_module bios_module;
+ struct xc_hvm_firmware_module acpi_table_module;
};
/**
diff --git a/tools/libxc/xc_hvm_build_x86.c b/tools/libxc/xc_hvm_build_x86.c
index ea250dd..a444d83 100644
--- a/tools/libxc/xc_hvm_build_x86.c
+++ b/tools/libxc/xc_hvm_build_x86.c
@@ -53,6 +53,15 @@
#define VGA_HOLE_SIZE (0x20)
+static uint64_t module_init(struct xc_hvm_firmware_module *x, uint64_t mstart)
+{
+#define MODULE_ALIGN 1UL << 7
+#define MKALIGN(x, a) (((uint64_t)(x) + (a) - 1) & ~(uint64_t)((a) - 1))
+ if ( x->length != 0 )
+ x->guest_addr_out = mstart;
+ return MKALIGN(x->length, MODULE_ALIGN);
+}
+
static int modules_init(struct xc_hvm_build_args *args,
uint64_t vend, struct elf_binary *elf,
uint64_t *mstart_out, uint64_t *mend_out)
@@ -60,27 +69,29 @@ static int modules_init(struct xc_hvm_build_args *args,
#define MODULE_ALIGN 1UL << 7
#define MB_ALIGN 1UL << 20
#define MKALIGN(x, a) (((uint64_t)(x) + (a) - 1) & ~(uint64_t)((a) - 1))
- uint64_t total_len = 0, offset1 = 0;
+ uint64_t total_len = 0, offset1 = 0, offset0;
- if ( (args->acpi_module.length == 0)&&(args->smbios_module.length == 0) )
- return 0;
+
+ /* Want to place the modules 1Mb+change behind the loader image. */
+ *mstart_out = MKALIGN(elf->pend, MB_ALIGN) + (MB_ALIGN);
/* Find the total length for the firmware modules with a reasonable large
* alignment size to align each the modules.
*/
- total_len = MKALIGN(args->acpi_module.length, MODULE_ALIGN);
+ total_len += module_init(&args->bios_module, *mstart_out + total_len);
+ total_len += module_init(&args->acpi_table_module, *mstart_out + total_len);
+ offset0 = total_len;
+ total_len += MKALIGN(args->acpi_module.length, MODULE_ALIGN);
offset1 = total_len;
total_len += MKALIGN(args->smbios_module.length, MODULE_ALIGN);
- /* Want to place the modules 1Mb+change behind the loader image. */
- *mstart_out = MKALIGN(elf->pend, MB_ALIGN) + (MB_ALIGN);
*mend_out = *mstart_out + total_len;
- if ( *mend_out > vend )
+ if ( *mend_out > vend )
return -1;
if ( args->acpi_module.length != 0 )
- args->acpi_module.guest_addr_out = *mstart_out;
+ args->acpi_module.guest_addr_out = *mstart_out + offset0;
if ( args->smbios_module.length != 0 )
args->smbios_module.guest_addr_out = *mstart_out + offset1;
@@ -158,6 +169,17 @@ static int loadelfimage(xc_interface *xch, struct elf_binary *elf,
return rc;
}
+static void loadmodule(struct xc_hvm_firmware_module *x,
+ uint8_t *dest, uint64_t mstart)
+{
+ if ( x->length != 0 )
+ {
+ memcpy(dest + (x->guest_addr_out - mstart),
+ x->data,
+ x->length);
+ }
+}
+
static int loadmodules(xc_interface *xch,
struct xc_hvm_build_args *args,
uint64_t mstart, uint64_t mend,
@@ -196,9 +218,11 @@ static int loadmodules(xc_interface *xch,
memset(dest, 0, pages << PAGE_SHIFT);
/* Load modules into range */
+ loadmodule(&args->bios_module, dest, mstart);
+ loadmodule(&args->acpi_table_module, dest, mstart);
if ( args->acpi_module.length != 0 )
{
- memcpy(dest,
+ memcpy(dest + (args->acpi_module.guest_addr_out - mstart),
args->acpi_module.data,
args->acpi_module.length);
}
@@ -729,6 +753,10 @@ int xc_hvm_build(xc_interface *xch, uint32_t domid,
args.acpi_module.guest_addr_out;
hvm_args->smbios_module.guest_addr_out =
args.smbios_module.guest_addr_out;
+ hvm_args->bios_module.guest_addr_out =
+ args.bios_module.guest_addr_out;
+ hvm_args->acpi_table_module.guest_addr_out =
+ args.acpi_table_module.guest_addr_out;
}
free(image);
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH 2/5] libxl: Load guest BIOS and ACPI table from file.
2015-09-16 17:19 [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 1/5] libxc: Load BIOS and ACPI table into guest memory Anthony PERARD
@ 2015-09-16 17:19 ` Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 3/5] hvmloader: Load BIOS from where libxc left it Anthony PERARD
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Anthony PERARD @ 2015-09-16 17:19 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD
---
tools/libxl/libxl_dom.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index c2518a3..6c0a257 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -790,6 +790,32 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
return 0;
}
+static int hvm_build_set_xs_values_single_module(libxl__gc *gc,
+ uint32_t domid,
+ struct xc_hvm_firmware_module *module,
+ const char *module_name)
+{
+ char *path = NULL;
+ int ret;
+ if (module->guest_addr_out) {
+ path = GCSPRINTF("/local/domain/%d/hvmloader/%s/address",
+ domid, module_name);
+
+ ret = libxl__xs_write(gc, XBT_NULL, path, "0x%"PRIx64,
+ module->guest_addr_out);
+ if (ret)
+ return ret;
+
+ path = GCSPRINTF("/local/domain/%d/hvmloader/%s/length",
+ domid, module_name);
+
+ ret = libxl__xs_write(gc, XBT_NULL, path, "0x%x", module->length);
+ if (ret)
+ return ret;
+ }
+ return 0;
+}
+
static int hvm_build_set_xs_values(libxl__gc *gc,
uint32_t domid,
struct xc_hvm_build_args *args)
@@ -797,6 +823,16 @@ static int hvm_build_set_xs_values(libxl__gc *gc,
char *path = NULL;
int ret = 0;
+ ret = hvm_build_set_xs_values_single_module(gc, domid,
+ &args->bios_module,
+ "bios");
+ if (ret)
+ goto err;
+ ret = hvm_build_set_xs_values_single_module(gc, domid,
+ &args->acpi_table_module,
+ "acpi_table");
+ if (ret)
+ goto err;
if (args->smbios_module.guest_addr_out) {
path = GCSPRINTF("/local/domain/%d/"HVM_XS_SMBIOS_PT_ADDRESS, domid);
@@ -867,6 +903,50 @@ static int libxl__domain_firmware(libxl__gc *gc,
args->image_file_name = libxl__abs_path(gc, firmware,
libxl__xenfirmwaredir_path());
+ // load bios
+ {
+ // XXX select proper bios.
+ const char *bios_bin_filename = libxl__abs_path(gc, "seabios.bin",
+ libxl__xenfirmwaredir_path());
+ LOG(DEBUG, "Loading BIOS: %s", bios_bin_filename);
+ data = NULL;
+ e = libxl_read_file_contents(ctx, bios_bin_filename,
+ &data, &datalen);
+ if (e) {
+ LOGEV(ERROR, e, "failed to read BIOS firmware file %s",
+ bios_bin_filename);
+ goto out;
+ }
+ libxl__ptr_add(gc, data);
+ if (datalen) {
+ /* Only accept non-empty files */
+ args->bios_module.data = data;
+ args->bios_module.length = (uint32_t)datalen;
+ }
+ }
+ // load acpi table
+ {
+ // XXX select proper acpi table.
+ const char *acpi_table_filename = libxl__abs_path(gc,
+ "dsdt_anycpu_qemu_xen.aml",
+ libxl__xenfirmwaredir_path());
+ LOG(DEBUG, "Loading ACPI Table: %s", bios_bin_filename);
+ data = NULL;
+ e = libxl_read_file_contents(ctx, acpi_table_filename,
+ &data, &datalen);
+ if (e) {
+ LOGEV(ERROR, e, "failed to read ACPI tables file %s",
+ acpi_table_filename);
+ goto out;
+ }
+ libxl__ptr_add(gc, data);
+ if (datalen) {
+ /* Only accept non-empty files */
+ args->acpi_table_module.data = data;
+ args->acpi_table_module.length = (uint32_t)datalen;
+ }
+ }
+
if (info->u.hvm.smbios_firmware) {
data = NULL;
e = libxl_read_file_contents(ctx, info->u.hvm.smbios_firmware,
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH 3/5] hvmloader: Load BIOS from where libxc left it.
2015-09-16 17:19 [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 1/5] libxc: Load BIOS and ACPI table into guest memory Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 2/5] libxl: Load guest BIOS and ACPI table from file Anthony PERARD
@ 2015-09-16 17:19 ` Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 4/5] hvmloader: Load ACPI table from here " Anthony PERARD
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Anthony PERARD @ 2015-09-16 17:19 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD
---
tools/firmware/hvmloader/config.h | 9 +--------
tools/firmware/hvmloader/hvmloader.c | 25 +++++++++++++------------
tools/firmware/hvmloader/seabios.c | 24 ++++++++++++++----------
3 files changed, 28 insertions(+), 30 deletions(-)
diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h
index b838cf9..0ddd897 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -12,17 +12,10 @@ extern unsigned long igd_opregion_pgbase;
struct bios_config {
const char *name;
- /* BIOS ROM image bits */
- void *image;
- unsigned int image_size;
-
- /* Physical address to load at */
- unsigned int bios_address;
-
/* ROMS */
void (*load_roms)(void);
- void (*bios_load)(const struct bios_config *config);
+ void (*bios_load)(const struct bios_config *config, void* addr, uint32_t size);
void (*bios_info_setup)(void);
void (*bios_info_finish)(void);
diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index 716d03c..04b5076 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -253,6 +253,9 @@ int main(void)
{
const struct bios_config *bios;
int acpi_enabled;
+ uint8_t *bios_addr;
+ uint32_t bios_lenght;
+ const char *s;
/* Initialise hypercall stubs with RET, rendering them no-ops. */
memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE);
@@ -286,16 +289,14 @@ int main(void)
bios->create_smbios_tables();
}
+ // XXX check that the values exist and are correct
+ s = xenstore_read("hvmloader/bios/address", NULL);
+ bios_addr = (uint8_t*)(uint32_t)strtoll(s, NULL, 0);
+ s = xenstore_read("hvmloader/bios/length", NULL);
+ bios_lenght = (uint32_t)strtoll(s, NULL, 0);
+
printf("Loading %s ...\n", bios->name);
- if ( bios->bios_load )
- bios->bios_load(bios);
- else
- {
- BUG_ON(bios->bios_address + bios->image_size >
- HVMLOADER_PHYSICAL_ADDRESS);
- memcpy((void *)bios->bios_address, bios->image,
- bios->image_size);
- }
+ bios->bios_load(bios, bios_addr, bios_lenght);
if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
{
@@ -333,9 +334,9 @@ int main(void)
if ( SCRATCH_PHYSICAL_ADDRESS != scratch_start )
printf(" %05x-%05lx: Scratch space\n",
SCRATCH_PHYSICAL_ADDRESS, scratch_start);
- printf(" %05x-%05x: Main BIOS\n",
- bios->bios_address,
- bios->bios_address + bios->image_size - 1);
+ /* printf(" %05x-%05x: Main BIOS\n", */
+ /* bios->bios_address, */
+ /* bios->bios_address + bios->image_size - 1); */
if ( bios->e820_setup )
bios->e820_setup();
diff --git a/tools/firmware/hvmloader/seabios.c b/tools/firmware/hvmloader/seabios.c
index c6b3d9f..28793ca 100644
--- a/tools/firmware/hvmloader/seabios.c
+++ b/tools/firmware/hvmloader/seabios.c
@@ -27,9 +27,6 @@
#include "smbios_types.h"
#include "acpi/acpi2_0.h"
-#define ROM_INCLUDE_SEABIOS
-#include "roms.inc"
-
extern unsigned char dsdt_anycpu_qemu_xen[];
extern int dsdt_anycpu_qemu_xen_len;
@@ -121,6 +118,7 @@ static void seabios_create_pir_tables(void)
add_table(create_pir_tables());
}
+unsigned int seabios_bios_address = 0;
static void seabios_setup_e820(void)
{
struct seabios_info *info = (void *)BIOS_INFO_PHYSICAL_ADDRESS;
@@ -128,21 +126,27 @@ static void seabios_setup_e820(void)
info->e820 = (uint32_t)e820;
/* SeaBIOS reserves memory in e820 as necessary so no low reservation. */
- info->e820_nr = build_e820_table(e820, 0, 0x100000-sizeof(seabios));
+ BUG_ON(seabios_bios_address == 0);
+ info->e820_nr = build_e820_table(e820, 0, seabios_bios_address);
dump_e820_table(e820, info->e820_nr);
}
-struct bios_config seabios_config = {
- .name = "SeaBIOS",
+static void seabios_load(const struct bios_config *bios,
+ void *bios_addr, uint32_t bios_lenght)
+{
+ unsigned int bios_dest = 0x100000 - bios_lenght;
+ seabios_bios_address = 0x100000 - bios_lenght;
- .image = seabios,
- .image_size = sizeof(seabios),
+ BUG_ON(bios_dest + bios_lenght > HVMLOADER_PHYSICAL_ADDRESS);
+ memcpy((void *)bios_dest, bios_addr, bios_lenght);
+}
- .bios_address = 0x100000 - sizeof(seabios),
+struct bios_config seabios_config = {
+ .name = "SeaBIOS",
.load_roms = NULL,
- .bios_load = NULL,
+ .bios_load = seabios_load,
.bios_info_setup = seabios_setup_bios_info,
.bios_info_finish = seabios_finish_bios_info,
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH 4/5] hvmloader: Load ACPI table from here libxc left it.
2015-09-16 17:19 [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Anthony PERARD
` (2 preceding siblings ...)
2015-09-16 17:19 ` [RFC PATCH 3/5] hvmloader: Load BIOS from where libxc left it Anthony PERARD
@ 2015-09-16 17:19 ` Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 5/5] hvmloader: Keep BIOS and ACPI blob in separated files Anthony PERARD
2015-09-16 18:56 ` [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Andrew Cooper
5 siblings, 0 replies; 11+ messages in thread
From: Anthony PERARD @ 2015-09-16 17:19 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD
---
tools/firmware/hvmloader/config.h | 2 +-
tools/firmware/hvmloader/hvmloader.c | 9 ++++++++-
tools/firmware/hvmloader/seabios.c | 9 +++------
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h
index 0ddd897..1df5fd9 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -22,7 +22,7 @@ struct bios_config {
void (*e820_setup)(void);
- void (*acpi_build_tables)(void);
+ void (*acpi_build_tables)(void* addr, uint32_t size);
void (*create_mp_tables)(void);
void (*create_smbios_tables)(void);
void (*create_pir_tables)(void);
diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index 04b5076..5b7ae7f 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -317,8 +317,15 @@ int main(void)
if ( bios->acpi_build_tables )
{
+ uint8_t *acpi_table_addr;
+ uint32_t acpi_table_lenght;
printf("Loading ACPI ...\n");
- bios->acpi_build_tables();
+ // XXX check that the values exist and are correct
+ s = xenstore_read("hvmloader/acpi_table/address", NULL);
+ acpi_table_addr = (uint8_t*)(uint32_t)strtoll(s, NULL, 0);
+ s = xenstore_read("hvmloader/acpi_table/length", NULL);
+ acpi_table_lenght = (uint32_t)strtoll(s, NULL, 0);
+ bios->acpi_build_tables(acpi_table_addr, acpi_table_lenght);
}
acpi_enable_sci();
diff --git a/tools/firmware/hvmloader/seabios.c b/tools/firmware/hvmloader/seabios.c
index 28793ca..8ac7a73 100644
--- a/tools/firmware/hvmloader/seabios.c
+++ b/tools/firmware/hvmloader/seabios.c
@@ -27,9 +27,6 @@
#include "smbios_types.h"
#include "acpi/acpi2_0.h"
-extern unsigned char dsdt_anycpu_qemu_xen[];
-extern int dsdt_anycpu_qemu_xen_len;
-
struct seabios_info {
char signature[14]; /* XenHVMSeaBIOS\0 */
uint8_t length; /* Length of this struct */
@@ -87,12 +84,12 @@ static void add_table(uint32_t t)
info->tables_nr++;
}
-static void seabios_acpi_build_tables(void)
+static void seabios_acpi_build_tables(void* addr, uint32_t size)
{
uint32_t rsdp = (uint32_t)scratch_alloc(sizeof(struct acpi_20_rsdp), 0);
struct acpi_config config = {
- .dsdt_anycpu = dsdt_anycpu_qemu_xen,
- .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
+ .dsdt_anycpu = addr,
+ .dsdt_anycpu_len = size,
.dsdt_15cpu = NULL,
.dsdt_15cpu_len = 0,
};
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH 5/5] hvmloader: Keep BIOS and ACPI blob in separated files.
2015-09-16 17:19 [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Anthony PERARD
` (3 preceding siblings ...)
2015-09-16 17:19 ` [RFC PATCH 4/5] hvmloader: Load ACPI table from here " Anthony PERARD
@ 2015-09-16 17:19 ` Anthony PERARD
2015-09-16 18:56 ` [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Andrew Cooper
5 siblings, 0 replies; 11+ messages in thread
From: Anthony PERARD @ 2015-09-16 17:19 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD
---
tools/firmware/Makefile | 20 +++++++++++++++++++-
tools/firmware/hvmloader/acpi/Makefile | 8 +++++---
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile
index 6cc86ce..3912a9d 100644
--- a/tools/firmware/Makefile
+++ b/tools/firmware/Makefile
@@ -19,6 +19,19 @@ SUBDIRS-y += hvmloader
LD32BIT-$(CONFIG_FreeBSD) := LD32BIT_FLAG=-melf_i386_fbsd
+SEABIOS_DIR := seabios-dir
+
+ifeq ($(CONFIG_SEABIOS),y)
+ifeq ($(SEABIOS_PATH),)
+ SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin
+else
+ SEABIOS_ROM := $(SEABIOS_PATH)
+endif
+ROMS += $(SEABIOS_ROM)
+endif
+
+ACPI_TABLE_QEMU_PC_I440FX = hvmloader/acpi/dsdt_anycpu_qemu_xen.aml
+
ovmf-dir:
GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf-dir
cp ovmf-makefile ovmf-dir/Makefile;
@@ -42,9 +55,14 @@ endif
.PHONY: install
-install: all
+install: all $(ROMS)
[ -d $(INST_DIR) ] || $(INSTALL_DIR) $(INST_DIR)
+ # hvmloader
[ ! -e $(TARGET) ] || $(INSTALL_DATA) $(TARGET) $(INST_DIR)
+ifeq ($(CONFIG_SEABIOS),y)
+ [ ! -e $(SEABIOS_ROM) ] || $(INSTALL_DATA) $(SEABIOS_ROM) $(INST_DIR)/seabios.bin
+endif
+ [ ! -e $(ACPI_TABLE_QEMU_PC_I440FX) ] || $(INSTALL_DATA) $(ACPI_TABLE_QEMU_PC_I440FX) $(INST_DIR)
.PHONY: clean
clean: subdirs-clean
diff --git a/tools/firmware/hvmloader/acpi/Makefile b/tools/firmware/hvmloader/acpi/Makefile
index d3e882a..e444c8c 100644
--- a/tools/firmware/hvmloader/acpi/Makefile
+++ b/tools/firmware/hvmloader/acpi/Makefile
@@ -17,13 +17,13 @@
XEN_ROOT = $(CURDIR)/../../../..
include $(XEN_ROOT)/tools/firmware/Rules.mk
-C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c dsdt_anycpu_qemu_xen.c
+C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c
OBJS = $(patsubst %.c,%.o,$(C_SRC))
CFLAGS += $(CFLAGS_xeninclude)
vpath iasl $(PATH)
-all: acpi.a
+all: acpi.a dsdt_anycpu_qemu_xen.aml
ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h: %.h: %.asl iasl
iasl -vs -p $* -tc $<
@@ -46,7 +46,9 @@ $(filter dsdt_%.c,$(C_SRC)): %.c: iasl %.asl
iasl -vs -p $* -tc $*.asl
sed -e 's/AmlCode/$*/g' $*.hex >$@
echo "int $*_len=sizeof($*);" >>$@
- rm -f $*.aml $*.hex
+ rm -f $*.hex
+dsdt_anycpu_qemu_xen.aml: %.aml: iasl %.asl
+ iasl -vs -p $* $*.asl
iasl:
@echo
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader.
2015-09-16 17:19 [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Anthony PERARD
` (4 preceding siblings ...)
2015-09-16 17:19 ` [RFC PATCH 5/5] hvmloader: Keep BIOS and ACPI blob in separated files Anthony PERARD
@ 2015-09-16 18:56 ` Andrew Cooper
2015-09-17 9:49 ` Anthony PERARD
5 siblings, 1 reply; 11+ messages in thread
From: Andrew Cooper @ 2015-09-16 18:56 UTC (permalink / raw)
To: Anthony PERARD, xen-devel
On 16/09/2015 18:19, Anthony PERARD wrote:
> Hi all,
>
> I've start to look at loading the BIOS and the ACPI tables via the
> toolstack instead of having them embedded in the hvmloader binary. This is
> done by using the same mechanics as the one used to load extra ACPI tables
> or SMBIOS.
>
> - libxl load the blob into it's memory and add it to
> struct xc_hvm_build_args.bios_module
> - libxc load the blob into the guest memory and give back the guest address
> of the blob.
> - libxl store the location of the blob (and it's lenght) into xenstore, in
> /local/domain/$domid/hvmloader/$blob_name/{address,length} ($blob_name
> would be "bios" or "acpi_table"; there is already "acpi" and "smbios"
> that exist)
> - hvmloader read the addresses from xenstore and put the blob at the right
> place.
>
> How this is looking?
>
> Right now, this patch series would only work for SeaBIOS.
I highly recommend that you build on top of Rogers DMlite series, which
already offers a multiboot-style way of adding extra modules to HVM
guests. (That was the way I was planning to do this in some copious
free time).
In particular, storing the address/length in xenstore is conceptually
incorrect as the information turns stale as soon as hvmloader starts
running.
* Modify hvmloader to have a DMLite entry, which gives it a command line
and module list
* Modify libxc to be able to take an arbitrary quantity of modules,
rather than the currently limit of 1
Once the above work times are in place, the actual splitting-up of
hvmloader can occur.
I recommend a command line way of telling hvmloader which module is
what, such as a legacy bios image, (other firmware image?), supplemental
acpi table, supplemental smbios table, nvram blob? (This last one will
require a bit of extra work so the toolstack can pull the blob back out
of the guest on destruction)
~Andrew
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader.
2015-09-16 18:56 ` [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Andrew Cooper
@ 2015-09-17 9:49 ` Anthony PERARD
2015-09-25 15:37 ` Ian Campbell
0 siblings, 1 reply; 11+ messages in thread
From: Anthony PERARD @ 2015-09-17 9:49 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel
On Wed, Sep 16, 2015 at 07:56:44PM +0100, Andrew Cooper wrote:
> On 16/09/2015 18:19, Anthony PERARD wrote:
> > Hi all,
> >
> > I've start to look at loading the BIOS and the ACPI tables via the
> > toolstack instead of having them embedded in the hvmloader binary. This is
> > done by using the same mechanics as the one used to load extra ACPI tables
> > or SMBIOS.
> >
> > - libxl load the blob into it's memory and add it to
> > struct xc_hvm_build_args.bios_module
> > - libxc load the blob into the guest memory and give back the guest address
> > of the blob.
> > - libxl store the location of the blob (and it's lenght) into xenstore, in
> > /local/domain/$domid/hvmloader/$blob_name/{address,length} ($blob_name
> > would be "bios" or "acpi_table"; there is already "acpi" and "smbios"
> > that exist)
> > - hvmloader read the addresses from xenstore and put the blob at the right
> > place.
> >
> > How this is looking?
> >
> > Right now, this patch series would only work for SeaBIOS.
>
> I highly recommend that you build on top of Rogers DMlite series, which
> already offers a multiboot-style way of adding extra modules to HVM
> guests. (That was the way I was planning to do this in some copious
> free time).
Thanks. I will look into this.
> In particular, storing the address/length in xenstore is conceptually
> incorrect as the information turns stale as soon as hvmloader starts
> running.
>
> * Modify hvmloader to have a DMLite entry, which gives it a command line
> and module list
> * Modify libxc to be able to take an arbitrary quantity of modules,
> rather than the currently limit of 1
>
> Once the above work times are in place, the actual splitting-up of
> hvmloader can occur.
>
> I recommend a command line way of telling hvmloader which module is
> what, such as a legacy bios image, (other firmware image?), supplemental
> acpi table, supplemental smbios table, nvram blob? (This last one will
> require a bit of extra work so the toolstack can pull the blob back out
> of the guest on destruction)
--
Anthony PERARD
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader.
2015-09-17 9:49 ` Anthony PERARD
@ 2015-09-25 15:37 ` Ian Campbell
2015-09-25 15:45 ` Anthony PERARD
0 siblings, 1 reply; 11+ messages in thread
From: Ian Campbell @ 2015-09-25 15:37 UTC (permalink / raw)
To: Anthony PERARD, Andrew Cooper; +Cc: xen-devel
On Thu, 2015-09-17 at 10:49 +0100, Anthony PERARD wrote:
> On Wed, Sep 16, 2015 at 07:56:44PM +0100, Andrew Cooper wrote:
> > I highly recommend that you build on top of Rogers DMlite series, which
> > already offers a multiboot-style way of adding extra modules to HVM
> > guests. (That was the way I was planning to do this in some copious
> > free time).
>
> Thanks. I will look into this.
Given that major seeming change is there anything in this series which is
still worth reviewing?
Ian.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader.
2015-09-25 15:37 ` Ian Campbell
@ 2015-09-25 15:45 ` Anthony PERARD
2015-09-25 16:28 ` Ian Campbell
0 siblings, 1 reply; 11+ messages in thread
From: Anthony PERARD @ 2015-09-25 15:45 UTC (permalink / raw)
To: Ian Campbell; +Cc: Andrew Cooper, xen-devel
On Fri, Sep 25, 2015 at 04:37:19PM +0100, Ian Campbell wrote:
> On Thu, 2015-09-17 at 10:49 +0100, Anthony PERARD wrote:
> > On Wed, Sep 16, 2015 at 07:56:44PM +0100, Andrew Cooper wrote:
>
> > > I highly recommend that you build on top of Rogers DMlite series, which
> > > already offers a multiboot-style way of adding extra modules to HVM
> > > guests. (That was the way I was planning to do this in some copious
> > > free time).
> >
> > Thanks. I will look into this.
>
> Given that major seeming change is there anything in this series which is
> still worth reviewing?
No, I already have the amount of review I was looking for.
Thanks,
--
Anthony PERARD
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader.
2015-09-25 15:45 ` Anthony PERARD
@ 2015-09-25 16:28 ` Ian Campbell
0 siblings, 0 replies; 11+ messages in thread
From: Ian Campbell @ 2015-09-25 16:28 UTC (permalink / raw)
To: Anthony PERARD; +Cc: Andrew Cooper, xen-devel
On Fri, 2015-09-25 at 16:45 +0100, Anthony PERARD wrote:
> On Fri, Sep 25, 2015 at 04:37:19PM +0100, Ian Campbell wrote:
> > On Thu, 2015-09-17 at 10:49 +0100, Anthony PERARD wrote:
> > > On Wed, Sep 16, 2015 at 07:56:44PM +0100, Andrew Cooper wrote:
> >
> > > > I highly recommend that you build on top of Rogers DMlite series,
> > > > which
> > > > already offers a multiboot-style way of adding extra modules to HVM
> > > > guests. (That was the way I was planning to do this in some
> > > > copious
> > > > free time).
> > >
> > > Thanks. I will look into this.
> >
> > Given that major seeming change is there anything in this series which
> > is
> > still worth reviewing?
>
> No, I already have the amount of review I was looking for.
OK, I'll await a v2 then, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-09-25 16:28 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 17:19 [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 1/5] libxc: Load BIOS and ACPI table into guest memory Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 2/5] libxl: Load guest BIOS and ACPI table from file Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 3/5] hvmloader: Load BIOS from where libxc left it Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 4/5] hvmloader: Load ACPI table from here " Anthony PERARD
2015-09-16 17:19 ` [RFC PATCH 5/5] hvmloader: Keep BIOS and ACPI blob in separated files Anthony PERARD
2015-09-16 18:56 ` [RFC PATCH 0/5] Load BIOS via toolstack instead of been embedded in hvmloader Andrew Cooper
2015-09-17 9:49 ` Anthony PERARD
2015-09-25 15:37 ` Ian Campbell
2015-09-25 15:45 ` Anthony PERARD
2015-09-25 16:28 ` Ian Campbell
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).