From: Anthony PERARD <anthony.perard@citrix.com>
To: xen-devel@lists.xen.org
Cc: Anthony PERARD <anthony.perard@citrix.com>
Subject: [RFC PATCH 2/5] libxl: Load guest BIOS and ACPI table from file.
Date: Wed, 16 Sep 2015 18:19:44 +0100 [thread overview]
Message-ID: <1442423987-14956-3-git-send-email-anthony.perard@citrix.com> (raw)
In-Reply-To: <1442423987-14956-1-git-send-email-anthony.perard@citrix.com>
---
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
next prev parent reply other threads:[~2015-09-16 17:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=1442423987-14956-3-git-send-email-anthony.perard@citrix.com \
--to=anthony.perard@citrix.com \
--cc=xen-devel@lists.xen.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).