From patchwork Fri May 23 16:07:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 30833 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE74420369 for ; Fri, 23 May 2014 16:09:53 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lj1sf18901153pab.1 for ; Fri, 23 May 2014 09:09:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:message-id:user-agent :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type; bh=xGnGNKMdRtpx50Q4cNsVt7Ix4YnZsb3UNyZsnRZn62s=; b=PnUsLvZ4Cbm5D7Yq60exnRLgve/powcxCl4gA770iDwcyNvasPAAoGIyZHKjoRZREy ybcyXqHeWUqFDMO0bT8vxUxV6Xx2KtWXA+C0da4xk7JiFAO4h+ViHXvI7h03aY9Q9UcT llG0Iz8Z39vY7UWB9X9OxIpZCKbzkv7L1yt1qwAdofa8/fMsyipL5Jv1JXaukDHv3yfH p69el7S5qpKr3lXLFYlYgyuMx3LPv0/Ulos2Arcp+lxTqrJQd5i6eJGaOZVDUF3ggXf+ dws6c6VDf6iVFTWm9b++PFVcZDtDC4WmWVmn62MzO4HqXrBGqR5JGhW7AzTj0zW6l0a8 YJVg== X-Gm-Message-State: ALoCoQn3z5dGrw5WMyWQq9mG4TSE7TgoPWuCShueJovHvjOffUQWdx1aXnimePJhspWSR/ma4ns5 X-Received: by 10.66.137.105 with SMTP id qh9mr2691309pab.30.1400861392716; Fri, 23 May 2014 09:09:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.37 with SMTP id g34ls1802757qgd.64.gmail; Fri, 23 May 2014 09:09:52 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr5202377vcb.0.1400861392580; Fri, 23 May 2014 09:09:52 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id vn1si1911589veb.34.2014.05.23.09.09.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 09:09:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id la4so6608284vcb.27 for ; Fri, 23 May 2014 09:09:52 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr5202370vcb.0.1400861392502; Fri, 23 May 2014 09:09:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp44017vcb; Fri, 23 May 2014 09:09:52 -0700 (PDT) X-Received: by 10.224.55.83 with SMTP id t19mr8564220qag.42.1400861391891; Fri, 23 May 2014 09:09:51 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id 9si4137082qan.42.2014.05.23.09.09.51 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 23 May 2014 09:09:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Received: from localhost ([::1]:44659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wns2Z-00006X-GP for patch@linaro.org; Fri, 23 May 2014 12:09:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wns1W-0007YM-K9 for qemu-devel@nongnu.org; Fri, 23 May 2014 12:08:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wns1Q-0007XH-JP for qemu-devel@nongnu.org; Fri, 23 May 2014 12:08:46 -0400 Received: from smtp.citrix.com ([66.165.176.89]:5973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wns1Q-0007X6-CK for qemu-devel@nongnu.org; Fri, 23 May 2014 12:08:40 -0400 X-IronPort-AV: E=Sophos;i="4.98,894,1392163200"; d="scan'208";a="135045599" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 23 May 2014 16:08:36 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Fri, 23 May 2014 12:08:35 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Wns1L-0005cj-JJ; Fri, 23 May 2014 17:08:35 +0100 Date: Fri, 23 May 2014 17:07:58 +0100 From: Stefano Stabellini X-X-Sender: sstabellini@kaball.uk.xensource.com To: Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Ian Campbell , Stefano Stabellini , Ian Jackson , qemu-devel@nongnu.org, Paul Durrant , Anthony.Perard@citrix.com, tiejun.chen@intel.com Subject: [Qemu-devel] [PATCH] libxl: change default QEMU machine to pc-i440fx-1.6 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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. Choose slot 2 for the xen-platform device for compatibility with current installations. In case of Intel graphic passthrough, slot 2 might be needed by the grafic card. However now that we can specify the slot explicitly, it is easy to change the position of the xen-platform device on the PCI bus if graphic passthrough is enabled. Move the machine options earlier, before any other emulated devices options. Otherwise the selected PCI slot for the xen-platform device is not available in QEMU. 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. Refer to this thread: http://marc.info/?l=xen-devel&m=140023775929625&w=2 Signed-off-by: Stefano Stabellini diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 8abed7b..fef684f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -476,6 +476,29 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, flexarray_vappend(dm_args, "-k", keymap, NULL); } + 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: + flexarray_append(dm_args, "pc-i440fx-1.6,accel=xen"); + flexarray_append(dm_args, "-global"); + flexarray_append(dm_args, "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,addr=0x2"); + } + 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(); + } + + if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) { int ioemu_nics = 0; @@ -645,29 +668,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));