From patchwork Thu Mar 16 16:31:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9628961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B1AC2604AA for ; Thu, 16 Mar 2017 16:34:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3BAE2860C for ; Thu, 16 Mar 2017 16:34:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97EC3285EE; Thu, 16 Mar 2017 16:34:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1BD6628604 for ; Thu, 16 Mar 2017 16:34:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coYJe-00047F-K8; Thu, 16 Mar 2017 16:31:54 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coYJd-00046U-0S for xen-devel@lists.xen.org; Thu, 16 Mar 2017 16:31:53 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id E2/0C-16497-8FDBAC85; Thu, 16 Mar 2017 16:31:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrrBXvf73lM RBlvXG1os+biYxYHR4+ju30wBjFGsmXlJ+RUJrBn7OmwLFlpWPD54kKmB8a5+FyMnh4SAv8Tj /ivsIDabgL7E7hefmEBsEQF1idMdF1m7GDk4mAX8JA498AUJCwOZ/b23WUFsFgFVicbD7WDlv AKeEl9/X2aGGCkncf74TzCbU8BL4uvUf2DjhYBqdj/dwghhq0lc67/EDtErKHFy5hMWEJtZQE Li4IsXzBMYeWchSc1CklrAyLSKUaM4tagstUjXyEIvqSgzPaMkNzEzR9fQwFQvN7W4ODE9NSc xqVgvOT93EyMwcOoZGBh3MPat8jvEKMnBpCTKqyJ4IkKILyk/pTIjsTgjvqg0J7X4EKMMB4eS BO+XI0A5waLU9NSKtMwcYAjDpCU4eJREeM+ApHmLCxJzizPTIVKnGHU55sze/YZJiCUvPy9VS pz3EUiRAEhRRmke3AhYPF1ilJUS5mVkYGAQ4ilILcrNLEGVf8UozsGoJMy7HGQKT2ZeCdymV0 BHMAEdkfjzCMgRJYkIKakGxsBdbLf+9nD/0Fjk+OXRqbuLGNJXZMw+cNbjZn/LsQOvDWewHfz 7e5L5or1q26PM5Q9sfbMieh53y9NcU7WH4VfE3Lze/+n3SmTKfZq56sCXBXmcZ2cWLs9nX5PG 99Yjz9xd7c9Nh2ve9dE8orfUg5cub/3tWnZ+kpkUn/W/L5YqKa5Ca3597FNiKc5INNRiLipOB ACFDo/CogIAAA== X-Env-Sender: prvs=241e21db1=Andrew.Cooper3@citrix.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1489681909!89826336!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64896 invoked from network); 16 Mar 2017 16:31:51 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 16 Mar 2017 16:31:51 -0000 X-IronPort-AV: E=Sophos;i="5.36,173,1486425600"; d="scan'208";a="423037271" From: Andrew Cooper To: Xen-devel Date: Thu, 16 Mar 2017 16:31:35 +0000 Message-ID: <1489681903-28119-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1489681903-28119-1-git-send-email-andrew.cooper3@citrix.com> References: <1489681903-28119-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH v2 1/9] x86/cpuid: Sort cpu_has_* predicates by feature number X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich v2: * New --- xen/include/asm-x86/cpufeature.h | 117 ++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 51 deletions(-) diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h index b3d613f..5978783 100644 --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -29,65 +29,80 @@ #define CPUID_PM_LEAF 6 #define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1 -#define cpu_has_fpu 1 -#define cpu_has_de 1 -#define cpu_has_pse 1 -#define cpu_has_pge 1 -#define cpu_has_pat 1 -#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) -#define cpu_has_sep boot_cpu_has(X86_FEATURE_SEP) -#define cpu_has_mtrr 1 -#define cpu_has_mmx 1 -#define cpu_has_sse3 boot_cpu_has(X86_FEATURE_SSE3) -#define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3) -#define cpu_has_sse4_1 boot_cpu_has(X86_FEATURE_SSE4_1) -#define cpu_has_sse4_2 boot_cpu_has(X86_FEATURE_SSE4_2) -#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ) -#define cpu_has_popcnt boot_cpu_has(X86_FEATURE_POPCNT) -#define cpu_has_aesni boot_cpu_has(X86_FEATURE_AESNI) -#define cpu_has_htt boot_cpu_has(X86_FEATURE_HTT) -#define cpu_has_nx boot_cpu_has(X86_FEATURE_NX) -#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH) -#define cpu_has_page1gb boot_cpu_has(X86_FEATURE_PAGE1GB) -#define cpu_has_fsgsbase boot_cpu_has(X86_FEATURE_FSGSBASE) -#define cpu_has_aperfmperf boot_cpu_has(X86_FEATURE_APERFMPERF) -#define cpu_has_smep boot_cpu_has(X86_FEATURE_SMEP) -#define cpu_has_smap boot_cpu_has(X86_FEATURE_SMAP) -#define cpu_has_fpu_sel (!boot_cpu_has(X86_FEATURE_NO_FPU_SEL)) -#define cpu_has_ffxsr ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) \ - && boot_cpu_has(X86_FEATURE_FFXSR)) -#define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) +/* CPUID level 0x00000001.edx */ +#define cpu_has_fpu 1 +#define cpu_has_de 1 +#define cpu_has_pse 1 +#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) +#define cpu_has_sep boot_cpu_has(X86_FEATURE_SEP) +#define cpu_has_mtrr 1 +#define cpu_has_pge 1 +#define cpu_has_pat 1 +#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH) +#define cpu_has_mmx 1 +#define cpu_has_htt boot_cpu_has(X86_FEATURE_HTT) + +/* CPUID level 0x00000001.ecx */ +#define cpu_has_sse3 boot_cpu_has(X86_FEATURE_SSE3) +#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ) +#define cpu_has_monitor boot_cpu_has(X86_FEATURE_MONITOR) +#define cpu_has_vmx boot_cpu_has(X86_FEATURE_VMX) +#define cpu_has_eist boot_cpu_has(X86_FEATURE_EIST) +#define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3) +#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16) +#define cpu_has_pdcm boot_cpu_has(X86_FEATURE_PDCM) #define cpu_has_pcid boot_cpu_has(X86_FEATURE_PCID) +#define cpu_has_sse4_1 boot_cpu_has(X86_FEATURE_SSE4_1) +#define cpu_has_sse4_2 boot_cpu_has(X86_FEATURE_SSE4_2) +#define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) +#define cpu_has_popcnt boot_cpu_has(X86_FEATURE_POPCNT) +#define cpu_has_aesni boot_cpu_has(X86_FEATURE_AESNI) #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE) #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX) +#define cpu_has_rdrand boot_cpu_has(X86_FEATURE_RDRAND) +#define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR) + +/* CPUID level 0x80000001.edx */ +#define cpu_has_nx boot_cpu_has(X86_FEATURE_NX) +#define cpu_has_ffxsr ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) \ + && boot_cpu_has(X86_FEATURE_FFXSR)) +#define cpu_has_page1gb boot_cpu_has(X86_FEATURE_PAGE1GB) +#define cpu_has_rdtscp boot_cpu_has(X86_FEATURE_RDTSCP) + +/* CPUID level 0x80000001.ecx */ +#define cpu_has_cmp_legacy boot_cpu_has(X86_FEATURE_CMP_LEGACY) +#define cpu_has_svm boot_cpu_has(X86_FEATURE_SVM) +#define cpu_has_sse4a boot_cpu_has(X86_FEATURE_SSE4A) #define cpu_has_lwp boot_cpu_has(X86_FEATURE_LWP) +#define cpu_has_tbm boot_cpu_has(X86_FEATURE_TBM) + +/* CPUID level 0x0000000D:1.eax */ +#define cpu_has_xsaveopt boot_cpu_has(X86_FEATURE_XSAVEOPT) +#define cpu_has_xsavec boot_cpu_has(X86_FEATURE_XSAVEC) +#define cpu_has_xgetbv1 boot_cpu_has(X86_FEATURE_XGETBV1) +#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES) + +/* CPUID level 0x00000007:0.ebx */ +#define cpu_has_fsgsbase boot_cpu_has(X86_FEATURE_FSGSBASE) #define cpu_has_bmi1 boot_cpu_has(X86_FEATURE_BMI1) +#define cpu_has_hle boot_cpu_has(X86_FEATURE_HLE) +#define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2) +#define cpu_has_smep boot_cpu_has(X86_FEATURE_SMEP) #define cpu_has_bmi2 boot_cpu_has(X86_FEATURE_BMI2) +#define cpu_has_rtm boot_cpu_has(X86_FEATURE_RTM) +#define cpu_has_fpu_sel (!boot_cpu_has(X86_FEATURE_NO_FPU_SEL)) #define cpu_has_mpx boot_cpu_has(X86_FEATURE_MPX) +#define cpu_has_rdseed boot_cpu_has(X86_FEATURE_RDSEED) +#define cpu_has_smap boot_cpu_has(X86_FEATURE_SMAP) +#define cpu_has_sha boot_cpu_has(X86_FEATURE_SHA) + +/* CPUID level 0x80000007.edx */ +#define cpu_has_itsc boot_cpu_has(X86_FEATURE_ITSC) + +/* Synthesized. */ #define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON) -#define cpu_has_rdtscp boot_cpu_has(X86_FEATURE_RDTSCP) -#define cpu_has_svm boot_cpu_has(X86_FEATURE_SVM) -#define cpu_has_vmx boot_cpu_has(X86_FEATURE_VMX) -#define cpu_has_cpuid_faulting boot_cpu_has(X86_FEATURE_CPUID_FAULTING) -#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16) -#define cpu_has_xsaveopt boot_cpu_has(X86_FEATURE_XSAVEOPT) -#define cpu_has_xsavec boot_cpu_has(X86_FEATURE_XSAVEC) -#define cpu_has_xgetbv1 boot_cpu_has(X86_FEATURE_XGETBV1) -#define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES) -#define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2) -#define cpu_has_monitor boot_cpu_has(X86_FEATURE_MONITOR) -#define cpu_has_eist boot_cpu_has(X86_FEATURE_EIST) -#define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR) -#define cpu_has_rdrand boot_cpu_has(X86_FEATURE_RDRAND) -#define cpu_has_rdseed boot_cpu_has(X86_FEATURE_RDSEED) -#define cpu_has_cmp_legacy boot_cpu_has(X86_FEATURE_CMP_LEGACY) -#define cpu_has_sse4a boot_cpu_has(X86_FEATURE_SSE4A) -#define cpu_has_tbm boot_cpu_has(X86_FEATURE_TBM) -#define cpu_has_itsc boot_cpu_has(X86_FEATURE_ITSC) -#define cpu_has_hle boot_cpu_has(X86_FEATURE_HLE) -#define cpu_has_rtm boot_cpu_has(X86_FEATURE_RTM) -#define cpu_has_pdcm boot_cpu_has(X86_FEATURE_PDCM) -#define cpu_has_sha boot_cpu_has(X86_FEATURE_SHA) +#define cpu_has_cpuid_faulting boot_cpu_has(X86_FEATURE_CPUID_FAULTING) +#define cpu_has_aperfmperf boot_cpu_has(X86_FEATURE_APERFMPERF) enum _cache_type { CACHE_TYPE_NULL = 0,