Received: by 10.223.176.46 with SMTP id f43csp1034211wra; Fri, 26 Jan 2018 10:43:12 -0800 (PST) X-Google-Smtp-Source: AH8x225Rswp3Qj2bJW1bn6e9gW/aiiqH/VUTB/VknREXluUvb+nuwGcjBWcvBqxQWl3MU0EUTdGT X-Received: by 2002:a17:902:768b:: with SMTP id m11-v6mr14635504pll.50.1516992192496; Fri, 26 Jan 2018 10:43:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516992192; cv=none; d=google.com; s=arc-20160816; b=tVwwAVQHH4KLYaZ7aRnHi84Kofl5ZFVnQ3Ld23hnyQxXIzJOKbrMj1hUcsyOQPsbL2 O/PlWvJ40PK5SK9w7uePT34ePm6SNMKYmz8y8k4V7RFOB6FzbT0ebdIPvxBAJtTKhJ3P eaygsYzg8hCR9CtVwEWc31p9NTtvQaOdaQONw5fJRZCmZak95mnHS/yOqZcgjXNM/Bj5 gtHYvJaiFNSaXWaWzxy+3mi1M7Dgwm5hL3QB6mrH11IiQogOrtwbpTDm9+cOvVQENqun MtFkxZ1mdXEfu64Em8NSaZpLl9jDNMEwYbr0LdWZfiOkBJu851FrY+8pD1lgyTgVFmeU UuAQ== 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:arc-authentication-results; bh=Rre45Kw37hHP60Ex75iYQKeCBsQDnrV/a7X3y+L2J/s=; b=swb0MjjnUkBHbvmcPkVd/Q647GJVcykmVVHYLg9Y0ZYWmjfMyudbbvNOGJET4OUIff ibySFETSVprJOV/57ntEGL82x0y3gdnxIkrgN0TI1UMaF9XscVRzxnk0zDO23IsK0JcT 4dTZOam8+MUCQGGgwIuOWUndTb8l28G36RAcqeOoPrQxicr/IddMGGi+hOZJm33HQ30f M2bsNBTW5oxmm3Jicve5Ef1IyH7GQyawcvRdqJuE4Q4Gi+Cj9gIYJ+SMVtd7mpx1tPgb 18xg2wclyI4OjJy9RbyaTJepAowQXQEK5CO64CaRYkYYIGrdEi7F2tMMNsxYD+nP893S jx5g== ARC-Authentication-Results: i=1; mx.google.com; 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 x1si6745695pfh.381.2018.01.26.10.42.46; Fri, 26 Jan 2018 10:43:12 -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; 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 S1752218AbeAZSly (ORCPT + 99 others); Fri, 26 Jan 2018 13:41:54 -0500 Received: from mail.skyhub.de ([5.9.137.197]:44468 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752138AbeAZSlw (ORCPT ); Fri, 26 Jan 2018 13:41:52 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yMS7KH80kj9M; Fri, 26 Jan 2018 19:41:50 +0100 (CET) Received: from pd.tnic (p200300EC2BCF3A0024194793E6CFFC7A.dip0.t-ipconnect.de [IPv6:2003:ec:2bcf:3a00:2419:4793:e6cf:fc7a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 8607E1EC00A7; Fri, 26 Jan 2018 19:41:50 +0100 (CET) Date: Fri, 26 Jan 2018 19:41:39 +0100 From: Borislav Petkov To: x86-ml Cc: linux-tip-commits@vger.kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, tglx@linutronix.de, dwmw@amazon.co.uk, thomas.lendacky@amd.com, linux-kernel@vger.kernel.org, mingo@kernel.org Subject: [PATCH] x86/cpufeatures: Cleanup AMD speculation feature bits Message-ID: <20180126184139.rcfbtk7dvj7kmyfn@pd.tnic> References: <1516896855-7642-4-git-send-email-dwmw@amazon.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 On Fri, Jan 26, 2018 at 07:00:30AM -0800, tip-bot for David Woodhouse wrote: > +#define X86_FEATURE_AMD_PRED_CMD (13*32+12) /* Prediction Command MSR (AMD) */ > +#define X86_FEATURE_AMD_SPEC_CTRL (13*32+14) /* Speculation Control MSR only (AMD) */ > +#define X86_FEATURE_AMD_STIBP (13*32+15) /* Single Thread Indirect Branch Predictors (AMD) */ Let's clean those up before it hits upstream. Tom, scream if something's still wrong. Thx. --- From 41fa030b09992b097c6b57d69eebad4f07e228c4 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Fri, 26 Jan 2018 19:07:39 +0100 Subject: [PATCH] x86/cpufeatures: Cleanup AMD speculation feature bits X86_FEATURE_AMD_PRED_CMD -> X86_FEATURE_AMD_IBPB That is the preferred name. Also, hide it in /proc/cpuinfo as we're setting a vendor-agnostic X86_FEATURE_IBPB one. X86_FEATURE_AMD_SPEC_CTRL -> X86_FEATURE_IBRS On AMD that's only the IBRS control bit. Also, have X86_FEATURE_AMD_STIBP appear as "stibp" only in /proc/cpuinfo, as Intel's feature does. Signed-off-by: Borislav Petkov --- arch/x86/include/asm/cpufeatures.h | 6 +++--- arch/x86/kernel/cpu/bugs.c | 2 +- arch/x86/kernel/cpu/intel.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 40f92eff09df..6c6d862d66a1 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -272,9 +272,9 @@ #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ #define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ #define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ -#define X86_FEATURE_AMD_PRED_CMD (13*32+12) /* Prediction Command MSR (AMD) */ -#define X86_FEATURE_AMD_SPEC_CTRL (13*32+14) /* Speculation Control MSR only (AMD) */ -#define X86_FEATURE_AMD_STIBP (13*32+15) /* Single Thread Indirect Branch Predictors (AMD) */ +#define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier MSR */ +#define X86_FEATURE_IBRS (13*32+14) /* Indirect Branch Restricted Speculation */ +#define X86_FEATURE_AMD_STIBP (13*32+15) /* "stibp" Single Thread Indirect Branch Predictors */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index c988a8acb0d5..be068aea6bda 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -266,7 +266,7 @@ static void __init spectre_v2_select_mitigation(void) /* Initialize Indirect Branch Prediction Barrier if supported */ if (boot_cpu_has(X86_FEATURE_SPEC_CTRL) || - boot_cpu_has(X86_FEATURE_AMD_PRED_CMD)) { + boot_cpu_has(X86_FEATURE_AMD_IBPB)) { setup_force_cpu_cap(X86_FEATURE_IBPB); pr_info("Enabling Indirect Branch Prediction Barrier\n"); } diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 7a3d216875fc..30d13afe726b 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -177,14 +177,14 @@ static void early_init_intel(struct cpuinfo_x86 *c) if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) || cpu_has(c, X86_FEATURE_STIBP) || - cpu_has(c, X86_FEATURE_AMD_SPEC_CTRL) || - cpu_has(c, X86_FEATURE_AMD_PRED_CMD) || + cpu_has(c, X86_FEATURE_IBRS) || + cpu_has(c, X86_FEATURE_AMD_IBPB) || cpu_has(c, X86_FEATURE_AMD_STIBP)) && bad_spectre_microcode(c)) { pr_warn("Intel Spectre v2 broken microcode detected; disabling SPEC_CTRL\n"); clear_cpu_cap(c, X86_FEATURE_SPEC_CTRL); clear_cpu_cap(c, X86_FEATURE_STIBP); - clear_cpu_cap(c, X86_FEATURE_AMD_SPEC_CTRL); - clear_cpu_cap(c, X86_FEATURE_AMD_PRED_CMD); + clear_cpu_cap(c, X86_FEATURE_IBRS); + clear_cpu_cap(c, X86_FEATURE_AMD_IBPB); clear_cpu_cap(c, X86_FEATURE_AMD_STIBP); } -- 2.13.0 -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.