From patchwork Thu Jun 12 14:33:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 31832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 357C42054B for ; Thu, 12 Jun 2014 14:46:15 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf1916792pab.11 for ; Thu, 12 Jun 2014 07:46:15 -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=nRkmOmSDe7I2yeidEjaCOzzZNK/GjBLwjwQfV1X6xug=; b=lx1C05pB5ys64YB7wkIGScfeYAM+Uf0ON/dTo0/ihN6MJR77rsetjGPMKYL6Qsjwx1 36yXt+m7Ak1ukDna+E8d3BbLnMYXiFYsKxNzvbrRFmZlDiNolpKnJWi8/wM5LeMKBnKk 2cSCcAR09hwnQ7GECUxqwIhBBH9e08wGeJkGoHH4y8wm4fqiL5BKnfTlViRGiMIg77rq 71U5tBIBniyo3eu2Iyt8Pxp1y5jOHw/XoweORjqWm7LcenmO4le+TTFOh4f/WE064iw1 lz2jenzpPhMsh+vrRVm8e5MnJzP0Jw1yDwB7T1wGlXh1hlFX42bReqNR1HvzKB+jzHL7 L6QQ== X-Gm-Message-State: ALoCoQmLOGU678pgom4VEJw3+miG5xxhrvNCJTWZwHAK7s11GWw0VFYaGLCzq0u/UdsE70UAICbJ X-Received: by 10.66.183.142 with SMTP id em14mr123850pac.39.1402584375363; Thu, 12 Jun 2014 07:46:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.7 with SMTP id 7ls3183318qgo.60.gmail; Thu, 12 Jun 2014 07:46:15 -0700 (PDT) X-Received: by 10.221.42.135 with SMTP id ty7mr44981944vcb.14.1402584371023; Thu, 12 Jun 2014 07:46:11 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id b8si389675vcf.7.2014.06.12.07.46.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 07:46:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id db11so1919087veb.32 for ; Thu, 12 Jun 2014 07:46:10 -0700 (PDT) X-Received: by 10.52.139.101 with SMTP id qx5mr8491976vdb.17.1402584370939; Thu, 12 Jun 2014 07:46:10 -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.221.54.6 with SMTP id vs6csp409156vcb; Thu, 12 Jun 2014 07:46:10 -0700 (PDT) X-Received: by 10.224.25.133 with SMTP id z5mr33683058qab.97.1402584370212; Thu, 12 Jun 2014 07:46:10 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 110si34455334qgv.9.2014.06.12.07.46.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 12 Jun 2014 07:46:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:54235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv6GX-0000qP-R1 for patch@linaro.org; Thu, 12 Jun 2014 10:46:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv6G2-0000WG-RF for qemu-devel@nongnu.org; Thu, 12 Jun 2014 10:45:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wv6Fx-0002Q0-TT for qemu-devel@nongnu.org; Thu, 12 Jun 2014 10:45:38 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:9696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv6Fx-0002PZ-Id for qemu-devel@nongnu.org; Thu, 12 Jun 2014 10:45:33 -0400 X-IronPort-AV: E=Sophos;i="5.01,465,1400025600"; d="scan'208";a="142719856" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 12 Jun 2014 14:45:26 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Thu, 12 Jun 2014 10:45:25 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Wv64e-0006Yi-HU; Thu, 12 Jun 2014 15:33:52 +0100 Date: Thu, 12 Jun 2014 15:33:33 +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: MIA1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Ian Campbell , Stefano Stabellini , Ian.Jackson@eu.citrix.com, qemu-devel@nongnu.org, Anthony.Perard@citrix.com, tiejun.chen@intel.com Subject: [Qemu-devel] [PATCH v2] 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.128.173 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. 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 --- 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));