[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2] libxl: change default QEMU machine to pc-i440fx-1.6



Choose pc-i440fx-1.6 instead of pc for HVM guests, so that we know for
sure what is the machine that we are emulating.

Use pc-i440fx-1.6 regardless of the xen_platform_pci option. Add the
xen-platform device if requested.  Move the machine options earlier,
before any emulated devices options so that QEMU will assign slot 2 to
the xen-platform device, maintaining compatibility with current
installations.

In case of Intel graphic passthrough, slot 2 might be needed by the
grafics card. However it is easy to change the position of the
xen-platform device on the PCI bus if graphic passthrough is enabled, by
passing "addr=desired_slot_number".

Specify PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off, because
differently from xenfv, the other QEMU machines do not have that option
off by default.

This patch does not change the emulated environment in the guest, unless
soundhw='hda' is specified, in that case the xen-platform device is
moved to slot 3 (used to be always slot 2). This change might cause
problems to guests with soundhw='hda', migrating from 4.4 to 4.5.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>


---

Changes in v2:
- note the dependency on QEMU >= 1.6.1 in the README;
- move the -machine options even earlier and drop the explicit
  ",slot=0x2".


diff --git a/README b/README
index 9bbe734..cb66893 100644
--- a/README
+++ b/README
@@ -73,6 +73,10 @@ disabled at compile time:
     * markdown
     * figlet (for generating the traditional Xen start of day banner)
 
+As a runtime requirement, you need a QEMU binary newer than v1.6.1,
+compiled with Xen support. By default the Xen build system will clone
+and build one for you.
+
 Second, you need to acquire a suitable kernel for use in domain 0. If
 possible you should use a kernel provided by your OS distributor. If
 no suitable kernel is available from your OS distributor then refer to
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 51ab2bf..b5a0beb 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -403,6 +403,27 @@ static char ** 
libxl__build_device_model_args_new(libxl__gc *gc,
                       "-xen-domid",
                       libxl__sprintf(gc, "%d", guest_domid), NULL);
 
+    switch (b_info->type) {
+    case LIBXL_DOMAIN_TYPE_PV:
+        flexarray_append_pair(dm_args, "-machine", "xenpv");
+        for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_pv[i]);
+        break;
+    case LIBXL_DOMAIN_TYPE_HVM:
+        flexarray_append_pair(dm_args, "-machine", "pc-i440fx-1.6,accel=xen");
+        flexarray_append_pair(dm_args, "-global",
+                "PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off");
+        if (libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
+            flexarray_append(dm_args, "-device");
+            flexarray_append(dm_args, "xen-platform");
+        }
+        for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
+            flexarray_append(dm_args, b_info->extra_hvm[i]);
+        break;
+    default:
+        abort();
+    }
+
     flexarray_append(dm_args, "-chardev");
     flexarray_append(dm_args,
                      libxl__sprintf(gc, "socket,id=libxl-cmd,"
@@ -646,29 +667,6 @@ static char ** 
libxl__build_device_model_args_new(libxl__gc *gc,
     for (i = 0; b_info->extra && b_info->extra[i] != NULL; i++)
         flexarray_append(dm_args, b_info->extra[i]);
 
-    flexarray_append(dm_args, "-machine");
-    switch (b_info->type) {
-    case LIBXL_DOMAIN_TYPE_PV:
-        flexarray_append(dm_args, "xenpv");
-        for (i = 0; b_info->extra_pv && b_info->extra_pv[i] != NULL; i++)
-            flexarray_append(dm_args, b_info->extra_pv[i]);
-        break;
-    case LIBXL_DOMAIN_TYPE_HVM:
-        if (!libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
-            /* Switching here to the machine "pc" which does not add
-             * the xen-platform device instead of the default "xenfv" machine.
-             */
-            flexarray_append(dm_args, "pc,accel=xen");
-        } else {
-            flexarray_append(dm_args, "xenfv");
-        }
-        for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
-            flexarray_append(dm_args, b_info->extra_hvm[i]);
-        break;
-    default:
-        abort();
-    }
-
     ram_size = libxl__sizekb_to_mb(b_info->max_memkb - b_info->video_memkb);
     flexarray_append(dm_args, "-m");
     flexarray_append(dm_args, libxl__sprintf(gc, "%"PRId64, ram_size));

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.