From patchwork Wed Feb 5 16:50:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11366627 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 E364613A4 for ; Wed, 5 Feb 2020 16:52:05 +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 C0BBC20674 for ; Wed, 5 Feb 2020 16:52:05 +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="em/wVdcD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0BBC20674 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 1izNtT-0000Sg-5g; Wed, 05 Feb 2020 16:51:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izNtR-0000S9-D2 for xen-devel@lists.xenproject.org; Wed, 05 Feb 2020 16:51:13 +0000 X-Inumbo-ID: b1dc2e78-4837-11ea-915c-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b1dc2e78-4837-11ea-915c-12813bfff9fa; Wed, 05 Feb 2020 16:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1580921464; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=4Oa6M4WM6CGr9S2ZAmXGocXyWxGoZB+1v9DkZxuf6vk=; b=em/wVdcDJlKk7OTQfnsPVE5AwFYR+eerDePxIdSG8JM8EljE7eGNw9qO jFgo3aF/woy2tQeAAV2LhBFGc8SRMUzCfsTXDElob8cplG9lJQ7oHzc+z tt4+LGd7Wid7bZAIMabE1UhVg461/wPWAqnK7H790ODPOCP6AHtGdSpfn 0=; Authentication-Results: esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: kgo0xgdk/kqQRdU5w13717eY8Du0SX/rid1Uwwtq3KGFfMNrRtJv6nNZOkzq3j+zU5D2eK3dzj f19Z88yFny6+x3vI1mAflFPBz9NNXVjyDzv74PoB7ot30DyoHGfBvvu7vIqhBIssTOSSBZM1Lx sF1F/fiidjWa5D+wKJYSrDdOgk7NqWcUH7mdINg1ZucU9RsRi3v9t0enmr/vnYlPhEaVjz8b+O pU9aLdQbdMRcZMleLAsXaTNaxhIePOOrzeKh8Swq2Py0J6nBdMn5vSYUavLeN9oppjZPCtwXIx Q+A= X-SBRS: 2.7 X-MesageID: 12001776 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,406,1574139600"; d="scan'208";a="12001776" From: Andrew Cooper To: Xen-devel Date: Wed, 5 Feb 2020 16:50:55 +0000 Message-ID: <20200205165056.11734-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200205165056.11734-1-andrew.cooper3@citrix.com> References: <20200205165056.11734-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 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" The sole use of HVM_PARAM_PAE_ENABLED is as a non-standard calling convention for xc_cpuid_apply_policy(). Pass PAE as a regular parameter instead. Leave a rather better explaination of why only HVM guests have a choice in PAE setting. No functional change. Signed-off-by: Andrew Cooper --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_cpuid_x86.c | 15 +++++---------- tools/libxl/libxl_cpuid.c | 14 +++++++++++++- 3 files changed, 19 insertions(+), 12 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..4e74a7ed3b 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. @@ -635,14 +634,10 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, } /* - * HVM_PARAM_PAE_ENABLED is a parameter to this function, stashed in - * Xen. Nothing else has ever taken notice of the value. + * PAE used to be a parameter passed to this function by + * HVM_PARAM_PAE_ENABLED. It is now passed normally. */ - 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..8c49e34125 100644 --- a/tools/libxl/libxl_cpuid.c +++ b/tools/libxl/libxl_cpuid.c @@ -416,8 +416,20 @@ 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; + + /* + * PAE is a Xen-controlled for PV guests (it is the 'p' that causes the + * difference between the xen-3.0-x86_32 and xen-3.0-x86_32p ABIs). It is + * mandatory as Xen is running in 64bit mode. + * + * PVH guests don't have a top-level PAE control, and is treated as + * 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;