xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Xen Devel <xen-devel@lists.xen.org>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [PATCH 2/2] libxl: Handle xen_platform_pci=0 case with qemu-xen.
Date: Fri, 22 Nov 2013 15:13:11 +0000	[thread overview]
Message-ID: <1385133191-23033-3-git-send-email-anthony.perard@citrix.com> (raw)
In-Reply-To: <1385133191-23033-1-git-send-email-anthony.perard@citrix.com>

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@citrix.com>
---
 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. */
+                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

  parent reply	other threads:[~2013-11-22 15:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 15:13 [PATCH 0/2] Handle xen_platform_pci=0 case Anthony PERARD
2013-11-22 15:13 ` [PATCH 1/2] libxl: adding support to use -machine option of QEMU Anthony PERARD
2013-11-29 12:29   ` Stefano Stabellini
2013-11-22 15:13 ` Anthony PERARD [this message]
2013-11-29 12:31   ` [PATCH 2/2] libxl: Handle xen_platform_pci=0 case with qemu-xen Stefano Stabellini
2013-11-29 12:49     ` Fabio Fantoni
     [not found] ` <20131122151838.GA10855@perard.uk.xensource.com>
2013-11-22 15:30   ` Processed: Re: [PATCH 0/2] Handle xen_platform_pci=0 case xen
2013-11-22 15:49 ` Fabio Fantoni
2013-11-22 16:54   ` Anthony PERARD
2013-11-25  9:04     ` Fabio Fantoni
2013-11-25 11:11       ` Anthony PERARD
2013-11-29 16:06         ` Fabio Fantoni
2013-11-29 16:20           ` Sander Eikelenboom
2013-11-26 19:08     ` Konrad Rzeszutek Wilk
2013-11-26 20:09       ` Konrad Rzeszutek Wilk
2013-11-28 16:14         ` Anthony PERARD
2013-11-22 15:56 ` Ian Campbell
2013-11-22 17:18   ` Anthony PERARD
2013-11-22 17:23     ` Ian Campbell
2013-11-22 17:31       ` Ian Campbell
2013-11-22 17:40         ` Anthony PERARD
2013-11-22 17:24     ` George Dunlap
2013-11-22 17:06 ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385133191-23033-3-git-send-email-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).