WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 18 of 19] tools: hvmloader: select BIOS through xenst

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 18 of 19] tools: hvmloader: select BIOS through xenstore
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 12 Apr 2011 12:29:17 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 12 Apr 2011 04:58:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1302607739@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1302607739@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302607403 -3600
# Node ID deeb1b89d8fd0dbdd3929ed203ce8dd9c2cf50db
# Parent  20dcc3b31fd416636a69dc7c528ef486adc9dacc
tools: hvmloader: select BIOS through xenstore.

Allow the toolstack to select the BIOS to use via a xenstore key.

Defaults to "rombios" for compatibility with toolstacks which do not
write the key (e.g. xend).

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 20dcc3b31fd4 -r deeb1b89d8fd tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Apr 12 12:20:25 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Tue Apr 12 12:23:23 2011 +0100
@@ -337,10 +337,34 @@ static void cmos_write_memory_size(void)
     cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
 }
 
+struct bios_info {
+    const char *key;
+    const struct bios_config *bios;
+} bios_configs[] = {
+    { "rombios", &rombios_config, },
+    { NULL, NULL }
+};
 
 static const struct bios_config *detect_bios(void)
 {
-    return &rombios_config;
+    const struct bios_info *b = &bios_configs[0];
+    const char *bios = xenstore_read("hvmloader/bios");
+
+    if (!bios)
+        bios = "rombios";
+
+    while(b->key != NULL) {
+        if (!strcmp(bios, b->key))
+            return b->bios;
+        b++;
+    }
+
+    /* oh dear */
+    printf("Unknown BIOS %s, no ROM image found\n", bios);
+    asm volatile (".text     \n"
+                  "1: hlt    \n"
+                  "   jmp 1b \n");
+    return NULL;
 }
 
 int main(void)
diff -r 20dcc3b31fd4 -r deeb1b89d8fd tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Tue Apr 12 12:20:25 2011 +0100
+++ b/tools/libxl/libxl_dm.c    Tue Apr 12 12:23:23 2011 +0100
@@ -66,6 +66,16 @@ const char *libxl__domain_device_model(l
     return dm;
 }
 
+static char *libxl__domain_bios(libxl__gc *gc,
+                                libxl_device_model_info *info)
+{
+    switch (info->device_model_version) {
+    case 1: return libxl__strdup(gc, "rombios");
+    case 2: return libxl__strdup(gc, "rombios");
+    default:return NULL;
+    }
+}
+
 static char ** libxl__build_device_model_args_old(libxl__gc *gc,
                                                   const char *dm,
                                                   libxl_device_model_info 
*info,
@@ -751,6 +761,11 @@ int libxl__create_device_model(libxl__gc
         goto out;
     }
 
+    path = libxl__sprintf(gc, "/local/domain/%d/hvmloader", info->domid);
+    xs_mkdir(ctx->xsh, XBT_NULL, path);
+    libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/bios", path),
+                    libxl__domain_bios(gc, info));
+
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d", info->domid);
     xs_mkdir(ctx->xsh, XBT_NULL, path);
     libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/disable_pf", path), 
"%d", !info->xen_platform_pci);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>