Skip to contentSkip to conversation

tools: libx[cl]: support alternative HVM firmware

PATCH In review Ian Campbell 4 participants 13 messages May 13, 2011 – May 25, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: libx[cl]: support alternative HVM firmware

The following series makes it possible to use any ELF file as the initial HVM domain firmware and begins to setup libxl to cope with this.

Primarily this involves making the HVM domain builder happy and behave correctly with unaligned firmware images and changing the libxl API to refer to "firmware" rather than "hvmloader".

It is possible that this will turn out to be the right approach for supporting SeaBIOS, although this isn't confirmed yet so I haven't proposed removing any of the hvmloader changes I proposed and I include the final patch ("load SeaBIOS directly rather than via hvmloader") here just as a proof of concept rather than for application.

I understand that the people working on integrating tianocore support are also interested in this functionality so I'm posting the series before the SeaBIOS side is really figured out, there isn't really anything seabios specific here.

#1 lore raw

PATCH 1/1 tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID c5c7ae5f33b16ee03535e9c688ad9bee2510b2b6
# Parent 9476bc07db2c654b266ab1f1c9ff0c65f401d74d
tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment

Enables direct loading of e.g. seabios.elf.

tools/libxc/xc_hvm_build.c +5 -7
diff -r 9476bc07db2c -r c5c7ae5f33b1 tools/libxc/xc_hvm_build.c
@@ -88,7 +88,9 @@ static int loadelfimage(
     struct elf_binary *elf, uint32_t dom, unsigned long *parray)
 {
     privcmd_mmap_entry_t *entries = NULL;
-    size_t pages = (elf->pend - elf->pstart + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    unsigned long pfn_start = elf->pstart >> PAGE_SHIFT;
+    unsigned long pfn_end = (elf->pend + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    size_t pages = pfn_end - pfn_start;
     int i, rc = -1;
 
     /* Map address space for initial elf image. */
@@ -105,6 +107,8 @@ static int loadelfimage(
     if ( elf->dest == NULL )
         goto err;
 
+    elf->dest += elf->pstart & 4095;
+
     /* Load the initial elf image. */
     elf_load_binary(elf);
     rc = 0;
@@ -169,12 +173,6 @@ static int setup_guest(xc_interface *xch
         goto error_out;
     }
 
-    if ( (elf.pstart & (PAGE_SIZE - 1)) != 0 )
-    {
-        PERROR("Guest OS must load to a page boundary.");
-        goto error_out;
-    }
-
     IPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n"
             "  Loader:        %016"PRIx64"->%016"PRIx64"\n"
             "  TOTAL:         %016"PRIx64"->%016"PRIx64"\n"
#2 lore raw

Re: [PATCH 1 of 8] tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment

Quoted 26 lines · Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID c5c7ae5f33b16ee03535e9c688ad9bee2510b2b6
# Parent 9476bc07db2c654b266ab1f1c9ff0c65f401d74d
tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment

Enables direct loading of e.g. seabios.elf.

diff -r 9476bc07db2c -r c5c7ae5f33b1 tools/libxc/xc_hvm_build.c

tools/libxc/xc_hvm_build.c +3 -1
@@ -88,7 +88,9 @@ static int loadelfimage(
     struct elf_binary *elf, uint32_t dom, unsigned long *parray)
 {
     privcmd_mmap_entry_t *entries = NULL;
-    size_t pages = (elf->pend - elf->pstart + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    unsigned long pfn_start = elf->pstart >> PAGE_SHIFT;
+    unsigned long pfn_end = (elf->pend + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    size_t pages = pfn_end - pfn_start;
     int i, rc = -1;
 
     /* Map address space for initial elf image. */

tools/libxc/xc_hvm_build.c static int loadelfimage( · line 110

Quoted 4 lines
tools/libxc/xc_hvm_build.c +1 -0
@@ -105,6 +107,8 @@ static int loadelfimage(
     if ( elf->dest == NULL )
         goto err;
 
+    elf->dest += elf->pstart & 4095;

Whoa. Decimal numbers! Threw me off when I saw this - so used to 0xfff. :-)

#3 lore raw

Re: [PATCH 1 of 8] tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment

Quoted 25 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID c5c7ae5f33b16ee03535e9c688ad9bee2510b2b6
# Parent 9476bc07db2c654b266ab1f1c9ff0c65f401d74d
tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment

Enables direct loading of e.g. seabios.elf.

diff -r 9476bc07db2c -r c5c7ae5f33b1 tools/libxc/xc_hvm_build.c

tools/libxc/xc_hvm_build.c +3 -1
@@ -88,7 +88,9 @@ static int loadelfimage(
     struct elf_binary *elf, uint32_t dom, unsigned long *parray)
 {
     privcmd_mmap_entry_t *entries = NULL;
-    size_t pages = (elf->pend - elf->pstart + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    unsigned long pfn_start = elf->pstart >> PAGE_SHIFT;
+    unsigned long pfn_end = (elf->pend + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    size_t pages = pfn_end - pfn_start;
     int i, rc = -1;
 
Quoted 8 lines

tools/libxc/xc_hvm_build.c static int loadelfimage( · line 110

Quoted 6 lines
tools/libxc/xc_hvm_build.c +1 -0
     /* Map address space for initial elf image. */
@@ -105,6 +107,8 @@ static int loadelfimage(
     if ( elf->dest == NULL )
         goto err;
 
+    elf->dest += elf->pstart & 4095;

Whoa. Decimal numbers! Threw me off when I saw this - so used to 0xfff. :-)

Oops, I switch to the symbolic names for everything else but missed that one. Should be (PAGE_SIZE - 1).

Updated version below.

8<---------------------------------------------------------------

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305296917 -3600
# Node ID 07b02c79fc9c71ff3c8a966ad78cd8aa94210df5
# Parent 9476bc07db2c654b266ab1f1c9ff0c65f401d74d
tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment

Enables direct loading of e.g. seabios.elf.

tools/libxc/xc_hvm_build.c +5 -7
diff -r 9476bc07db2c -r 07b02c79fc9c tools/libxc/xc_hvm_build.c
@@ -88,7 +88,9 @@ static int loadelfimage(
     struct elf_binary *elf, uint32_t dom, unsigned long *parray)
 {
     privcmd_mmap_entry_t *entries = NULL;
-    size_t pages = (elf->pend - elf->pstart + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    unsigned long pfn_start = elf->pstart >> PAGE_SHIFT;
+    unsigned long pfn_end = (elf->pend + PAGE_SIZE - 1) >> PAGE_SHIFT;
+    size_t pages = pfn_end - pfn_start;
     int i, rc = -1;
 
     /* Map address space for initial elf image. */
@@ -105,6 +107,8 @@ static int loadelfimage(
     if ( elf->dest == NULL )
         goto err;
 
+    elf->dest += elf->pstart & (PAGE_SIZE - 1);
+
     /* Load the initial elf image. */
     elf_load_binary(elf);
     rc = 0;
@@ -169,12 +173,6 @@ static int setup_guest(xc_interface *xch
         goto error_out;
     }
 
-    if ( (elf.pstart & (PAGE_SIZE - 1)) != 0 )
-    {
-        PERROR("Guest OS must load to a page boundary.");
-        goto error_out;
-    }
-
     IPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n"
             "  Loader:        %016"PRIx64"->%016"PRIx64"\n"
             "  TOTAL:         %016"PRIx64"->%016"PRIx64"\n"
#4 lore raw

PATCH 1/1 tools: libxc: enable libelf logging for HVM domain builder

In reply to Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID 996d74359377c4c0c15c1e988a017613f872af65 # Parent c5c7ae5f33b16ee03535e9c688ad9bee2510b2b6
tools: libxc: enable libelf logging for HVM domain builder.

tools/libxc/xc_hvm_build.c +3 -0
diff -r c5c7ae5f33b1 -r 996d74359377 tools/libxc/xc_hvm_build.c
@@ -163,6 +163,9 @@ static int setup_guest(xc_interface *xch
     memset(&elf, 0, sizeof(elf));
     if ( elf_init(&elf, image, image_size) != 0 )
         goto error_out;
+
+    xc_elf_set_logfile(xch, &elf, 1);
+
     elf_parse_binary(&elf);
     v_start = 0;
     v_end = (unsigned long long)memsize << 20;
#5 lore raw

PATCH 1/1 tools: libxl/xl: Use "firmware" rather than "hvmloader" in API

In reply to Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID 84c3d1d16ddc3bc674354e5da8e97bac2ac9cc14
# Parent 996d74359377c4c0c15c1e988a017613f872af65
tools: libxl/xl: Use "firmware" rather than "hvmloader" in API.

23251:0710f53cef4a turned build_info.kernel into build_info.hvm.hvmloader however this is a rather specific name for a field which may be used to load things which aren't hvmloader in the future. Switch to calling the field and associated configuration itmes "firmware" instead.

tools/libxl/libxl.idl +1 -1
diff -r 996d74359377 -r 84c3d1d16ddc tools/libxl/libxl.idl
@@ -160,7 +160,7 @@ libxl_domain_build_info = Struct("domain
     ("hvm",             bool),
     ("u", KeyedUnion(None, "hvm",
                 [("hvm", "%s", Struct(None,
-                                       [("hvmloader", string),
+                                       [("firmware", string),
                                         ("pae", bool),
                                         ("apic", bool),
                                         ("acpi", bool),
tools/libxl/libxl_create.c +1 -1
diff -r 996d74359377 -r 84c3d1d16ddc tools/libxl/libxl_create.c
@@ -85,7 +85,7 @@ void libxl_init_build_info(libxl_domain_
     if (c_info->hvm) {
         b_info->video_memkb = 8 * 1024;
         b_info->hvm = 1;
-        b_info->u.hvm.hvmloader = NULL;
+        b_info->u.hvm.firmware = NULL;
         b_info->u.hvm.pae = 1;
         b_info->u.hvm.apic = 1;
         b_info->u.hvm.acpi = 1;
tools/libxl/libxl_dom.c +3 -3
diff -r 996d74359377 -r 84c3d1d16ddc tools/libxl/libxl_dom.c
@@ -269,11 +269,11 @@ static int hvm_build_set_params(xc_inter
     return 0;
 }
 
-static const char *libxl__domain_hvmloader(libxl__gc *gc,
+static const char *libxl__domain_firmware(libxl__gc *gc,
                                            libxl_domain_build_info *info)
 {
     return libxl__abs_path(gc,
-                           info->u.hvm.hvmloader ? : "hvmloader",
+                           info->u.hvm.firmware ? : "hvmloader",
                            libxl_xenfirmwaredir_path());
 }
 
@@ -289,7 +289,7 @@ int libxl__build_hvm(libxl__gc *gc, uint
         domid,
         (info->max_memkb - info->video_memkb) / 1024,
         (info->target_memkb - info->video_memkb) / 1024,
-        libxl__domain_hvmloader(gc, info));
+        libxl__domain_firmware(gc, info));
     if (ret) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm building failed");
         goto out;
tools/libxl/xl_cmdimpl.c +5 -5
diff -r 996d74359377 -r 84c3d1d16ddc tools/libxl/xl_cmdimpl.c
@@ -337,7 +337,7 @@ static void printf_info(int domid,
     printf("\t(image\n");
     if (c_info->hvm) {
         printf("\t\t(hvm\n");
-        printf("\t\t\t(loader %s)\n", b_info->u.hvm.hvmloader);
+        printf("\t\t\t(firmware %s)\n", b_info->u.hvm.firmware);
         printf("\t\t\t(video_memkb %d)\n", b_info->video_memkb);
         printf("\t\t\t(shadow_memkb %d)\n", b_info->shadow_memkb);
         printf("\t\t\t(pae %d)\n", b_info->u.hvm.pae);
@@ -748,10 +748,10 @@ static void parse_config_data(const char
     if (c_info->hvm == 1) {
         if (!xlu_cfg_get_string (config, "kernel", &buf))
             fprintf(stderr, "WARNING: ignoring \"kernel\" directive for HVM guest. "
-                    "Use \"hvmloader_override\" instead if you really want a non-default hvmloader\n");
-
-        xlu_cfg_replace_string (config, "hvmloader_override",
-                                &b_info->u.hvm.hvmloader);
+                    "Use \"firmware_override\" instead if you really want a non-default firmware\n");
+
+        xlu_cfg_replace_string (config, "firmware_override",
+                                &b_info->u.hvm.firmware);
         if (!xlu_cfg_get_long (config, "pae", &l))
             b_info->u.hvm.pae = l;
         if (!xlu_cfg_get_long (config, "apic", &l))
#6 lore raw

PATCH 1/1 tools: libxl: constify parameter to libxl__abs_path

In reply to Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1305294079 -3600
# Node ID 66579385ed4e553740ac8e44c514bb10336686e7 # Parent 84c3d1d16ddc3bc674354e5da8e97bac2ac9cc14
tools: libxl: constify parameter to libxl__abs_path

tools/libxl/libxl_internal.c +2 -2
diff -r 84c3d1d16ddc -r 66579385ed4e tools/libxl/libxl_internal.c
@@ -184,10 +184,10 @@ void libxl__log(libxl_ctx *ctx, xentooll
     va_end(ap);
 }
 
-char *libxl__abs_path(libxl__gc *gc, char *s, const char *path)
+char *libxl__abs_path(libxl__gc *gc, const char *s, const char *path)
 {
     if (!s || s[0] == '/')
-        return s;
+        return libxl__strdup(gc, s);
     return libxl__sprintf(gc, "%s/%s", path, s);
 }
 
tools/libxl/libxl_internal.h +1 -1
diff -r 84c3d1d16ddc -r 66579385ed4e tools/libxl/libxl_internal.h
@@ -309,7 +309,7 @@ _hidden void libxl__exec(int stdinfd, in
 _hidden void libxl__log_child_exitstatus(libxl__gc *gc,
                                 const char *what, pid_t pid, int status);
 
-_hidden char *libxl__abs_path(libxl__gc *gc, char *s, const char *path);
+_hidden char *libxl__abs_path(libxl__gc *gc, const char *s, const char *path);
 
 #define LIBXL__LOG_DEBUG   XTL_DEBUG
 #define LIBXL__LOG_INFO    XTL_INFO
#7 lore raw

PATCH 1/1 tools: libxl: pass device model info down into HVM domain build functions

In reply to Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID 5e7615dbe3008fd25edabb3fda3cb80a76015ed1
# Parent 66579385ed4e553740ac8e44c514bb10336686e7
tools: libxl: pass device model info down into HVM domain build functions.

The builder will soon need to know the device model version in order to select the correct firmware.

tools/libxl/libxl_create.c +7 -4
diff -r 66579385ed4e -r 5e7615dbe300 tools/libxl/libxl_create.c
@@ -144,8 +144,11 @@ static int init_console_info(libxl_devic
     return 0;
 }
 
-int libxl__domain_build(libxl__gc *gc, libxl_domain_build_info *info,
-                        uint32_t domid, libxl__domain_build_state *state)
+int libxl__domain_build(libxl__gc *gc,
+                        libxl_domain_build_info *info,
+                        libxl_device_model_info *dm_info,
+                        uint32_t domid,
+                        libxl__domain_build_state *state)
 {
     char **vments = NULL, **localents = NULL;
     struct timeval start_time;
@@ -158,7 +161,7 @@ int libxl__domain_build(libxl__gc *gc, l
     gettimeofday(&start_time, NULL);
 
     if (info->hvm) {
-        ret = libxl__build_hvm(gc, domid, info, state);
+        ret = libxl__build_hvm(gc, domid, info, dm_info, state);
         if (ret)
             goto out;
 
@@ -437,7 +440,7 @@ static int do_domain_create(libxl__gc *g
             free(dm_info->saved_state);
             dm_info->saved_state = NULL;
         }
-        ret = libxl__domain_build(gc, &d_config->b_info, domid, &state);
+        ret = libxl__domain_build(gc, &d_config->b_info, dm_info, domid, &state);
     }
 
     if (ret) {
tools/libxl/libxl_dm.c +1 -1
diff -r 66579385ed4e -r 5e7615dbe300 tools/libxl/libxl_dm.c
@@ -611,7 +611,7 @@ static int libxl__create_stubdom(libxl__
     ret = libxl__domain_make(gc, &c_info, &domid);
     if (ret)
         goto out_free;
-    ret = libxl__domain_build(gc, &b_info, domid, &state);
+    ret = libxl__domain_build(gc, &b_info, info, domid, &state);
     if (ret)
         goto out_free;
 
tools/libxl/libxl_dom.c +6 -3
diff -r 66579385ed4e -r 5e7615dbe300 tools/libxl/libxl_dom.c
@@ -270,7 +270,8 @@ static int hvm_build_set_params(xc_inter
 }
 
 static const char *libxl__domain_firmware(libxl__gc *gc,
-                                           libxl_domain_build_info *info)
+                                          libxl_domain_build_info *info,
+                                          libxl_device_model_info *dm_info)
 {
     return libxl__abs_path(gc,
                            info->u.hvm.firmware ? : "hvmloader",
@@ -278,7 +279,9 @@ static const char *libxl__domain_firmwar
 }
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
-              libxl_domain_build_info *info, libxl__domain_build_state *state)
+              libxl_domain_build_info *info,
+              libxl_device_model_info *dm_info,
+              libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int ret, rc = ERROR_INVAL;
@@ -289,7 +292,7 @@ int libxl__build_hvm(libxl__gc *gc, uint
         domid,
         (info->max_memkb - info->video_memkb) / 1024,
         (info->target_memkb - info->video_memkb) / 1024,
-        libxl__domain_firmware(gc, info));
+        libxl__domain_firmware(gc, info, dm_info));
     if (ret) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm building failed");
         goto out;
tools/libxl/libxl_internal.h +6 -2
diff -r 66579385ed4e -r 5e7615dbe300 tools/libxl/libxl_internal.h
@@ -186,7 +186,9 @@ _hidden int libxl__build_post(libxl__gc 
 _hidden int libxl__build_pv(libxl__gc *gc, uint32_t domid,
              libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
-              libxl_domain_build_info *info, libxl__domain_build_state *state);
+              libxl_domain_build_info *info,
+              libxl_device_model_info *dm_info,
+              libxl__domain_build_state *state);
 
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
                                  const char *old_name, const char *new_name,
@@ -245,7 +247,9 @@ typedef struct {
 
 /* from xl_create */
 _hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, uint32_t *domid);
-_hidden int libxl__domain_build(libxl__gc *gc, libxl_domain_build_info *info,
+_hidden int libxl__domain_build(libxl__gc *gc,
+                                libxl_domain_build_info *info,
+                                libxl_device_model_info *dm_info,
                                 uint32_t domid,
                                 libxl__domain_build_state *state);
#8 lore raw

PATCH 1/1 tools: libxl: fixup error handling in libxl__build_hvm

In reply to Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1305294079 -3600
# Node ID e2aa33c8019ebd849f87e3d68350e2d26f42b15d # Parent 5e7615dbe3008fd25edabb3fda3cb80a76015ed1
tools: libxl: fixup error handling in libxl__build_hvm.

We first pointless initialise rc and immediately overwrite the value, then fail to return it on error anyway...

tools/libxl/libxl_dom.c +6 -4
diff -r 5e7615dbe300 -r e2aa33c8019e tools/libxl/libxl_dom.c
@@ -284,15 +284,17 @@ int libxl__build_hvm(libxl__gc *gc, uint
               libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    int ret, rc = ERROR_INVAL;
+    int ret, rc = ERROR_FAIL;
+    const char *firmware = libxl__domain_firmware(gc, info, dm_info);
 
-    rc = ERROR_FAIL;
+    if (!firmware)
+        goto out;
     ret = xc_hvm_build_target_mem(
         ctx->xch,
         domid,
         (info->max_memkb - info->video_memkb) / 1024,
         (info->target_memkb - info->video_memkb) / 1024,
-        libxl__domain_firmware(gc, info, dm_info));
+        firmware);
     if (ret) {
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm building failed");
         goto out;
@@ -305,7 +307,7 @@ int libxl__build_hvm(libxl__gc *gc, uint
     }
     rc = 0;
 out:
-    return 0;
+    return rc;
 }
 
 int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,
#9 lore raw

PATCH 1/1 tools: libxl: refactor libxl__domain_firmware to choose based on device_model_version

In reply to Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID ee045454129076b77fbc51e09cbb3b50e2160e89
# Parent e2aa33c8019ebd849f87e3d68350e2d26f42b15d
tools: libxl: refactor libxl__domain_firmware to choose based on device_model_version

Note that the default remains "hvmloader" in both cases, this just clarifies the intent for now.

tools/libxl/libxl_dom.c +22 -3
diff -r e2aa33c8019e -r ee0454541290 tools/libxl/libxl_dom.c
@@ -273,9 +273,28 @@ static const char *libxl__domain_firmwar
                                           libxl_domain_build_info *info,
                                           libxl_device_model_info *dm_info)
 {
-    return libxl__abs_path(gc,
-                           info->u.hvm.firmware ? : "hvmloader",
-                           libxl_xenfirmwaredir_path());
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    const char *firmware;
+
+    if (info->u.hvm.firmware)
+        firmware = info->u.hvm.firmware;
+    else {
+        switch (dm_info->device_model_version)
+        {
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+            firmware = "hvmloader";
+            break;
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+            firmware = "hvmloader";
+            break;
+        default:
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "invalid device model version %d",
+                       dm_info->device_model_version);
+            return NULL;
+            break;
+        }
+    }
+    return libxl__abs_path(gc, firmware, libxl_xenfirmwaredir_path());
 }
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
#10 lore raw

RFC PATCH 1/1 tools: libxl: load SeaBIOS directly rather than via hvmloader

In reply to Ian Campbell

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1305294079 -3600
# Node ID cb87c80d59924d0ce80635c827327f834a035ded
# Parent ee045454129076b77fbc51e09cbb3b50e2160e89
[RFC] tools: libxl: load SeaBIOS directly rather than via hvmloader

tools/libxl/libxl_dom.c +1 -1
diff -r ee0454541290 -r cb87c80d5992 tools/libxl/libxl_dom.c
@@ -285,7 +285,7 @@ static const char *libxl__domain_firmwar
             firmware = "hvmloader";
             break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-            firmware = "hvmloader";
+            firmware = "seabios.elf";
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "invalid device model version %d",
Acked-by on v1 1/1
#11 lore raw
In reply to Ian Campbell

Ian Campbell writes ("[Xen-devel] [PATCH 0 of 8] tools: libx[cl]: support alternative HVM firmware"):

Quoted 3 lines

The following series makes it possible to use any ELF file as the initial HVM domain firmware and begins to setup libxl to cope with this.

Thanks, for patches 1-7 (revised version, for no.1):

How close are we to making the switch to seabios for new qemu ?

Ian.

#12 lore raw
Quoted 11 lines · Ian Jackson

Ian Campbell writes ("[Xen-devel] [PATCH 0 of 8] tools: libx[cl]: support alternative HVM firmware"):

Quoted 3 lines

The following series makes it possible to use any ELF file as the initial HVM domain firmware and begins to setup libxl to cope with this.

Thanks, for patches 1-7 (revised version, for no.1):

How close are we to making the switch to seabios for new qemu ?

I think strictly speaking we already have -- libxl in current xen-unstable.hg will tell hvmloader to use seabios already and hvmloader will barf unless you fed it a seabios binary at build time. The
http://wiki.xen.org/xenwiki/QEMUUpstream wiki page covers acquiring all the necessary bits.

I suspect your question was more "when will it be properly integrated with patches accepted into both projects".

Initially I started working on an approach where SeaBIOS was loaded directly as the hvm firmware and did all the machine setup (PCI enumeration, ACPI table generation, chipset init etc etc). I had this approach working but was not happy with the amount of intrusion into SeaBIOS code.

I've now reset and am trying the hvmloader->SeaBIOS approach. This is progressing well and the set of patches required on the SeaBIOS side is far smaller (without an equivalent growth on the hvmloader side since most of this stuff is already there for rombios). I've now changed my mind and think this is likely the best approach.

I hope to get an initial set of patches to both projects for this second approach sent out soon (either this week or early next).

Ian.