From patchwork Mon Feb 17 17:57:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11387059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 913E5924 for ; Mon, 17 Feb 2020 17:58:41 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CC9D207FD for ; Mon, 17 Feb 2020 17:58:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="epyNYx1I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CC9D207FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j3keL-0003yU-RK; Mon, 17 Feb 2020 17:57:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j3keL-0003yP-0F for xen-devel@lists.xenproject.org; Mon, 17 Feb 2020 17:57:41 +0000 X-Inumbo-ID: fcd6a1d0-51ae-11ea-ade5-bc764e2007e4 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fcd6a1d0-51ae-11ea-ade5-bc764e2007e4; Mon, 17 Feb 2020 17:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1581962259; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=t8sfm2pJ5lM10hWBEcxmdSBqi3gzpblNehKlhFBxXKE=; b=epyNYx1IhdwJDyqqrvTyvMlWQn0RD4Ny/zQP2gWhQDhUNy2n1kh3Pmmw TcORvM76y9EmsetwNRrohBBt1/Bts+16xwQZHt6L15sv/607DIw1jNNNF s6P5R+vSJv0WUN1W7Mdhv11ES+cUwLk5zq7cZHlDUf9uGvmoJQ3OE+NQc s=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: OG/XVz7sgwia+EOPywWoKEJdsBji5bwwM6eXPowVc2ePJwqsp/fA8lZzpxKMOXZH2pXTHKy8XP wB7c+0T/U9pFGisyBnGGTdmma5G/iboTNo5lWiplhfP+EPSzY7abkAwqa6H0RuoRTRpIVulwxu O1bggmHns+IHrNkizn2hHnb9yQoCOG6GHWxrksJZrs813yfCv1NPrbVQ9nEBnR1HnrDqR+o+l9 IFjqjM0faY/0DDItU/yQ/Qjb2iE7FeGnMdhad9bO9k5XoCkUmtlzPTL+KIiDXP4hbkIDAYwlpn y/U= X-SBRS: 2.7 X-MesageID: 13010820 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,453,1574139600"; d="scan'208";a="13010820" From: Andrew Cooper To: Xen-devel Date: Mon, 17 Feb 2020 17:57:31 +0000 Message-ID: <20200217175731.14828-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-6-andrew.cooper3@citrix.com> References: <20200205165056.11734-6-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 5/6] tools/libx[cl]: Don't use HVM_PARAM_PAE_ENABLED as a function parameter X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Andrew Cooper , Wei Liu , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" HVM_PARAM_PAE_ENABLED is set and consumed by the toolstack only. It is in practice a complicated and non-standard way of passing a boolean parameter into xc_cpuid_apply_policy(). This is silly. Pass PAE as a regular parameter instead. In libxl__cpuid_legacy(), leave a rather better explaination of why only HVM guests have a choice in PAE setting. No change in how a guest is constructed. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD v2: * Rewrite commit message and comments. --- tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_cpuid_x86.c | 15 +++------------ tools/libxl/libxl_cpuid.c | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 311df1ef0f..4eb4f4c2c6 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1807,7 +1807,7 @@ int xc_cpuid_set(xc_interface *xch, int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, const uint32_t *featureset, - unsigned int nr_features); + unsigned int nr_features, bool pae); int xc_mca_op(xc_interface *xch, struct xen_mc *mc); int xc_mca_op_inject_v2(xc_interface *xch, unsigned int flags, xc_cpumap_t cpumap, unsigned int nr_cpus); diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 2540aa1e1c..21b15b86ec 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -455,7 +455,8 @@ int xc_cpuid_set( } int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, - const uint32_t *featureset, unsigned int nr_features) + const uint32_t *featureset, unsigned int nr_features, + bool pae) { int rc; xc_dominfo_t di; @@ -579,8 +580,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, } else { - uint64_t val; - /* * Topology for HVM guests is entirely controlled by Xen. For now, we * hardcode APIC_ID = vcpu_id * 2 to give the illusion of no SMT. @@ -634,15 +633,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, break; } - /* - * HVM_PARAM_PAE_ENABLED is a parameter to this function, stashed in - * Xen. Nothing else has ever taken notice of the value. - */ - rc = xc_hvm_param_get(xch, domid, HVM_PARAM_PAE_ENABLED, &val); - if ( rc ) - goto out; - - p->basic.pae = val; + p->basic.pae = pae; /* * These settings are necessary to cause earlier HVM_PARAM_NESTEDHVM / diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c index 49d3ca5b26..062750102e 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -416,8 +416,22 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, libxl_cpuid_policy_list cpuid = info->cpuid; int i; char *cpuid_res[4]; + bool pae = true; + + /* + * For PV guests, PAE is Xen-controlled (it is the 'p' that differentiates + * the xen-3.0-x86_32 and xen-3.0-x86_32p ABIs). It is mandatory as Xen + * is 64bit only these days. + * + * For PVH guests, there is no top-level PAE control in the domain config, + * so is treated as always available. + * + * HVM guests get a top-level choice of whether PAE is available. + */ + if (info->type == LIBXL_DOMAIN_TYPE_HVM) + pae = libxl_defbool_val(info->u.hvm.pae); - xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0); + xc_cpuid_apply_policy(ctx->xch, domid, NULL, 0, pae); if (!cpuid) return;