Add vendor_device parameter for HVM guests
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 2 Aug 2013 16:45:31 +0000 (17:45 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 5 Aug 2013 09:25:21 +0000 (10:25 +0100)
The parameter determines which, if any, xen-pvdevice is specified on the
QEMU command line. The default value is 'none' which means no argument will
be passed. A value of 'xenserver' specifies a xen-pvdevice with device-id
0xc000 (the initial value in the xenserver namespace - see
docs/misc/pci-device-reservations.txt).

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- s/BUILD_INFO/BUILDINFO for consistency in LIBXL_HAVE define ]

docs/man/xl.cfg.pod.5
tools/libxl/libxl.h
tools/libxl/libxl_dm.c
tools/libxl/libxl_types.idl
tools/libxl/xl_cmdimpl.c

index 069b73ff60a39c37a6702ee53e1aef689b8d2bc7..08d6cc45db680ae29ccb78acbb3bad382e7709f0 100644 (file)
@@ -1176,6 +1176,29 @@ documentation.
 
 =back
 
+=item B<vendor_device="VENDOR_DEVICE">
+
+Selects which variant of the QEMU xen-pvdevice should be used for this
+guest. Valid values are:
+
+=over 4
+
+=item B<none>
+
+The xen-pvdevice should be omitted. This is the default.
+
+=item B<xenserver>
+
+The xenserver variant of the xen-pvdevice (device-id=C000) will be
+specified, enabling the use of XenServer PV drivers in the guest.
+
+=back
+
+This parameter only takes effect when device_model_version=qemu-xen.
+See F<docs/misc/pci-device-reservations.txt> for more information.
+
+=back
+
 =head2 Device-Model Options
 
 The following options control the selection of the device-model.  This
index 37e4d82d3bf3679d6a2566772bb09431c84b9b86..be19bf51861ed883ef090ead19ee6858e1fae894 100644 (file)
  */
 #define LIBXL_HAVE_DOMAIN_NODEAFFINITY 1
 
+/*
+ * LIBXL_HAVE_BUILDINFO_HVM_VENDOR_DEVICE indicates that the
+ * libxl_vendor_device field is present in the hvm sections of
+ * libxl_domain_build_info. This field tells libxl which
+ * flavour of xen-pvdevice to enable in QEMU.
+ */
+#define LIBXL_HAVE_BUILDINFO_HVM_VENDOR_DEVICE 1
+
 /*
  * libxl ABI compatibility
  *
index 7e54c02a216e57125bfe0bd1decf6ec5466adb79..615dcf39457e22aab91ab76b5b0c91a8e6cac4a8 100644 (file)
@@ -647,6 +647,15 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
             flexarray_append(dm_args, "-drive");
             flexarray_append(dm_args, drive);
         }
+
+        switch (b_info->u.hvm.vendor_device) {
+        case LIBXL_VENDOR_DEVICE_XENSERVER:
+            flexarray_append(dm_args, "-device");
+            flexarray_append(dm_args, "xen-pvdevice,device-id=0xc000");
+            break;
+        default:
+            break;
+        }
     }
     flexarray_append(dm_args, NULL);
     return (char **) flexarray_contents(dm_args);
index d218a2d3d116bb62758a03dcdadb934fd1f5efb7..85341a033172005dfa02feb919fe526422e2f634 100644 (file)
@@ -132,6 +132,10 @@ libxl_vga_interface_type = Enumeration("vga_interface_type", [
     (2, "STD"),
     ], init_val = 0)
 
+libxl_vendor_device = Enumeration("vendor_device", [
+    (0, "NONE"),
+    (1, "XENSERVER"),
+    ])
 #
 # Complex libxl types
 #
@@ -332,6 +336,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("soundhw",          string),
                                        ("xen_platform_pci", libxl_defbool),
                                        ("usbdevice_list",   libxl_string_list),
+                                       ("vendor_device",    libxl_vendor_device),
                                        ])),
                  ("pv", Struct(None, [("kernel", string),
                                       ("slack_memkb", MemKB),
index 5bef969e924d82f281797db5e0b304c7a5eacdc4..884f050644244b455c0dd30b1c43d8c89cbe6e09 100644 (file)
@@ -1532,6 +1532,20 @@ skip_vfb:
             exit (1);
 
         }
+
+        if (!xlu_cfg_get_string (config, "vendor_device", &buf, 0)) {
+            libxl_vendor_device d;
+
+            e = libxl_vendor_device_from_string(buf, &d);
+            if (e) {
+                fprintf(stderr,
+                        "xl: unknown vendor_device '%s'\n",
+                        buf);
+                exit(-ERROR_FAIL);
+            }
+
+            b_info->u.hvm.vendor_device = d;
+        }
     }
 
     xlu_cfg_destroy(config);