Replace the firmware loaded into HVM guests with an OS kernel. Since the HVM
builder now uses the PV xc_dom_* set of functions this kernel will be parsed
and loaded inside the guest like on PV, but the container is a pure HVM
guest.
Signed-off-by: Roger Pau Monné
Cc: Ian Jackson
Cc: Stefano Stabellini
Cc: Ian Campbell
Cc: Wei Liu
Cc: Jan Beulich
Cc: Andrew Cooper
Cc: Boris Ostrovsky
Cc: Konrad Rzeszutek Wilk
Cc: Elena Ufimtseva
---
Only xc_dom_elfloader has been switched in order to use hvm-3.0-x86_32,
other loaders need to be adapted also.
---
tools/libxc/xc_dom_elfloader.c | 4
tools/libxl/libxl_dom.c| 17 +
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
index 6ce1062..2f05015 100644
--- a/tools/libxc/xc_dom_elfloader.c
+++ b/tools/libxc/xc_dom_elfloader.c
@@ -57,6 +57,10 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,
{
uint64_t machine = elf_uval(elf, elf->ehdr, e_machine);
+if ( dom->container_type == XC_DOM_HVM_CONTAINER &&
+ dom->parms.phys_entry != UNSET_ADDR )
+return "hvm-3.0-x86_32";
+
switch ( machine )
{
case EM_386:
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 12ede26..8ee14b9 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -874,10 +874,20 @@ static int libxl__domain_firmware(libxl__gc *gc,
}
}
-rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,
+if (info->kernel != NULL) {
+/* Try to load a kernel instead of the firmware. */
+rc = xc_dom_kernel_file(dom, info->kernel);
+if (rc == 0 && info->ramdisk != NULL)
+rc = xc_dom_ramdisk_file(dom, info->ramdisk);
+dom->vga_hole = 0;
+} else {
+rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,
libxl__xenfirmwaredir_path()));
+dom->vga_hole = 1;
+}
+
if (rc != 0) {
-LOGE(ERROR, "xc_dom_kernel_file failed");
+LOGE(ERROR, "xc_dom_{kernel_file/ramdisk_file} failed");
goto out;
}
@@ -931,7 +941,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
xc_dom_loginit(ctx->xch);
-dom = xc_dom_allocate(ctx->xch, NULL, NULL);
+dom = xc_dom_allocate(ctx->xch, info->cmdline, NULL);
if (!dom) {
LOGE(ERROR, "xc_dom_allocate failed");
goto out;
@@ -974,7 +984,6 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
dom->lowmem_end = lowmem_end;
dom->highmem_end = highmem_end;
dom->mmio_start = mmio_start;
-dom->vga_hole = 1;
if (info->num_vnuma_nodes != 0) {
int i;
--
1.9.5 (Apple Git-50.3)
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel