From nobody Mon May 6 10:33:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=TqvtFCpy/IYCDQSWKetegJTlugW1FHfKDoHIe8wrF3bNoUL7Oem4nnETAHgpQbYSSR5aYO3iM14Dxqlk0nxUzAqVM9LXApjWp/QotT2vcBR7a8vlNvAZXuWP0metQ6ZLElwQVzQnG6MLnao6htdj7x1IHGmS3NeJkZ8NnpGl0Wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n+BLmibilxqeA8RJWN3VyTC7eSnZNF4FqnUOKg7+I3w=; b=m59SZq3jUr2hwkaUqHWokoq/0VbOoiZyYKZLrpSB3UXeQJFtRez6/g/krWgrd3jxdYtGC7HUZWdOm52zb/0mJsV2jIj0xzq5orREki/eBLOfqiBa58u5tJ0xHXIjOMGnUyVW6ShXwyAgiM1+a4lNfCPvf1zTLwvVDS5xmPvQEmg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748601805464.9125019554748; Wed, 26 Feb 2020 12:23:21 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CU-0003jL-3w; Wed, 26 Feb 2020 20:22:34 +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 1j73CS-0003j3-Vz for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:33 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b42031f8-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:26 +0000 (UTC) X-Inumbo-ID: b42031f8-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748547; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u/+RKLhbDk17CKseuXcfqx9TwE1p61mY4ldohohPJuk=; b=MfXV3cRWTTdkA/ZyJ1eOKMBPGnnaTurjFWC6I8yrL0VDmYZwsvXI7Z+b pQrPIHXfJMk7Pi9YPk1LdE1VyzwZyiOeKrXdxkvFmZ4O2szoc7oorSmqb srmFw68vsckgDxo6DmEWA0/DPs8H8KDQutGVP2MtGs0loAvEZL1oFojY8 E=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 6upkhATuuOwR3xc4+/iry+v3K+MkoJm04izMYWmVr/fyM9xXX69aiyioQSWXlZak1QIYWG3LLw k7b/kO+j+bzcgq5LOxM4yc56XYWWV2uHCsC0uMdUZfzhXV4SQdlMlzSQMLKtUyk5cYNmS+KqBd 2TccL46QR5s8corlm0iUsMZAIQEjIeGe9QKNY8SXqUGkkpbUaA3Eb4NCbObdZLX0jS901EnlxP bIzxpfvFOEdg2asw7VgDweid3hrSQROweVj3DVzlipylAn8a5olCPKtQmiIYWTJ4rQIJg5CWz4 0hM= X-SBRS: 2.7 X-MesageID: 13071942 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,489,1574139600"; d="scan'208";a="13071942" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:12 +0000 Message-ID: <20200226202221.6555-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 01/10] x86/sysctl: Don't return cpu policy data for compiled-out support (2) 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Just as with c/s 96dc77b4b1 for XEN_SYSCTL_get_cpu_policy, XEN_SYSCTL_get_cpu_featureset needs to become conditional. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- tools/misc/xen-cpuid.c | 17 +++++++++++++---- xen/arch/x86/sysctl.c | 17 +++++++++++++---- xen/include/public/sysctl.h | 2 ++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c index f55b67640a..36c17bf777 100644 --- a/tools/misc/xen-cpuid.c +++ b/tools/misc/xen-cpuid.c @@ -251,7 +251,7 @@ static void decode_featureset(const uint32_t *features, } } =20 -static void get_featureset(xc_interface *xch, unsigned int idx) +static int get_featureset(xc_interface *xch, unsigned int idx) { struct fsinfo *f =3D &featuresets[idx]; =20 @@ -261,8 +261,7 @@ static void get_featureset(xc_interface *xch, unsigned = int idx) if ( !f->fs ) err(1, "calloc(, featureset)"); =20 - if ( xc_get_cpu_featureset(xch, idx, &f->len, f->fs) ) - err(1, "xc_get_featureset()"); + return xc_get_cpu_featureset(xch, idx, &f->len, f->fs); } =20 static void dump_info(xc_interface *xch, bool detail) @@ -294,7 +293,17 @@ static void dump_info(xc_interface *xch, bool detail) printf("\nDynamic sets:\n"); for ( i =3D 0; i < ARRAY_SIZE(featuresets); ++i ) { - get_featureset(xch, i); + if ( get_featureset(xch, i) ) + { + if ( errno =3D=3D EOPNOTSUPP ) + { + printf("%s featureset not supported by Xen\n", + featuresets[i].name); + continue; + } + + err(1, "xc_get_featureset()"); + } =20 decode_featureset(featuresets[i].fs, featuresets[i].len, featuresets[i].name, detail); diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 59a384023b..7ea8c38797 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -363,11 +363,15 @@ long arch_do_sysctl( =20 case XEN_SYSCTL_get_cpu_featureset: { - static const struct cpuid_policy *const policy_table[] =3D { + static const struct cpuid_policy *const policy_table[4] =3D { [XEN_SYSCTL_cpu_featureset_raw] =3D &raw_cpuid_policy, [XEN_SYSCTL_cpu_featureset_host] =3D &host_cpuid_policy, +#ifdef CONFIG_PV [XEN_SYSCTL_cpu_featureset_pv] =3D &pv_max_cpuid_policy, +#endif +#ifdef CONFIG_HVM [XEN_SYSCTL_cpu_featureset_hvm] =3D &hvm_max_cpuid_policy, +#endif }; const struct cpuid_policy *p =3D NULL; uint32_t featureset[FSCAPINTS]; @@ -389,12 +393,17 @@ long arch_do_sysctl( =20 /* Look up requested featureset. */ if ( sysctl->u.cpu_featureset.index < ARRAY_SIZE(policy_table) ) + { p =3D policy_table[sysctl->u.cpu_featureset.index]; =20 - /* Bad featureset index? */ - if ( !p ) - ret =3D -EINVAL; + if ( !p ) + ret =3D -EOPNOTSUPP; + } else + /* Bad featureset index? */ + ret =3D -EINVAL; + + if ( !ret ) cpuid_policy_to_featureset(p, featureset); =20 /* Copy the requested featureset into place. */ diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 4dfba39ed8..3d72fab49f 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -796,6 +796,8 @@ struct xen_sysctl_cpu_levelling_caps { * - Host: The values Xen is using, (after command line overrides, etc). * - PV: Maximum set of features which can be given to a PV guest. * - HVM: Maximum set of features which can be given to a HVM guest. + * May fail with -EOPNOTSUPP if querying for PV or HVM data when support is + * compiled out of Xen. */ struct xen_sysctl_cpu_featureset { #define XEN_SYSCTL_cpu_featureset_raw 0 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=PeMir+vlnJruZz5kQ/BluFp28sK81WdmqibJrUrbgRPpVqmqPmrUGXHoAPg5/4i6cHH/hl7y06HoPV5bWpKsITfdl0Mukhkf5Xa6FTE/Q1Hczr/9iZXvZwEZTyKl3vSaYT7P1p+zXJ+6+Qq+uW+0ZWHKInWi/w0T3EJwEjWMWWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w7qt3p68s6GAUueC1/bPssYJa8xoGMpzEn+AgeA8414=; b=GV3iW1F2rvL7chDY4EyERb22uW0WRFDDQ8iWMBaOIBVHjO146EZhhFyLehV73BpK8QmMaxWQlTjvmCSu4sJSkIrZIpbZCyRXbbVN/Oj7FCOQKW60KUN35RiIr871CGn8wddTxUOF5cWo0GUJCQb+FVZrB1BVDmlLSJJpakuYucA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748600690780.3116662569142; Wed, 26 Feb 2020 12:23:20 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CP-0003ir-Hs; Wed, 26 Feb 2020 20:22:29 +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 1j73CO-0003ih-13 for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:28 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b4212d10-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:26 +0000 (UTC) X-Inumbo-ID: b4212d10-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xtUBUmH4EQzi1S/Wa1S08vzOPzVv8vAHSz85LL5/5ls=; b=c2+IAB47rqGpt2mibUZaML6JHW4WISUEKCw9JmXsywgJXZmKUJX3ry5o tteTvpwcV5SvSBtKOdadmtpH5zF7ps5nEk7XxK2kapL8gtOWUetbVT9fu MiN50ePZXq8ndTRP/GCM40a1lapYR8m26QXWTyjcjqO/dPlGPnLMARZEN U=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: p7asNZjil5FEVuwRXOTwyq2ukGdfxpzxyTe52S4ZjD9Xwsb4vY9Yu4LIvs/Sj0cr75Rgzv6eMK 9msx0szQP6obUY3aVqur3Q3TDGTjeukJF+7bJhCZQs2kBxY3VUBBupgN8PhiKK//lpQ0FUHiQo DEGjLF3O60As5GcArVnmLeQi7RQeEJB3tPd+GQKHRU5poESI6mw24SSo7fGL0wrk8ayQYHX6ot LNb48Wv2BDmiHoUfthn076RPk/03bRBXOy6QuZ7m8M+a3LSuroQarkHQroB7StkqPgrNeMDWdk FbA= X-SBRS: 2.7 X-MesageID: 13496567 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,489,1574139600"; d="scan'208";a="13496567" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:13 +0000 Message-ID: <20200226202221.6555-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 02/10] tools/libxc: Simplify xc_get_static_cpu_featuremask() 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Drop XC_FEATUREMASK_DEEP_FEATURES. It isn't used by any callers, and unlike the other static masks, won't be of interest to anyone without other pieces= of cpuid-autogen.h In xc_get_static_cpu_featuremask(), use a 2d array instead of individually named variables, and drop the switch statement completely. No practical change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- tools/libxc/include/xenctrl.h | 1 - tools/libxc/xc_cpuid_x86.c | 46 ++++++++++++---------------------------= ---- 2 files changed, 13 insertions(+), 34 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 99552a5f73..dec3c5de2b 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -2488,7 +2488,6 @@ enum xc_static_cpu_featuremask { XC_FEATUREMASK_PV, XC_FEATUREMASK_HVM_SHADOW, XC_FEATUREMASK_HVM_HAP, - XC_FEATUREMASK_DEEP_FEATURES, }; const uint32_t *xc_get_static_cpu_featuremask(enum xc_static_cpu_featurema= sk); =20 diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 21b15b86ec..53cb72438a 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -90,43 +90,23 @@ uint32_t xc_get_cpu_featureset_size(void) const uint32_t *xc_get_static_cpu_featuremask( enum xc_static_cpu_featuremask mask) { - const static uint32_t known[FEATURESET_NR_ENTRIES] =3D INIT_KNOWN_FEAT= URES, - special[FEATURESET_NR_ENTRIES] =3D INIT_SPECIAL_FEATURES, - pv[FEATURESET_NR_ENTRIES] =3D INIT_PV_FEATURES, - hvm_shadow[FEATURESET_NR_ENTRIES] =3D INIT_HVM_SHADOW_FEATURES, - hvm_hap[FEATURESET_NR_ENTRIES] =3D INIT_HVM_HAP_FEATURES, - deep_features[FEATURESET_NR_ENTRIES] =3D INIT_DEEP_FEATURES; - - BUILD_BUG_ON(ARRAY_SIZE(known) !=3D FEATURESET_NR_ENTRIES); - BUILD_BUG_ON(ARRAY_SIZE(special) !=3D FEATURESET_NR_ENTRIES); - BUILD_BUG_ON(ARRAY_SIZE(pv) !=3D FEATURESET_NR_ENTRIES); - BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow) !=3D FEATURESET_NR_ENTRIES); - BUILD_BUG_ON(ARRAY_SIZE(hvm_hap) !=3D FEATURESET_NR_ENTRIES); - BUILD_BUG_ON(ARRAY_SIZE(deep_features) !=3D FEATURESET_NR_ENTRIES); - - switch ( mask ) - { - case XC_FEATUREMASK_KNOWN: - return known; - - case XC_FEATUREMASK_SPECIAL: - return special; - - case XC_FEATUREMASK_PV: - return pv; + const static uint32_t masks[][FEATURESET_NR_ENTRIES] =3D { +#define MASK(x) [XC_FEATUREMASK_ ## x] =3D INIT_ ## x ## _FEATURES =20 - case XC_FEATUREMASK_HVM_SHADOW: - return hvm_shadow; + MASK(KNOWN), + MASK(SPECIAL), + MASK(PV), + MASK(HVM_SHADOW), + MASK(HVM_HAP), =20 - case XC_FEATUREMASK_HVM_HAP: - return hvm_hap; +#undef MASK + }; + BUILD_BUG_ON(ARRAY_SIZE(masks[0]) !=3D FEATURESET_NR_ENTRIES); =20 - case XC_FEATUREMASK_DEEP_FEATURES: - return deep_features; - - default: + if ( (unsigned int)mask >=3D ARRAY_SIZE(masks) ) return NULL; - } + + return masks[mask]; } =20 int xc_get_cpu_policy_size(xc_interface *xch, uint32_t *nr_leaves, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=l8BnV8NHutgRV+oIV3uJ1ZdMra/LaZsTlDSQZltAYBiXHg1TwTw/bkocNLZBRR6Av/hxTJbS1+z0eytMHN8trSY0zldLHKH8pCF44PtBNeDznlBL7IVYktubx451O0lZ35V2Yr/PMJtOXMJo63dtGylqFjUJ1b9RL+pDTL93O3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RZaL5VrhPdYuWibXfoSn1u7qAh7dcoH/67g5EZGQ4vw=; b=mrAB+hgShAJNG869rzJOnMPD0whvg4485zI7LJPIHd6Uh1ZZagcyOLTZqT5mBzY0PdjfHl+1m7AjQruIctOhXgc9Z3qyibW+sjx+szwV3s9C/QooqxpI1YZOqaVzzKzH98GnAilqSsjWqF2SK7A+a1lpYRvNZW3aNTNx6vOVfC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748600691526.9148053217766; Wed, 26 Feb 2020 12:23:20 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CP-0003ix-R1; Wed, 26 Feb 2020 20:22:29 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CO-0003im-Hv for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:28 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b4a9af64-58d5-11ea-aba8-bc764e2007e4; Wed, 26 Feb 2020 20:22:27 +0000 (UTC) X-Inumbo-ID: b4a9af64-58d5-11ea-aba8-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748547; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X9izvnLzHz+THrGOiU5ApMRfurw3HicbGhki5Cgu8dk=; b=V5rLbRd9ilxK0QQZrUVuhWGxx9EExswcr6ysloSqAHogOqsA3xjg1dd9 8dfMFkYTRfB++wQU0lVJg2i6CUmyxRRsAu0xef84E6OWIdE75ItQieo1z q8QtXMCgThyDEHwOiLiwuY/V9C7TzM+ae1hTzNXkzd+Q4tfgv0ABry2r/ Y=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: TruIjfm06i0tm0KddLOX3m2GnwWEN3BzYtZ3kA7CHWDLNgoKlrqvBm9aTkZcCZ0TPH0LCypBS5 PssFKplbcIC/hGMg1wv0otdGZkKVsrUHxi7aMrbeGo5xh/nMCVYwHzW/s6cwSLkswn7ekIvXmo ckMOL6xwG9KxcHraxsxpQSv6pKEqkLAM3sufNGtBN1WN1c9GaL/sMo99zjInajeXowx2lah1QK Z5XGIYCrHNsSFsRXmXuAkjL+syLJFPCD0k2JQ2UaMIN/w08qyJgIl4A8HMTsZP6Prlio4ZUsh7 ahQ= X-SBRS: 2.7 X-MesageID: 13496568 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,489,1574139600"; d="scan'208";a="13496568" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:14 +0000 Message-ID: <20200226202221.6555-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 03/10] x86/gen-cpuid: Rework internal logic to ease future changes 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Better split the logic between parse/calculate/write. Collect the feature comment by their comment character, and perform the accumulation operations= in crunch_numbers(). Avoid rendering the featuresets to C uint32_t's in crunch_numbers(), and instead do this in write_results(). Update format_uint32s() to call featureset_to_uint32s() internally. No functional change - the generated cpuid-autogen.h is identical. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/tools/gen-cpuid.py | 77 +++++++++++++++++++---------------------------= ---- 1 file changed, 29 insertions(+), 48 deletions(-) diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index 71ea78f4eb..99b2e7aeee 100755 --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -20,20 +20,21 @@ def __init__(self, input, output): # State parsed from input self.names =3D {} # Value =3D> Name mapping self.values =3D {} # Name =3D> Value mapping - self.raw_special =3D set() - self.raw_pv =3D set() - self.raw_hvm_shadow =3D set() - self.raw_hvm_hap =3D set() + self.raw =3D { + '!': set(), + 'A': set(), 'S': set(), 'H': set(), + } =20 # State calculated self.nr_entries =3D 0 # Number of words in a featureset self.common_1d =3D 0 # Common features between 1d and e1d - self.known =3D [] # All known features - self.special =3D [] # Features with special semantics - self.pv =3D [] - self.hvm_shadow =3D [] - self.hvm_hap =3D [] + self.pv =3D set() # PV features + self.hvm_shadow =3D set() # HVM shadow features + self.hvm_hap =3D set() # HVM HAP features self.bitfields =3D [] # Text to declare named bitfields in C + self.deep_deps =3D {} # { feature num =3D> dependant features } + self.nr_deep_deps =3D 0 # Number of entries in deep_deps + self.deep_features =3D set() # featureset of keys in deep_deps =20 def parse_definitions(state): """ @@ -81,20 +82,9 @@ def parse_definitions(state): state.values[name.lower().replace("_", "-")] =3D val =20 for a in attr: - - if a =3D=3D "!": - state.raw_special.add(val) - elif a in "ASH": - if a =3D=3D "A": - state.raw_pv.add(val) - state.raw_hvm_shadow.add(val) - state.raw_hvm_hap.add(val) - elif attr =3D=3D "S": - state.raw_hvm_shadow.add(val) - state.raw_hvm_hap.add(val) - elif attr =3D=3D "H": - state.raw_hvm_hap.add(val) - else: + try: + state.raw[a].add(val) + except KeyError: raise Fail("Unrecognised attribute '%s' for %s" % (a, name= )) =20 if len(state.names) =3D=3D 0: @@ -117,10 +107,11 @@ def featureset_to_uint32s(fs, nr): if len(words) < nr: words.extend([0] * (nr - len(words))) =20 - return [ "0x%08xU" % x for x in words ] + return ("0x%08xU" % x for x in words) =20 -def format_uint32s(words, indent): +def format_uint32s(state, featureset, indent): """ Format a list of uint32_t's suitable for a macro definition """ + words =3D featureset_to_uint32s(featureset, state.nr_entries) spaces =3D " " * indent return spaces + (", \\\n" + spaces).join(words) + ", \\" =20 @@ -133,13 +124,11 @@ def crunch_numbers(state): # Features common between 1d and e1d. common_1d =3D (FPU, VME, DE, PSE, TSC, MSR, PAE, MCE, CX8, APIC, MTRR, PGE, MCA, CMOV, PAT, PSE36, MMX, FXSR) + state.common_1d =3D common_1d =20 - state.known =3D featureset_to_uint32s(state.names.keys(), nr_entries) - state.common_1d =3D featureset_to_uint32s(common_1d, 1)[0] - state.special =3D featureset_to_uint32s(state.raw_special, nr_entries) - state.pv =3D featureset_to_uint32s(state.raw_pv, nr_entries) - state.hvm_shadow =3D featureset_to_uint32s(state.raw_hvm_shadow, nr_en= tries) - state.hvm_hap =3D featureset_to_uint32s(state.raw_hvm_hap, nr_entries) + state.pv =3D state.raw['A'] + state.hvm_shadow =3D state.pv | state.raw['S'] + state.hvm_hap =3D state.hvm_shadow | state.raw['H'] =20 # # Feature dependency information. @@ -317,17 +306,9 @@ def crunch_numbers(state): =20 state.deep_deps[feat] =3D seen[1:] =20 - state.deep_features =3D featureset_to_uint32s(deps.keys(), nr_entries) + state.deep_features =3D deps.keys() state.nr_deep_deps =3D len(state.deep_deps.keys()) =20 - try: - _tmp =3D state.deep_deps.iteritems() - except AttributeError: - _tmp =3D state.deep_deps.items() - - for k, v in _tmp: - state.deep_deps[k] =3D featureset_to_uint32s(v, nr_entries) - # Calculate the bitfield name declarations for word in range(nr_entries): =20 @@ -382,21 +363,21 @@ def write_results(state): =20 #define INIT_DEEP_DEPS { \\ """ % (state.nr_entries, - state.common_1d, - format_uint32s(state.known, 4), - format_uint32s(state.special, 4), - format_uint32s(state.pv, 4), - format_uint32s(state.hvm_shadow, 4), - format_uint32s(state.hvm_hap, 4), + next(featureset_to_uint32s(state.common_1d, 1)), + format_uint32s(state, state.names.keys(), 4), + format_uint32s(state, state.raw['!'], 4), + format_uint32s(state, state.pv, 4), + format_uint32s(state, state.hvm_shadow, 4), + format_uint32s(state, state.hvm_hap, 4), state.nr_deep_deps, - format_uint32s(state.deep_features, 4), + format_uint32s(state, state.deep_features, 4), )) =20 for dep in sorted(state.deep_deps.keys()): state.output.write( " { %#xU, /* %s */ { \\\n%s\n }, }, \\\n" % (dep, state.names[dep], - format_uint32s(state.deep_deps[dep], 8) + format_uint32s(state, state.deep_deps[dep], 8) )) =20 state.output.write( --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=kPNaV2g5VhdFaVVx/4o65DhSxtpG7YqJCFfhwR6qcPvfYDunK2VSN6IUX7UmLUTiv6AE8zkF4akXn0UzsP/bEsa3JdYBIPo7jlmwwVq8U5aRWgaAR3SkY7FFYgErBpUMODxsXECgo8j6WriL8YJSE6Kn4A8AA5ofymHCX86UxiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NU1KVRcYa9EH0z3KWwNy8kfHkz5pKN804HJsS0rF9FA=; b=TxrbuMFrP+GJt62c/blY4o2hise0lUrxKYyYRj9xwKRBY0aFLDTo7xP8v3LhLXivYk/RrBzWFSyyMD2gD7IG0kBV2yXXZ1jJUGtwci9qiUkSEqMdXjE+H3wDe1o6aV6scINN2pUmF3hTFI/hhYrAOitG26ZcK8cnn6jDybuBLyc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748600980695.1208439307992; Wed, 26 Feb 2020 12:23:20 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CU-0003jf-IU; Wed, 26 Feb 2020 20:22:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CT-0003jE-HV for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:33 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b58023a0-58d5-11ea-aba8-bc764e2007e4; Wed, 26 Feb 2020 20:22:28 +0000 (UTC) X-Inumbo-ID: b58023a0-58d5-11ea-aba8-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dq09f6IQNB5lfMnrAuTuyNDc3XCBHoDzUrB9JPOM2b4=; b=esI4UTu7JAhc3Rzg2jJOArLJfzE8ZAenUPgOFP2p7L+ZTshEE5EmrMYQ LMIVuBHnfJGw9ndc6fGfiYwrT44QcxqgaOCWAmZmI2jb56RekWya/CUE7 xcsWO44XnA0ODPPpp8OJjMCZtYTTxdsP7WCpKVDyG7zU9E65MGLKPbRlM c=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: YU14lgep6DCZjxl/Ho/WAS2tWbFyWXi49jhPdg+wkVhZloXWfqCzmMJAjUHgbq3mzlxL7wjBwn +nWxg6iu3itTQjmKmVez8d69T9GjExOF58/8q70GhNSAfk7xQpI+D4iLQBBqHMJbCcGz3j2jG9 46c2sPCWZGjgZLthwh3ohJ9Kvh5Cr6n2I2yL8nl/ZbRKo/9BMDnXhS4zHW7OsWS0yg2m47MlN+ iXk3NIZwH6VKpWQTrYVAJzhtsfWXdLfK5sY92pA+kX7IVRr/VYwUSrSZBbfKdWdP0WYXqAkUZ1 J6A= X-SBRS: 2.7 X-MesageID: 13496571 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,489,1574139600"; d="scan'208";a="13496571" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:15 +0000 Message-ID: <20200226202221.6555-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 04/10] x86/gen-cpuid: Create max and default variations of INIT_*_FEATURES 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) For now, write the same content for both. Update the users of the initialisers to use the new name, and extend xen-cpuid to dump both default and max featuresets. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- tools/libxc/include/xenctrl.h | 9 ++++++--- tools/libxc/xc_cpuid_x86.c | 9 ++++++--- tools/misc/xen-cpuid.c | 18 ++++++++++++------ xen/arch/x86/cpuid.c | 20 ++++++++++---------- xen/tools/gen-cpuid.py | 40 ++++++++++++++++++++++++++++------------ 5 files changed, 62 insertions(+), 34 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index dec3c5de2b..fc6e57a1a0 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -2485,9 +2485,12 @@ uint32_t xc_get_cpu_featureset_size(void); enum xc_static_cpu_featuremask { XC_FEATUREMASK_KNOWN, XC_FEATUREMASK_SPECIAL, - XC_FEATUREMASK_PV, - XC_FEATUREMASK_HVM_SHADOW, - XC_FEATUREMASK_HVM_HAP, + XC_FEATUREMASK_PV_MAX, + XC_FEATUREMASK_PV_DEF, + XC_FEATUREMASK_HVM_SHADOW_MAX, + XC_FEATUREMASK_HVM_SHADOW_DEF, + XC_FEATUREMASK_HVM_HAP_MAX, + XC_FEATUREMASK_HVM_HAP_DEF, }; const uint32_t *xc_get_static_cpu_featuremask(enum xc_static_cpu_featurema= sk); =20 diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 53cb72438a..c2ea0db25c 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -95,9 +95,12 @@ const uint32_t *xc_get_static_cpu_featuremask( =20 MASK(KNOWN), MASK(SPECIAL), - MASK(PV), - MASK(HVM_SHADOW), - MASK(HVM_HAP), + MASK(PV_MAX), + MASK(PV_DEF), + MASK(HVM_SHADOW_MAX), + MASK(HVM_SHADOW_DEF), + MASK(HVM_HAP_MAX), + MASK(HVM_HAP_DEF), =20 #undef MASK }; diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c index 36c17bf777..585b530b21 100644 --- a/tools/misc/xen-cpuid.c +++ b/tools/misc/xen-cpuid.c @@ -283,12 +283,18 @@ static void dump_info(xc_interface *xch, bool detail) nr_features, "Known", detail); decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_SPECIAL= ), nr_features, "Special", detail); - decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_PV), - nr_features, "PV Mask", detail); - decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_HVM_SHA= DOW), - nr_features, "HVM Shadow Mask", detail); - decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_HVM_HAP= ), - nr_features, "HVM Hap Mask", detail); + decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_PV_MAX), + nr_features, "PV Max", detail); + decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_PV_DEF), + nr_features, "PV Default", detail); + decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_HVM_SHA= DOW_MAX), + nr_features, "HVM Shadow Max", detail); + decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_HVM_SHA= DOW_DEF), + nr_features, "HVM Shadow Default", detail); + decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_HVM_HAP= _MAX), + nr_features, "HVM Hap Max", detail); + decode_featureset(xc_get_static_cpu_featuremask(XC_FEATUREMASK_HVM_HAP= _DEF), + nr_features, "HVM Hap Default", detail); =20 printf("\nDynamic sets:\n"); for ( i =3D 0; i < ARRAY_SIZE(featuresets); ++i ) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index aee221dc44..546ae31bb9 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -15,9 +15,9 @@ const uint32_t known_features[] =3D INIT_KNOWN_FEATURES; const uint32_t special_features[] =3D INIT_SPECIAL_FEATURES; =20 -static const uint32_t pv_featuremask[] =3D INIT_PV_FEATURES; -static const uint32_t hvm_shadow_featuremask[] =3D INIT_HVM_SHADOW_FEATURE= S; -static const uint32_t hvm_hap_featuremask[] =3D INIT_HVM_HAP_FEATURES; +static const uint32_t pv_max_featuremask[] =3D INIT_PV_MAX_FEATURES; +static const uint32_t hvm_shadow_max_featuremask[] =3D INIT_HVM_SHADOW_MAX= _FEATURES; +static const uint32_t hvm_hap_max_featuremask[] =3D INIT_HVM_HAP_MAX_FEATU= RES; static const uint32_t deep_features[] =3D INIT_DEEP_FEATURES; =20 static int __init parse_xen_cpuid(const char *s) @@ -359,7 +359,7 @@ static void __init calculate_pv_max_policy(void) cpuid_policy_to_featureset(p, pv_featureset); =20 for ( i =3D 0; i < ARRAY_SIZE(pv_featureset); ++i ) - pv_featureset[i] &=3D pv_featuremask[i]; + pv_featureset[i] &=3D pv_max_featuremask[i]; =20 /* * If Xen isn't virtualising MSR_SPEC_CTRL for PV guests because of @@ -391,7 +391,7 @@ static void __init calculate_hvm_max_policy(void) cpuid_policy_to_featureset(p, hvm_featureset); =20 hvm_featuremask =3D hvm_hap_supported() ? - hvm_hap_featuremask : hvm_shadow_featuremask; + hvm_hap_max_featuremask : hvm_shadow_max_featuremask; =20 for ( i =3D 0; i < ARRAY_SIZE(hvm_featureset); ++i ) hvm_featureset[i] &=3D hvm_featuremask[i]; @@ -500,7 +500,7 @@ void recalculate_cpuid_policy(struct domain *d) if ( !hap_enabled(d) ) { for ( i =3D 0; i < ARRAY_SIZE(max_fs); i++ ) - max_fs[i] &=3D hvm_shadow_featuremask[i]; + max_fs[i] &=3D hvm_shadow_max_featuremask[i]; } =20 /* Hide nested-virt if it hasn't been explicitly configured. */ @@ -964,7 +964,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf, =20 /* * PSE36 is not supported in shadow mode. This bit should be - * clear in hvm_shadow_featuremask[]. + * clear in hvm_shadow_max_featuremask[]. * * However, an unspecified version of Hyper-V from 2011 refuse= s to * start as the "cpu does not provide required hw features" if= it @@ -1003,9 +1003,9 @@ static void __init __maybe_unused build_assertions(vo= id) { BUILD_BUG_ON(ARRAY_SIZE(known_features) !=3D FSCAPINTS); BUILD_BUG_ON(ARRAY_SIZE(special_features) !=3D FSCAPINTS); - BUILD_BUG_ON(ARRAY_SIZE(pv_featuremask) !=3D FSCAPINTS); - BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow_featuremask) !=3D FSCAPINTS); - BUILD_BUG_ON(ARRAY_SIZE(hvm_hap_featuremask) !=3D FSCAPINTS); + BUILD_BUG_ON(ARRAY_SIZE(pv_max_featuremask) !=3D FSCAPINTS); + BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow_max_featuremask) !=3D FSCAPINTS); + BUILD_BUG_ON(ARRAY_SIZE(hvm_hap_max_featuremask) !=3D FSCAPINTS); BUILD_BUG_ON(ARRAY_SIZE(deep_features) !=3D FSCAPINTS); =20 /* Find some more clever allocation scheme if this trips. */ diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index 99b2e7aeee..af5610a5e6 100755 --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -28,9 +28,12 @@ def __init__(self, input, output): # State calculated self.nr_entries =3D 0 # Number of words in a featureset self.common_1d =3D 0 # Common features between 1d and e1d - self.pv =3D set() # PV features - self.hvm_shadow =3D set() # HVM shadow features - self.hvm_hap =3D set() # HVM HAP features + self.pv_def =3D set() # PV default features + self.hvm_shadow_def =3D set() # HVM shadow default features + self.hvm_hap_def =3D set() # HVM HAP default features + self.pv_max =3D set() # PV max features + self.hvm_shadow_max =3D set() # HVM shadow max features + self.hvm_hap_max =3D set() # HVM HAP max features self.bitfields =3D [] # Text to declare named bitfields in C self.deep_deps =3D {} # { feature num =3D> dependant features } self.nr_deep_deps =3D 0 # Number of entries in deep_deps @@ -126,9 +129,13 @@ def crunch_numbers(state): MTRR, PGE, MCA, CMOV, PAT, PSE36, MMX, FXSR) state.common_1d =3D common_1d =20 - state.pv =3D state.raw['A'] - state.hvm_shadow =3D state.pv | state.raw['S'] - state.hvm_hap =3D state.hvm_shadow | state.raw['H'] + state.pv_def =3D state.raw['A'] + state.hvm_shadow_def =3D state.pv_def | state.raw['S'] + state.hvm_hap_def =3D state.hvm_shadow_def | state.raw['H'] + + state.pv_max =3D state.pv_def + state.hvm_shadow_max =3D state.hvm_shadow_def + state.hvm_hap_max =3D state.hvm_hap_def =20 # # Feature dependency information. @@ -351,11 +358,17 @@ def write_results(state): =20 #define INIT_SPECIAL_FEATURES { \\\n%s\n} =20 -#define INIT_PV_FEATURES { \\\n%s\n} +#define INIT_PV_DEF_FEATURES { \\\n%s\n} + +#define INIT_PV_MAX_FEATURES { \\\n%s\n} + +#define INIT_HVM_SHADOW_DEF_FEATURES { \\\n%s\n} + +#define INIT_HVM_SHADOW_MAX_FEATURES { \\\n%s\n} =20 -#define INIT_HVM_SHADOW_FEATURES { \\\n%s\n} +#define INIT_HVM_HAP_DEF_FEATURES { \\\n%s\n} =20 -#define INIT_HVM_HAP_FEATURES { \\\n%s\n} +#define INIT_HVM_HAP_MAX_FEATURES { \\\n%s\n} =20 #define NR_DEEP_DEPS %sU =20 @@ -366,9 +379,12 @@ def write_results(state): next(featureset_to_uint32s(state.common_1d, 1)), format_uint32s(state, state.names.keys(), 4), format_uint32s(state, state.raw['!'], 4), - format_uint32s(state, state.pv, 4), - format_uint32s(state, state.hvm_shadow, 4), - format_uint32s(state, state.hvm_hap, 4), + format_uint32s(state, state.pv_def, 4), + format_uint32s(state, state.pv_max, 4), + format_uint32s(state, state.hvm_shadow_def, 4), + format_uint32s(state, state.hvm_shadow_max, 4), + format_uint32s(state, state.hvm_hap_def, 4), + format_uint32s(state, state.hvm_hap_max, 4), state.nr_deep_deps, format_uint32s(state, state.deep_features, 4), )) --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=UBiJnlGtiWzEaqtSdW/52OCmh+b3HemZg1CQL/F5HxH8kEwFg2Hp+z9tuAY2IOdJUHYlV90hExPmw9NZByyMXjtofYZu01Iu3Ehi1wuGFwYzrD547OnIJs/RtNxw56rsQw561qu1jyCW5slPSA/jvt1qmQLV4eDWul/ehIviG0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5L3PeOjzVYabWkeItnbWt8ZqntcDrsbaD/Y2SMW1KWo=; b=BuRzoXforbREZKHG7yz1nDw8P7VdRk11VMN2/pcpgW5l3bxPNAHCX714Sb381XRrcgjrPPamU4uDxQLZ+q17bgqDXh8LL6bY7bSBAMf/XHzoeaYpdUJ0T9o24Vh1oT/tWGzGQeou+LbXSBMUasuHws+/op9G4Vk5jr69/KVoioY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748600683729.1881029553703; Wed, 26 Feb 2020 12:23:20 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CY-0003kn-Sc; Wed, 26 Feb 2020 20:22:38 +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 1j73CY-0003kH-00 for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:38 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b4212d12-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:28 +0000 (UTC) X-Inumbo-ID: b4212d12-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748547; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yGMVzI6Kc0BempO1OOlS8e4RhhWkq+Lao6Js498e0JE=; b=UnRlzKeHqzdx271q3LkTy5SIPExkpW7UoON5+S2+Vu0YuxAftHsl3+4z jhSPUUrBrKaJcnYow+HkO6j89OJAOQGymJ8Zju1AHYtAqsXQL3tvM77c1 dEtycsJ/5mLS5Zb9QnFFdsMSgfG67IoB2eUjdvjeRPIujT4K6EMJrV21w I=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 2DLAPFKL6rlBuGWIECs/44VMD8+yFW79E7c+AwEIQjWYZfRoE6HrqjT2HQ2oenAt77D9KwiXIu NYmozwMg+wH+W84qEJLx57DgfeG9c3ZKuqbdmEp422gJ0NPgYCKRoOUMTGpECL9serg1gO5Hwi v4CfV/whrPLZQymUVjEtmH/0BDUbSN0fJUYnastajOPLuEf+K7iZQjmW+Ggfazh6DypuC7e11F tPIF8u6jLn0Pa/o2gApqhAu+fPAcW2bZVTGl/ONQO9u55HDuiiPMOTKLetQlwYivVnKrjgktp2 wN8= X-SBRS: 2.7 X-MesageID: 13496569 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,489,1574139600"; d="scan'208";a="13496569" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:16 +0000 Message-ID: <20200226202221.6555-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 05/10] x86/msr: Compile out unused logic/objects 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Arrange to compile out the PV or HVM logic and objects as applicable. This involves a bit of complexity in init_domain_msr_policy() as is_pv_domain() can't be evaulated at compile time. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/msr.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index e39bb6dce4..738d7123f9 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -31,9 +31,13 @@ DEFINE_PER_CPU(uint32_t, tsc_aux); =20 struct msr_policy __read_mostly raw_msr_policy, - __read_mostly host_msr_policy, - __read_mostly hvm_max_msr_policy, - __read_mostly pv_max_msr_policy; + __read_mostly host_msr_policy; +#ifdef CONFIG_PV +struct msr_policy __read_mostly pv_max_msr_policy; +#endif +#ifdef CONFIG_HVM +struct msr_policy __read_mostly hvm_max_msr_policy; +#endif =20 static void __init calculate_raw_policy(void) { @@ -56,9 +60,6 @@ static void __init calculate_hvm_max_policy(void) { struct msr_policy *mp =3D &hvm_max_msr_policy; =20 - if ( !hvm_enabled ) - return; - *mp =3D host_msr_policy; =20 /* It's always possible to emulate CPUID faulting for HVM guests */ @@ -76,16 +77,27 @@ void __init init_guest_msr_policy(void) { calculate_raw_policy(); calculate_host_policy(); - calculate_hvm_max_policy(); - calculate_pv_max_policy(); + + if ( IS_ENABLED(CONFIG_PV) ) + calculate_pv_max_policy(); + + if ( hvm_enabled ) + calculate_hvm_max_policy(); } =20 int init_domain_msr_policy(struct domain *d) { - struct msr_policy *mp =3D - xmemdup(is_pv_domain(d) ? &pv_max_msr_policy - : &hvm_max_msr_policy); + struct msr_policy *mp =3D is_pv_domain(d) + ? (IS_ENABLED(CONFIG_PV) ? &pv_max_msr_policy : NULL) + : (IS_ENABLED(CONFIG_HVM) ? &hvm_max_msr_policy : NULL); + + if ( !mp ) + { + ASSERT_UNREACHABLE(); + return -EOPNOTSUPP; + } =20 + mp =3D xmemdup(mp); if ( !mp ) return -ENOMEM; =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748602; cv=none; d=zohomail.com; s=zohoarc; b=HMW+1yFomSjqgH6yyEO6X1nC1/T4WEdA3FpOt1R2seDE4f6ymkoKsv0vjdTlplawCxrixqZEo302GJTwIgqaANiGNJ71hDi8mx2OnyMc70Kz4TbXET3V2AkgJaE8EtkIDAy2UXRArzHaAb42ZdIkSJJek9OP+1ilUbS5oD9u1SU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748602; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u9Ic3SlVjmZv/grQy5ZDSiOyVlhH83X1STkOt+Pc7EA=; b=Q+fgmaa9mle2w/pD3JxR5BRBtzuTNTTEGjHTk8VbCaNjRxUAoa6GSB4bNhQycGqE0O+A25FluQHET5ftdpN9OXLu3yjTpeHUbyzA/aJvDE5nTMrPt6AsUIGbN830D5On6JHxh16F8QQiEbKpwJYvnz1O6oHa7G8zlNwiJMGhcEs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748602366794.0750418308405; Wed, 26 Feb 2020 12:23:22 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73Cj-0003rc-10; Wed, 26 Feb 2020 20:22:49 +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 1j73Ci-0003rA-0M for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:48 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b554081a-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:28 +0000 (UTC) X-Inumbo-ID: b554081a-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gh7zvT2QF4Vx8o2fLYvtD5CfhlnyOcj3YGLCny2yNI8=; b=JKvLq0rpHH2tDwxjqjAk5A58Wtt1Uwe31LFWJ09Tf2Y9su8bnSpolhCt x3y3Mm1RHOVLui2Nw4JlEA5kvnzdk4L+5yO7WR5taxEuE8SYzLHnvNyEa oKLJgxxKio7YPzcdW5WyTjJIr2YrKZVLLao73xFd+lttOvjquIvz/vWmZ w=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: dZXbkmdwAMbW4Wf01LZHbVu9Kh+kI8sy9YcBytPH3uQGEs5KGSrpDTrlkKEfWCErhwC1XnYh8I FQmRdS8OCmLgwfOiVrTDLTVXa/ONoGUI21gkpqX6VvNTg512iFtrYLIpb21AcvUrdCgpSadcoZ RE6g+OZRTl8l9aqb+Kv6paO0iKgjEuvvJBqULKR1b6meNGhUC9uC3JYrlkWwnJ+Z2V5uTUp8jC Bmie3c4iXyKyhlOsMS1dKU+hghqIGpidvepkVS7GemqQkpQaUFoPACB69V2s6Si9u8hPzYFc86 b20= X-SBRS: 2.7 X-MesageID: 13496573 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,489,1574139600"; d="scan'208";a="13496573" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:17 +0000 Message-ID: <20200226202221.6555-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 06/10] x86/msr: Introduce and use default MSR policies 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) For now, the default and max policies remain identical, but this will change in the future. Update XEN_SYSCTL_get_cpu_policy and init_domain_msr_policy() to use the default policies. Take the opportunity sort PV ahead of HVM, as is the prevailing style elsewhere. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/msr.c | 32 +++++++++++++++++++++++++++----- xen/arch/x86/sysctl.c | 4 ++-- xen/include/asm-x86/msr.h | 4 +++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index 738d7123f9..519222a2b8 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -34,9 +34,11 @@ struct msr_policy __read_mostly raw_msr_policy, __read_mostly host_msr_policy; #ifdef CONFIG_PV struct msr_policy __read_mostly pv_max_msr_policy; +struct msr_policy __read_mostly pv_def_msr_policy; #endif #ifdef CONFIG_HVM struct msr_policy __read_mostly hvm_max_msr_policy; +struct msr_policy __read_mostly hvm_def_msr_policy; #endif =20 static void __init calculate_raw_policy(void) @@ -56,6 +58,20 @@ static void __init calculate_host_policy(void) mp->platform_info.cpuid_faulting =3D cpu_has_cpuid_faulting; } =20 +static void __init calculate_pv_max_policy(void) +{ + struct msr_policy *mp =3D &pv_max_msr_policy; + + *mp =3D host_msr_policy; +} + +static void __init calculate_pv_def_policy(void) +{ + struct msr_policy *mp =3D &pv_def_msr_policy; + + *mp =3D pv_max_msr_policy; +} + static void __init calculate_hvm_max_policy(void) { struct msr_policy *mp =3D &hvm_max_msr_policy; @@ -66,11 +82,11 @@ static void __init calculate_hvm_max_policy(void) mp->platform_info.cpuid_faulting =3D true; } =20 -static void __init calculate_pv_max_policy(void) +static void __init calculate_hvm_def_policy(void) { - struct msr_policy *mp =3D &pv_max_msr_policy; + struct msr_policy *mp =3D &hvm_def_msr_policy; =20 - *mp =3D host_msr_policy; + *mp =3D hvm_max_msr_policy; } =20 void __init init_guest_msr_policy(void) @@ -79,17 +95,23 @@ void __init init_guest_msr_policy(void) calculate_host_policy(); =20 if ( IS_ENABLED(CONFIG_PV) ) + { calculate_pv_max_policy(); + calculate_pv_def_policy(); + } =20 if ( hvm_enabled ) + { calculate_hvm_max_policy(); + calculate_hvm_def_policy(); + } } =20 int init_domain_msr_policy(struct domain *d) { struct msr_policy *mp =3D is_pv_domain(d) - ? (IS_ENABLED(CONFIG_PV) ? &pv_max_msr_policy : NULL) - : (IS_ENABLED(CONFIG_HVM) ? &hvm_max_msr_policy : NULL); + ? (IS_ENABLED(CONFIG_PV) ? &pv_def_msr_policy : NULL) + : (IS_ENABLED(CONFIG_HVM) ? &hvm_def_msr_policy : NULL); =20 if ( !mp ) { diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 7ea8c38797..cad7534373 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -49,7 +49,7 @@ const struct cpu_policy system_policies[6] =3D { }, [ XEN_SYSCTL_cpu_policy_pv_default ] =3D { &pv_max_cpuid_policy, - &pv_max_msr_policy, + &pv_def_msr_policy, }, #endif #ifdef CONFIG_HVM @@ -59,7 +59,7 @@ const struct cpu_policy system_policies[6] =3D { }, [ XEN_SYSCTL_cpu_policy_hvm_default ] =3D { &hvm_max_cpuid_policy, - &hvm_max_msr_policy, + &hvm_def_msr_policy, }, #endif }; diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h index bca41a3670..41397e19cf 100644 --- a/xen/include/asm-x86/msr.h +++ b/xen/include/asm-x86/msr.h @@ -269,8 +269,10 @@ static inline void wrmsr_tsc_aux(uint32_t val) =20 extern struct msr_policy raw_msr_policy, host_msr_policy, + pv_max_msr_policy, + pv_def_msr_policy, hvm_max_msr_policy, - pv_max_msr_policy; + hvm_def_msr_policy; =20 /* Container object for per-vCPU MSRs */ struct vcpu_msrs --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=KO72tKeK6cHDxnUt8GVGb6qCBf6roelMF5G8UFi3JdxEudF/MprH6+w91qhrpVvDGTPE1AjmpvFvWoxRnJ9WYGr2xrdH8IgskwoMmJ6asQCRwGLTISeRbjH6wRDGhA1zz2xmnXsUQTdQ0xW8vMyXggbAz1ypgjTt3DxXencjwxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QfVI65DDyMe7M70h/YoEav8q1qNMyyX9de1RX8hpsjo=; b=eqh8LcLNJh3jUR5mPS9dWqCGDckE8rykpBDTImhRY711Xvh1gtlwoPVDNTkGtl03jzNYm8//9nbbL4lF3nWJHbB3wRHCOKhDlEThEErJgtXFEr47PsebK4/Z0VlItQfuGOYK4CkDyCtl0faRahmyuAAoO168T8IuFLU/Lg+gZM0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748600684624.278274870706; Wed, 26 Feb 2020 12:23:20 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73Ce-0003ni-GY; Wed, 26 Feb 2020 20:22:44 +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 1j73Cd-0003mD-0I for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:43 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b595a90a-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:28 +0000 (UTC) X-Inumbo-ID: b595a90a-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OEZtdx2fk/4Ziy8SwPLeKsxlKT/7PZqtGcFqzT6kEz4=; b=CX+9O4Hd8eznDi5enc3mhXg1/w+np9LeOm3fEk5Bn3i0csxDRaT6nsOz LtTG0/2lpthEIjesbCEIOlwt7zRlEUPIAtZYsMcJWnh7Dys95YLZ/rxah 72cZiCTnofmGoE4tvucvW2mVkp3c6K8uVjVOmjFxuA4NZnfR5kU2pUOIS 8=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: s0SWoYFh7DFgFmCvfQgTEFWJ7ehGrZlV5SO68Yx7/X0nRHaH1KVC3Xs15ltF1RYzUBHH9otoae fEBxvssTSM9YfxmtUgOFXRs0Hwl4jlwM98+xiW2jCd7XkRT1h5LmbngYaLjoIbwEkwsFY2zTuJ t46mi1N6HL4O+AN3xiy+ncWPiNSNzbpp2xB8+Mx45W9Dn8IcrJazOS7GyX4or1/27AbppV+PyQ odGkGeuwo5ucoJ809dA/XNrN3pJNJAy+pLjlGxBdJ2pEdlvc4rZ+fmlgxbbPd+8OQCSI3LVgVo AO8= X-SBRS: 2.7 X-MesageID: 13496574 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,489,1574139600"; d="scan'208";a="13496574" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:18 +0000 Message-ID: <20200226202221.6555-8-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 07/10] x86/cpuid: Compile out unused logic/objects 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) CPUID Policy objects are large (1860 bytes at the time of writing), so compiling them out based on CONFIG_{PV,HVM} makes a lot of sense. This involves a bit of complexity in init_domain_cpuid_policy() and recalculate_cpuid_policy() as is_pv_domain() can't be evaulated at compile time. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpuid.c | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index 546ae31bb9..cd9a02143c 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -95,10 +95,14 @@ static void zero_leaves(struct cpuid_leaf *l, memset(&l[first], 0, sizeof(*l) * (last - first + 1)); } =20 -struct cpuid_policy __read_mostly raw_cpuid_policy, - __read_mostly host_cpuid_policy, - __read_mostly pv_max_cpuid_policy, - __read_mostly hvm_max_cpuid_policy; +struct cpuid_policy __read_mostly raw_cpuid_policy, + __read_mostly host_cpuid_policy; +#ifdef CONFIG_PV +struct cpuid_policy __read_mostly pv_max_cpuid_policy; +#endif +#ifdef CONFIG_HVM +struct cpuid_policy __read_mostly hvm_max_cpuid_policy; +#endif =20 static void sanitise_featureset(uint32_t *fs) { @@ -384,9 +388,6 @@ static void __init calculate_hvm_max_policy(void) unsigned int i; const uint32_t *hvm_featuremask; =20 - if ( !hvm_enabled ) - return; - *p =3D host_cpuid_policy; cpuid_policy_to_featureset(p, hvm_featureset); =20 @@ -443,8 +444,12 @@ void __init init_guest_cpuid(void) { calculate_raw_policy(); calculate_host_policy(); - calculate_pv_max_policy(); - calculate_hvm_max_policy(); + + if ( IS_ENABLED(CONFIG_PV) ) + calculate_pv_max_policy(); + + if ( hvm_enabled ) + calculate_hvm_max_policy(); } =20 bool recheck_cpu_features(unsigned int cpu) @@ -472,11 +477,18 @@ bool recheck_cpu_features(unsigned int cpu) void recalculate_cpuid_policy(struct domain *d) { struct cpuid_policy *p =3D d->arch.cpuid; - const struct cpuid_policy *max =3D - is_pv_domain(d) ? &pv_max_cpuid_policy : &hvm_max_cpuid_policy; + const struct cpuid_policy *max =3D is_pv_domain(d) + ? (IS_ENABLED(CONFIG_PV) ? &pv_max_cpuid_policy : NULL) + : (IS_ENABLED(CONFIG_HVM) ? &hvm_max_cpuid_policy : NULL); uint32_t fs[FSCAPINTS], max_fs[FSCAPINTS]; unsigned int i; =20 + if ( !max ) + { + ASSERT_UNREACHABLE(); + return; + } + p->x86_vendor =3D x86_cpuid_lookup_vendor( p->basic.vendor_ebx, p->basic.vendor_ecx, p->basic.vendor_edx); =20 @@ -612,10 +624,17 @@ void recalculate_cpuid_policy(struct domain *d) =20 int init_domain_cpuid_policy(struct domain *d) { - struct cpuid_policy *p =3D - xmemdup(is_pv_domain(d) ? &pv_max_cpuid_policy - : &hvm_max_cpuid_policy); + struct cpuid_policy *p =3D is_pv_domain(d) + ? (IS_ENABLED(CONFIG_PV) ? &pv_max_cpuid_policy : NULL) + : (IS_ENABLED(CONFIG_HVM) ? &hvm_max_cpuid_policy : NULL); + + if ( !p ) + { + ASSERT_UNREACHABLE(); + return -EOPNOTSUPP; + } =20 + p =3D xmemdup(p); if ( !p ) return -ENOMEM; =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748608; cv=none; d=zohomail.com; s=zohoarc; b=cIhLIaQsQVB4MsPqIltRCHkm/ADpMglT2sP5dmijAICOjz6qYcpdR7W4r+xiYLuF7y9Rn+HWEpYfevvOu5kTGLhFFy2o3yzVYpS/o/J3JAgUAlABpdWWYr9bKpuK5fN58iNhs5DJJxRTftRLXcmqzVQo9mCUEodj7UAFkF0Ka2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748608; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I1ztdYIl9SGjIp8img7C/VuoMBGw0LjunX7Rerow8Cg=; b=LpjE8xTMDXpOLOgjMmcfruVfnj7tb3wYTt1gzs+rXvBY7X6qUGK68Nw7IJ6Z0wr4w7zpPvCCBhf+dMNbvZEj0DEVP2BbSgLo9qSa3xQY36h9V7UYiqFTmMnApXzk4jKiFGCiAZvggIqydE9t0evV3IufYYULQkoYDWlyPxXkFmc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 158274860821078.24677836847479; Wed, 26 Feb 2020 12:23:28 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73Co-0003vO-Ah; Wed, 26 Feb 2020 20:22:54 +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 1j73Cn-0003uh-0T for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:53 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b595a90b-58d5-11ea-94dc-12813bfff9fa; Wed, 26 Feb 2020 20:22:29 +0000 (UTC) X-Inumbo-ID: b595a90b-58d5-11ea-94dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R21aiCvpBVK8pX/VEYsT9FBNc3fKBXVbw2HxNXegm9s=; b=BkkWXvQ4lBYMX2LFu1t4yxtDBy16z9rtJOPU01plyDqcTkGV7Dnxf9dE 9tJzP8fURf7yqSAqwx2btg16GSgHOoUcqHPZ1C8WM3gzXBlUhLibEomTm SDuWYoIc6z5NUCZew5uczjvQGP6iw6NmL3oz55JeUcnaGRlp7+cvSseRW c=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: gpR4kjurA5/tCzcdJ25V1t4YJUtWNdApY3/+bNFx4N1VayTDkMm439E3667pVIj9L9eJiTj64o xuHahg3BA7lFa9s5c7+HQdUG09yOh6KX7XzO0DgqEErJ46eq6kDlk9Asas6QMtlQgiZ3HG6tog kF9lR5rWTWvkl74bGk3PpRFDINLvmxmup9Yi5/cYAKKElbwT/wjQb+MWr9P0avGVWDU3R/GEto MYmNjFp44hxMYYZ6YVyUvzm2y11F4lBuYMtVwKIMiCLe5ILxZXSXoLP5S3DjxiZqovJjrSHJyi zPo= X-SBRS: 2.7 X-MesageID: 13496576 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,489,1574139600"; d="scan'208";a="13496576" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:19 +0000 Message-ID: <20200226202221.6555-9-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 08/10] x86/cpuid: Introduce and use default CPUID policies 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) For now, the default and max policies remain identical, but this will change in the future. Write calculate_{pv,hvm}_def_policy() in a way which will c= ope with simple feature differences for now. Update XEN_SYSCTL_get_cpu_policy and init_domain_cpuid_policy() to use the default policies. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpuid.c | 55 +++++++++++++++++++++++++++++++++++++++++= ++-- xen/arch/x86/sysctl.c | 4 ++-- xen/include/asm-x86/cpuid.h | 3 ++- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index cd9a02143c..6e01394fd2 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -18,6 +18,9 @@ const uint32_t special_features[] =3D INIT_SPECIAL_FEATUR= ES; static const uint32_t pv_max_featuremask[] =3D INIT_PV_MAX_FEATURES; static const uint32_t hvm_shadow_max_featuremask[] =3D INIT_HVM_SHADOW_MAX= _FEATURES; static const uint32_t hvm_hap_max_featuremask[] =3D INIT_HVM_HAP_MAX_FEATU= RES; +static const uint32_t pv_def_featuremask[] =3D INIT_PV_DEF_FEATURES; +static const uint32_t hvm_shadow_def_featuremask[] =3D INIT_HVM_SHADOW_DEF= _FEATURES; +static const uint32_t hvm_hap_def_featuremask[] =3D INIT_HVM_HAP_DEF_FEATU= RES; static const uint32_t deep_features[] =3D INIT_DEEP_FEATURES; =20 static int __init parse_xen_cpuid(const char *s) @@ -99,9 +102,11 @@ struct cpuid_policy __read_mostly raw_cpuid_policy, __read_mostly host_cpuid_policy; #ifdef CONFIG_PV struct cpuid_policy __read_mostly pv_max_cpuid_policy; +struct cpuid_policy __read_mostly pv_def_cpuid_policy; #endif #ifdef CONFIG_HVM struct cpuid_policy __read_mostly hvm_max_cpuid_policy; +struct cpuid_policy __read_mostly hvm_def_cpuid_policy; #endif =20 static void sanitise_featureset(uint32_t *fs) @@ -381,6 +386,23 @@ static void __init calculate_pv_max_policy(void) p->extd.raw[0xa] =3D EMPTY_LEAF; /* No SVM for PV guests. */ } =20 +static void __init calculate_pv_def_policy(void) +{ + struct cpuid_policy *p =3D &pv_def_cpuid_policy; + uint32_t pv_featureset[FSCAPINTS]; + unsigned int i; + + *p =3D pv_max_cpuid_policy; + cpuid_policy_to_featureset(p, pv_featureset); + + for ( i =3D 0; i < ARRAY_SIZE(pv_featureset); ++i ) + pv_featureset[i] &=3D pv_def_featuremask[i]; + + sanitise_featureset(pv_featureset); + cpuid_featureset_to_policy(pv_featureset, p); + recalculate_xstate(p); +} + static void __init calculate_hvm_max_policy(void) { struct cpuid_policy *p =3D &hvm_max_cpuid_policy; @@ -440,16 +462,45 @@ static void __init calculate_hvm_max_policy(void) recalculate_xstate(p); } =20 +static void __init calculate_hvm_def_policy(void) +{ + struct cpuid_policy *p =3D &hvm_def_cpuid_policy; + uint32_t hvm_featureset[FSCAPINTS]; + unsigned int i; + const uint32_t *hvm_featuremask; + + *p =3D hvm_max_cpuid_policy; + cpuid_policy_to_featureset(p, hvm_featureset); + + hvm_featuremask =3D hvm_hap_supported() ? + hvm_hap_def_featuremask : hvm_shadow_def_featuremask; + + for ( i =3D 0; i < ARRAY_SIZE(hvm_featureset); ++i ) + hvm_featureset[i] &=3D hvm_featuremask[i]; + + guest_common_feature_adjustments(hvm_featureset); + + sanitise_featureset(hvm_featureset); + cpuid_featureset_to_policy(hvm_featureset, p); + recalculate_xstate(p); +} + void __init init_guest_cpuid(void) { calculate_raw_policy(); calculate_host_policy(); =20 if ( IS_ENABLED(CONFIG_PV) ) + { calculate_pv_max_policy(); + calculate_pv_def_policy(); + } =20 if ( hvm_enabled ) + { calculate_hvm_max_policy(); + calculate_hvm_def_policy(); + } } =20 bool recheck_cpu_features(unsigned int cpu) @@ -625,8 +676,8 @@ void recalculate_cpuid_policy(struct domain *d) int init_domain_cpuid_policy(struct domain *d) { struct cpuid_policy *p =3D is_pv_domain(d) - ? (IS_ENABLED(CONFIG_PV) ? &pv_max_cpuid_policy : NULL) - : (IS_ENABLED(CONFIG_HVM) ? &hvm_max_cpuid_policy : NULL); + ? (IS_ENABLED(CONFIG_PV) ? &pv_def_cpuid_policy : NULL) + : (IS_ENABLED(CONFIG_HVM) ? &hvm_def_cpuid_policy : NULL); =20 if ( !p ) { diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index cad7534373..b7948f2663 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -48,7 +48,7 @@ const struct cpu_policy system_policies[6] =3D { &pv_max_msr_policy, }, [ XEN_SYSCTL_cpu_policy_pv_default ] =3D { - &pv_max_cpuid_policy, + &pv_def_cpuid_policy, &pv_def_msr_policy, }, #endif @@ -58,7 +58,7 @@ const struct cpu_policy system_policies[6] =3D { &hvm_max_msr_policy, }, [ XEN_SYSCTL_cpu_policy_hvm_default ] =3D { - &hvm_max_cpuid_policy, + &hvm_def_cpuid_policy, &hvm_def_msr_policy, }, #endif diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h index 1b00e832d6..7baf6c9628 100644 --- a/xen/include/asm-x86/cpuid.h +++ b/xen/include/asm-x86/cpuid.h @@ -49,7 +49,8 @@ DECLARE_PER_CPU(struct cpuidmasks, cpuidmasks); extern struct cpuidmasks cpuidmask_defaults; =20 extern struct cpuid_policy raw_cpuid_policy, host_cpuid_policy, - pv_max_cpuid_policy, hvm_max_cpuid_policy; + pv_max_cpuid_policy, pv_def_cpuid_policy, + hvm_max_cpuid_policy, hvm_def_cpuid_policy; =20 extern const struct cpu_policy system_policies[]; =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582748601; cv=none; d=zohomail.com; s=zohoarc; b=ZoAsAeGXEnvyBCMmjKKKGJ6+rnHLJNmfv1esLGBFtUw7UNyQ/EZukEA+hpnDcLIE7NMpSg7zBElZjsYEGgSpYPfcLmoRerQnk52uM50wUPBoNfx6ovVQ6wdMZTY0ESRJYJQql++UHUielrMEkhirzHzZ+u/apt6F3CNbC0NCIdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582748601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ynv1oNyMYgkoxVqCi0ddyvpKwvIuR7j8I9h3zGZGle4=; b=eF0jHFpYwQgxRElfHLdzxswx+zJb7zHwssMCiGT+6ZN7DGPaA8Tfrilw6OD3nEMT7e41quAySgAq/3lzIw2Xs2zTdmMJ7L0mAm9gBg7HEe2gqXpbg+VbtC9T8BfTV1ewjhKmhbNhn9/IdKoo0wrTWXs0/n+fO0HSM3G8ep0Kh7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582748600921299.18886791420664; Wed, 26 Feb 2020 12:23:20 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73Ca-0003lN-6L; Wed, 26 Feb 2020 20:22:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73CY-0003kZ-H8 for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:22:38 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b5c99f1c-58d5-11ea-aba8-bc764e2007e4; Wed, 26 Feb 2020 20:22:29 +0000 (UTC) X-Inumbo-ID: b5c99f1c-58d5-11ea-aba8-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582748548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mp3vTSIoidrYCPhEDJh/tjnLRnewseoGxmOw08frHcw=; b=MTZ7PpI89AApJug9ufrGP1CpJtsXRQLipeb2VQe3juUHqY132ohMITcQ QDshWLc7OjPjPgw7IegwOJbmFzvn7nfnQfdx3dW+drAkneMG9bGEoM8Eq 4LLRkFyVHbiVajjJShzLuKM3pXVczRK9p+kTuOKVWWyHqe2n5Z6v+TGqI Y=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: AejszfvZE+XcYYqkqYKwVEOkhLUKIu8VPp0jacGP93nLGHeLOVlsxKbdlf3R7CC1SKGQkIH2lK +FWzux0Hr+M8P2TAwyXOSN47OTI533kvvJPFauRHbIsh8rXiJixjnTv18doDDhIgRmE6+YuNu3 ugAXVpbf2CUmK9upAJ6STALnJ+d0I696/mjmD5Qzwyd9Cnr0U+HHrItQsY/qaW5enJYkFDM9/d mEJQr5yoIoDVihE2Jdi09Usey4rD56cJK8iR1Ni04/F4LqNxEoA78Noj6W4i9uh0R/xPYhRKHk AXw= X-SBRS: 2.7 X-MesageID: 13496575 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,489,1574139600"; d="scan'208";a="13496575" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:20 +0000 Message-ID: <20200226202221.6555-10-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 09/10] x86/gen-cpuid: Distinguish default vs max in feature annotations 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Allow lowercase a/s/h to be used to annotate a non-default feature. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/include/public/arch-x86/cpufeatureset.h | 2 ++ xen/tools/gen-cpuid.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/publ= ic/arch-x86/cpufeatureset.h index 086736ac7b..d79a53befe 100644 --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -87,6 +87,8 @@ enum { * 'A' =3D All guests. * 'S' =3D All HVM guests (not PV guests). * 'H' =3D HVM HAP guests (not PV or HVM Shadow guests). + * Upper case =3D> Available by default + * Lower case =3D> Can be opted-in to, but not available by default. */ =20 /* Intel-defined CPU features, CPUID level 0x00000001.edx, word 0 */ diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index af5610a5e6..c178e2470d 100755 --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -23,6 +23,7 @@ def __init__(self, input, output): self.raw =3D { '!': set(), 'A': set(), 'S': set(), 'H': set(), + 'a': set(), 's': set(), 'h': set(), } =20 # State calculated @@ -133,9 +134,9 @@ def crunch_numbers(state): state.hvm_shadow_def =3D state.pv_def | state.raw['S'] state.hvm_hap_def =3D state.hvm_shadow_def | state.raw['H'] =20 - state.pv_max =3D state.pv_def - state.hvm_shadow_max =3D state.hvm_shadow_def - state.hvm_hap_max =3D state.hvm_hap_def + state.pv_max =3D state.raw['A'] | state.raw['a'] + state.hvm_shadow_max =3D state.pv_max | state.raw['S'] | state.raw['s'] + state.hvm_hap_max =3D state.hvm_shadow_max | state.raw['H'] | state.ra= w['h'] =20 # # Feature dependency information. --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 10:33:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582749702; cv=none; d=zohomail.com; s=zohoarc; b=YS620fycGY9cuVCtPE0xVR1xonu5VVrx05bYZcbvAKBS1biez2Qq9piUR5L7eMxYB8xjgvCuMqAe7CHnKmDbXzqYHChrUJDBSRdFcoUF7EwbbjbdRzMrLKJlL6GLOhfcgDaqd4M5fbQ3zd6nb3BX6ONDrK9sUJHqXcyu2GXIYk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582749702; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w1yNB+bLBsBJRzJ43T1Q/XiaV9Ed7IkXWM9HGhNiNdw=; b=HVAis3bG3SSjsne/GpQqWhkNCBkneHpSpMLfnvCmXSkP8YYWZrnM7qHf/nwLLAKGHxs6haY+SjloXP35ygjDpGxJ9IFCzjZkS9kYXWZmXw928YILYiki29MIa+ctzPFmw+UiXXW+aIgtGQASV9PPQDsZH2vLqBXAvhfEgpbvi14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582749702837278.422228639908; Wed, 26 Feb 2020 12:41:42 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73UJ-0006GR-H5; Wed, 26 Feb 2020 20:40:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j73UI-0006GM-0K for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 20:40:58 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4a39c80a-58d8-11ea-aba8-bc764e2007e4; Wed, 26 Feb 2020 20:40:57 +0000 (UTC) X-Inumbo-ID: 4a39c80a-58d8-11ea-aba8-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582749658; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3A6C+slDIap39lOyKntHKT/oQQ4U44jo7cKANNasDaU=; b=hBp3eyK5JDGqe7ibsJ7tg6WZ/aFmjkVuv7Fx2PEZMw+YnSFmWp6/TJPh EIhtUFhZDLP3VtRyysEbCgryc1jHM6v3xuvrCaAsa451AD+U9UGDxCs3I jK0CLoUnoNcYNzkKJp6/tdZ8j76TdWDKcctraB5Po7SH5YqwH0UBEg0Zv E=; 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 (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: acbNF4Ih7r8GpkE1RZd8C6ijdRokbYvYOcT1rG1bnjL/4luuE88b6SoMvFAreaZdGGkXfOOcUn gblpcZyoIoug4lqr8A4xm12KnbDm9OvZBWPC3eUTs3Tbp3utGj5IhEEAeoxOPKHALbqh/4Im29 7UENCrvPVnAn1aYllBhErFLQCAI7F3S604NOlgt0xEk8iGOj9CZ26W4JsYAnboPxM9hZ01EyRa 93QKjOtIHCI7F62s5R/pnceidfbczrXUiZFX0rxhiBeSZYyJ2vm2ZD5e5P1RwXRK4QooY4gQfC FM0= X-SBRS: 2.7 X-MesageID: 13072842 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,489,1574139600"; d="scan'208";a="13072842" From: Andrew Cooper To: Xen-devel Date: Wed, 26 Feb 2020 20:22:21 +0000 Message-ID: <20200226202221.6555-11-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200226202221.6555-1-andrew.cooper3@citrix.com> References: <20200226202221.6555-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 10/10] x86/hvm: Do not enable MPX by default 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Memory Protection eXtension support has been dropped from GCC and Linux, and will be dropped from future Intel CPUs. With all other default/max pieces in place, move MPX from default to max. This means that VMs won't be offered it by default, but can explicitly opt into using it via cpuid=3D"host,mpx=3D1" in their vm.cfg file. The difference as visible to the guest is: diff --git a/default b/mpx index 0e91765d6b..c8c33cd584 100644 --- a/default +++ b/mpx @@ -13,15 +13,17 @@ Native cpuid: 00000004:00000004 -> 00000000:00000000:00000000:00000000 00000005:ffffffff -> 00000000:00000000:00000000:00000000 00000006:ffffffff -> 00000000:00000000:00000000:00000000 - 00000007:00000000 -> 00000000:009c2fbb:00000000:9c000400 + 00000007:00000000 -> 00000000:009c6fbb:00000000:9c000400 00000008:ffffffff -> 00000000:00000000:00000000:00000000 00000009:ffffffff -> 00000000:00000000:00000000:00000000 0000000a:ffffffff -> 00000000:00000000:00000000:00000000 0000000b:ffffffff -> 00000000:00000000:00000000:00000000 0000000c:ffffffff -> 00000000:00000000:00000000:00000000 - 0000000d:00000000 -> 00000007:00000240:00000340:00000000 + 0000000d:00000000 -> 0000001f:00000240:00000440:00000000 0000000d:00000001 -> 0000000f:00000240:00000000:00000000 0000000d:00000002 -> 00000100:00000240:00000000:00000000 + 0000000d:00000003 -> 00000040:000003c0:00000000:00000000 + 0000000d:00000004 -> 00000040:00000400:00000000:00000000 40000000:ffffffff -> 40000005:566e6558:65584d4d:4d4d566e 40000001:ffffffff -> 0004000e:00000000:00000000:00000000 40000002:ffffffff -> 00000001:40000000:00000000:00000000 Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 XXX - One moving piece (the migration series) is still in review on xen-dev= el. I won't commit this change until that is sorted, and I can double check the backwards compatibility for VMs from previous versions of Xen. The main purpose of posting this patch now is to illustrate the effects of = the previous patches in the series. --- xen/include/public/arch-x86/cpufeatureset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/publ= ic/arch-x86/cpufeatureset.h index d79a53befe..81e4c2950f 100644 --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -207,7 +207,7 @@ XEN_CPUFEATURE(INVPCID, 5*32+10) /*H Invalidate = Process Context ID */ XEN_CPUFEATURE(RTM, 5*32+11) /*A Restricted Transactional Memor= y */ XEN_CPUFEATURE(PQM, 5*32+12) /* Platform QoS Monitoring */ XEN_CPUFEATURE(NO_FPU_SEL, 5*32+13) /*! FPU CS/DS stored as zero */ -XEN_CPUFEATURE(MPX, 5*32+14) /*S Memory Protection Extensions */ +XEN_CPUFEATURE(MPX, 5*32+14) /*s Memory Protection Extensions */ XEN_CPUFEATURE(PQE, 5*32+15) /* Platform QoS Enforcement */ XEN_CPUFEATURE(AVX512F, 5*32+16) /*A AVX-512 Foundation Instruction= s */ XEN_CPUFEATURE(AVX512DQ, 5*32+17) /*A AVX-512 Doubleword & Quadword = Instrs */ --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel