[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 22/22] lib{xc/xl}: allow the creation of HVM domains with a kernel
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à <roger.pau@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> --- 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 | 18 ++++++++++++++---- 2 files changed, 18 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 d209f67..d3d64d2 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -900,10 +900,21 @@ static int libxl__domain_firmware(libxl__gc *gc, } } - rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware, + if (info->kernel != NULL && + info->device_model_version == LIBXL_DEVICE_MODEL_VERSION_NONE) { + /* 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->emulation = false; + } else { + rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware, libxl__xenfirmwaredir_path())); + dom->emulation = true; + } + if (rc != 0) { - LOGE(ERROR, "xc_dom_kernel_file failed"); + LOGE(ERROR, "xc_dom_{kernel_file/ramdisk_file} failed"); goto out; } @@ -960,7 +971,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; @@ -1003,7 +1014,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->emulation = true; if (info->num_vnuma_nodes != 0) { int i; -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |