libxl, xl: Add the bios option to specify the bios to load
authorAttilio Rao <attilio.rao@citrix.com>
Wed, 29 Feb 2012 16:25:38 +0000 (16:25 +0000)
committerAttilio Rao <attilio.rao@citrix.com>
Wed, 29 Feb 2012 16:25:38 +0000 (16:25 +0000)
Signed-off-by: Attilio Rao <attilio.rao@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
docs/man/xl.cfg.pod.5
tools/libxl/libxl_create.c
tools/libxl/libxl_dm.c
tools/libxl/libxl_types.idl
tools/libxl/xl_cmdimpl.c

index 197503f08813667adc94ad6f17dccd19d9ffaa58..55f7e75a16da41b73dcb6221e164dba6176d51c8 100644 (file)
@@ -430,6 +430,33 @@ accept the defaults for these options wherever possible.
 
 =over 4
 
+=item B<bios="STRING">
+
+Select the virtual firmware that is exposed to the guest.
+By default, a guess is made based on the device model, but sometimes
+it may be useful to request a different one, like UEFI.
+
+=over 4
+
+=item B<rombios>
+
+Loads ROMBIOS, a 16-bit x86 compatible BIOS. This is used by default
+when device_model_version=qemu-xen-traditional. This is the only BIOS
+option supported when device_model_version=qemu-xen-traditional. This is
+the BIOS used by all previous Xen versions.
+
+=item B<seabios>
+
+Loads SeaBIOS, a 16-bit x86 compatible BIOS. This is used by default
+with device_model_version=qemu-xen.
+
+=item B<ovmf>
+
+Loads OVMF, a standard UEFI firmware by Tianocore project.
+Requires device_model_version=qemu-xen.
+
+=back
+
 =item B<pae=BOOLEAN>
 
 Hide or expose the IA32 Physical Address Extensions. These extensions
index deccf8827bdeb410a59c20ab7d26034ad2eea01d..85a4a9ed70be36f222bab4c557f4d5da12623a81 100644 (file)
@@ -89,6 +89,7 @@ int libxl_init_build_info(libxl_ctx *ctx,
     case LIBXL_DOMAIN_TYPE_HVM:
         b_info->video_memkb = 8 * 1024;
         b_info->u.hvm.firmware = NULL;
+        b_info->u.hvm.bios = 0;
         b_info->u.hvm.pae = 1;
         b_info->u.hvm.apic = 1;
         b_info->u.hvm.acpi = 1;
index 922b20b50a573ef9927a47bd688a21ced606e1bc..d007bab24bfc01cf2aac2377e1b8801ec0b75347 100644 (file)
@@ -66,6 +66,8 @@ const char *libxl__domain_device_model(libxl__gc *gc,
 static const char *libxl__domain_bios(libxl__gc *gc,
                                 const libxl_domain_build_info *info)
 {
+    if (info->u.hvm.bios)
+       return libxl_bios_type_to_string(info->u.hvm.bios);
     switch (info->device_model_version) {
     case 1: return "rombios";
     case 2: return "seabios";
index 4f894cd39fb38e4616928f5b820efcb844ac8999..d6554b307465b720656b6d04378696693861598c 100644 (file)
@@ -99,6 +99,12 @@ libxl_timer_mode = Enumeration("timer_mode", [
     (3, "one_missed_tick_pending"),
     ])
 
+libxl_bios_type = Enumeration("bios_type", [
+    (1, "rombios"),
+    (2, "seabios"),
+    (3, "ovmf"),
+    ])
+
 #
 # Complex libxl types
 #
@@ -228,6 +234,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
 
     ("u", KeyedUnion(None, libxl_domain_type, "type",
                 [("hvm", Struct(None, [("firmware", string),
+                                       ("bios", libxl_bios_type),
                                        ("pae", bool),
                                        ("apic", bool),
                                        ("acpi", bool),
index c7475f6101df9887b64ef34b9192d4102b465a96..d60e22b33770b3be26dd915e3543c62967693318 100644 (file)
@@ -703,6 +703,12 @@ static void parse_config_data(const char *configfile_filename_report,
 
         xlu_cfg_replace_string (config, "firmware_override",
                                 &b_info->u.hvm.firmware, 0);
+        if (!xlu_cfg_get_string(config, "bios", &buf, 0) &&
+            libxl_bios_type_from_string(buf, &b_info->u.hvm.bios)) {
+                fprintf(stderr, "ERROR: invalid value \"%s\" for \"bios\"\n",
+                    buf);
+                exit (1);
+        }
         if (!xlu_cfg_get_long (config, "pae", &l, 0))
             b_info->u.hvm.pae = l;
         if (!xlu_cfg_get_long (config, "apic", &l, 0))