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

Re: [Xen-devel] [PATCH 2/2] libxl: Handle xen_platform_pci=0 case with qemu-xen.



Il 29/11/2013 13:31, Stefano Stabellini ha scritto:
On Fri, 22 Nov 2013, Anthony PERARD wrote:
This should result in QEMU *not* adding the xen-platform device.

Since QEMU 1.6, this can be achieved by using a different qemu machine.
The one used by libxl is "xenfv", but using QEMU >=1.6 with "-machine
pc,accel=xen" works as well with only one difference compared to
"xenfv", there is no xen-platform device.

One more things, if "qemu_machine_override" is set by the user, then we
check if it's necessary to add the xen-platform device.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
  tools/libxl/libxl_dm.c | 28 ++++++++++++++++++++++++++--
  1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 3d4a913..33caa2b 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -390,6 +390,7 @@ static char ** libxl__build_device_model_args_new(libxl__gc 
*gc,
      const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
      const libxl_sdl_info *sdl = dm_sdl(guest_config);
      const char *keymap = dm_keymap(guest_config);
+    const char *machine = b_info->qemu_machine;
      flexarray_t *dm_args;
      int i;
      uint64_t ram_size;
@@ -608,6 +609,29 @@ 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]);
+
+    if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        if (libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
+            if (b_info->qemu_machine) {
+                /* Check the qemu machine asked for, it can be "xenfv" which
+                 * will add xen-platform, or it can be "pc" or "pc-*" which
+                 * in this case will need to add the device here. Anything
+                 * else is either a mistake or a machine not supported by
+                 * xen. */
in that case it would be appropriate to print a warning or an error

This version is old.
There is a v2 of that patch already on git:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=2bc047635b51abd41c917aa2b813211ee0de2c38
And also doc patch:
http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=80507420f96b06d68a5b23c18998486330b49657



+                if (!strncmp("pc", b_info->qemu_machine, 2)) {
+                    flexarray_vappend(dm_args, "-device", "xen-platform");
+                }
+            }
+        } else {
+            /* Switching here to the machine "pc" which does not add
+             * the xen-platform device instead of the default "xenfv" machine.
+             */
+            if (!b_info->qemu_machine) {
+                machine = "pc";
+            }
+        }
+    }
+
      flexarray_append(dm_args, "-machine");
      switch (b_info->type) {
      case LIBXL_DOMAIN_TYPE_PV:
@@ -616,8 +640,8 @@ static char ** libxl__build_device_model_args_new(libxl__gc 
*gc,
              flexarray_append(dm_args, b_info->extra_pv[i]);
          break;
      case LIBXL_DOMAIN_TYPE_HVM:
-        if (b_info->qemu_machine)
-            flexarray_append(dm_args, GCSPRINTF("%s,accel=xen", 
b_info->qemu_machine));
+        if (machine)
+            flexarray_append(dm_args, GCSPRINTF("%s,accel=xen", machine));
          else
              flexarray_append(dm_args, "xenfv");
          for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
--
Anthony PERARD

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


_______________________________________________
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®.