From nobody Mon Feb 9 17:06:42 2026 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