Received: by 10.223.176.46 with SMTP id f43csp1688895wra; Sun, 21 Jan 2018 02:18:14 -0800 (PST) X-Google-Smtp-Source: AH8x225D6y8XApcPs1huQ/dh5tjIEo16lRnB5z00kAn9DZ2oliRjjbxX3lE9672TcndHqfDcX+AW X-Received: by 10.98.11.218 with SMTP id 87mr4745668pfl.99.1516529894456; Sun, 21 Jan 2018 02:18:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516529894; cv=none; d=google.com; s=arc-20160816; b=lGc+f/ILSSgl/ADRhA8AxOApj0ocvMGmijE3FqzebFODE0opyO1j6OWujjD197zf1F 1QWJpyeqJYAYPEnw5b82KdAzQWQKeDy9nZu51XAQoSflO+xiU1cwifmYgi4t9GB6HVzv LwBKXaEGbBuZJwa57MkZMsjmayvnSjQ9kROqVaAmKBwWzvNVEUDUXqj1Vfajtgx3+K2w cdeI0vSWko7XVZ1+5oaBUDvUGfqjRb1ZeopXwX81Mq4Nw8z+CL5rHveFvg9ZIcYhd+73 T6WPe+ZdKkdCIUBZT0ZpRC8LL5NFNqgAHri2vudIe9umrqF7DFKwNRopqkpjAjUEXSFt +NQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=e94U7bY0yFu1NMiK4Bstg/mKudGgC4z6QcODbRfUcw0=; b=AvRl4Ck/JAw73b1cLzfiPjghB78ZWNlEWv+sTwgs2tYkPvd8DLJFzXS0xY7ebd5QQB 0Nxh7RAHNtYRU7lv3TfopLy3D8qVYW1+qY0RrqmaErB2aOe4WxqAgpijMrR1hyBmQu4x 3Em3+wMGs8ijJ6RZddFlMbJ5gbsVirJyXjcg0I5tRo/cao1ZHr97gKwTqcW8lbxaZP4I NccKnmU80AzUtgV5N6s0Zk4Lpa0MI6ACHM+E2v/r8EfzANL6KaIhLuEvEay0JZADVpgw 6+hN6BaFLKfYm1hlzDBIXccSaq+b9rywH8IkhyGxm6Ux6Ut6cyhmP5kddg8sc2Qos82H ZK+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=nRDlFk86; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i78si13287168pfi.150.2018.01.21.02.17.49; Sun, 21 Jan 2018 02:18:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=nRDlFk86; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751107AbeAUKRT (ORCPT + 99 others); Sun, 21 Jan 2018 05:17:19 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:41041 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750911AbeAUKRS (ORCPT ); Sun, 21 Jan 2018 05:17:18 -0500 Received: by mail-wr0-f194.google.com with SMTP id v15so2621026wrb.8 for ; Sun, 21 Jan 2018 02:17:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=e94U7bY0yFu1NMiK4Bstg/mKudGgC4z6QcODbRfUcw0=; b=nRDlFk86zuZJ9iNduexl7MbxhvxRWQ8Y6zUGOzZSHfidFCvfMc9MCW9mYy0PBs5DJ+ SW91Lm1RMqOuDewFgpRcq6WzkKUZzm0hA3PPLC7FjDFtZ9/GYYjneJPwuuHEGDrJ4Q+B fA0h3CKjMr3Ma9DK1klDnDG5MxJIhNOrmwCP+aDqQXrwZN50IjVaDwjqLe7XDsUUVVC9 tLLz1mgdMeOWHdR6Yzy3h7UsUWupBVXPa7c+wj6bZgcp94BsMrDZBFoXBxcjVCLJIA6p wzo94+0tLhH5AyLiTEtC3XSVAI3rEkyCgARUjatPZI0AVBsyTHTnHHJoYPr5oqVIzVAS 0CdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=e94U7bY0yFu1NMiK4Bstg/mKudGgC4z6QcODbRfUcw0=; b=N/SoRDEUTnZWq46Vqo2uYFOdlLNk7XV2t6W7q283klwpyebBpO9YZZwYHrvIGlN6l5 40XaTVLYMa3UsW/Mb+Qc5yBsn/x+okbm+GWiP7M49Iklw52B6x/WR4qnIpCbtGU9k0EF 1SNzO/sCRW4fmTb1sKtrAUm0SQlPGSphYyOut/Q5KbGIPQxhVxGVtVsi1ym1+AqAyYg+ Fq6RHu5t969u5ON6/WnGx5TBZpQeE1pbDwXNObgyl7XRW/t1fhlxGMGXCANy2dItwr9j +CAuXw/VJPlhdpxkM9Z7wYJTVhgc1W4q3CO70Nh4wDdYubQ1Yaw52NuX9IXQyf3izXsV 6IIA== X-Gm-Message-State: AKwxytdUnbOQkOQcCwHJ15thhpg8dqE0n4LYhlNi3G9Gj73wQ9GCYdZJ okr0Bodxs2ZuXL2FCLIAn0s= X-Received: by 10.223.166.170 with SMTP id t39mr3379934wrc.106.1516529836623; Sun, 21 Jan 2018 02:17:16 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id 67sm2156705wmg.13.2018.01.21.02.17.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Jan 2018 02:17:15 -0800 (PST) Date: Sun, 21 Jan 2018 11:17:13 +0100 From: Ingo Molnar To: David Woodhouse Cc: arjan@linux.intel.com, tglx@linutronix.de, karahmed@amazon.de, x86@kernel.org, linux-kernel@vger.kernel.org, tim.c.chen@linux.intel.com, bp@alien8.de, peterz@infradead.org, pbonzini@redhat.com, ak@linux.intel.com, torvalds@linux-foundation.org, gregkh@linux-foundation.org Subject: Re: [PATCH v2 1/8] x86/cpufeatures: Add Intel feature bits for Speculation Control Message-ID: <20180121101713.wous65j5df6kqqku@gmail.com> References: <1516528149-9370-1-git-send-email-dwmw@amazon.co.uk> <1516528149-9370-2-git-send-email-dwmw@amazon.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516528149-9370-2-git-send-email-dwmw@amazon.co.uk> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * David Woodhouse wrote: > Add three feature bits exposed by new microcode on Intel CPUs for > speculation control. We would now be up to five bits in CPUID(7).RDX > so take them out of the 'scattered' features and make a proper word > for them instead as that leaf is a pure feature bits leaf. > > [bp: heckle commitlog] > Signed-off-by: David Woodhouse > Reviewed-by: Borislav Petkov > --- > arch/x86/include/asm/cpufeature.h | 7 +++++-- > arch/x86/include/asm/cpufeatures.h | 12 +++++++++--- > arch/x86/include/asm/disabled-features.h | 3 ++- > arch/x86/include/asm/required-features.h | 3 ++- > arch/x86/kernel/cpu/common.c | 1 + > arch/x86/kernel/cpu/scattered.c | 2 -- > 6 files changed, 19 insertions(+), 9 deletions(-) > > diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h > index ea9a7dd..70eddb3 100644 > --- a/arch/x86/include/asm/cpufeature.h > +++ b/arch/x86/include/asm/cpufeature.h > @@ -29,6 +29,7 @@ enum cpuid_leafs > CPUID_8000_000A_EDX, > CPUID_7_ECX, > CPUID_8000_0007_EBX, > + CPUID_7_EDX, > }; > > #ifdef CONFIG_X86_FEATURE_NAMES > @@ -79,8 +80,9 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; > CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 15, feature_bit) || \ > CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 16, feature_bit) || \ > CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 17, feature_bit) || \ > + CHECK_BIT_IN_MASK_WORD(REQUIRED_MASK, 18, feature_bit) || \ > REQUIRED_MASK_CHECK || \ > - BUILD_BUG_ON_ZERO(NCAPINTS != 18)) > + BUILD_BUG_ON_ZERO(NCAPINTS != 19)) > > #define DISABLED_MASK_BIT_SET(feature_bit) \ > ( CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 0, feature_bit) || \ > @@ -101,8 +103,9 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; > CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 15, feature_bit) || \ > CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 16, feature_bit) || \ > CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 17, feature_bit) || \ > + CHECK_BIT_IN_MASK_WORD(DISABLED_MASK, 18, feature_bit) || \ > DISABLED_MASK_CHECK || \ > - BUILD_BUG_ON_ZERO(NCAPINTS != 18)) > + BUILD_BUG_ON_ZERO(NCAPINTS != 19)) > > #define cpu_has(c, bit) \ > (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ > diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h > index 25b9375..2efb8d4 100644 > --- a/arch/x86/include/asm/cpufeatures.h > +++ b/arch/x86/include/asm/cpufeatures.h > @@ -13,7 +13,7 @@ > /* > * Defines x86 CPU feature bits > */ > -#define NCAPINTS 18 /* N 32-bit words worth of info */ > +#define NCAPINTS 19 /* N 32-bit words worth of info */ > #define NBUGINTS 1 /* N 32-bit bug flags */ > > /* > @@ -206,8 +206,6 @@ > #define X86_FEATURE_RETPOLINE ( 7*32+12) /* Generic Retpoline mitigation for Spectre variant 2 */ > #define X86_FEATURE_RETPOLINE_AMD ( 7*32+13) /* AMD Retpoline mitigation for Spectre variant 2 */ > #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ > -#define X86_FEATURE_AVX512_4VNNIW ( 7*32+16) /* AVX-512 Neural Network Instructions */ > -#define X86_FEATURE_AVX512_4FMAPS ( 7*32+17) /* AVX-512 Multiply Accumulation Single precision */ > > #define X86_FEATURE_MBA ( 7*32+18) /* Memory Bandwidth Allocation */ > #define X86_FEATURE_RSB_CTXSW ( 7*32+19) /* Fill RSB on context switches */ > @@ -319,6 +317,14 @@ > #define X86_FEATURE_SUCCOR (17*32+ 1) /* Uncorrectable error containment and recovery */ > #define X86_FEATURE_SMCA (17*32+ 3) /* Scalable MCA */ > > +/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ > +#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ > +#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ > +#define X86_FEATURE_SPEC_CTRL (18*32+26) /* Speculation Control (IBRS + IBPB) */ > +#define X86_FEATURE_STIBP (18*32+27) /* Single Thread Indirect Branch Predictors */ > +#define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */ Ok, this patch should be split into at least two patches: - one extending the feature words from 18 to 19 and moving the two vector computing feature bits - a separate one adding the speculation control bits Thanks, Ingo