Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp692017imm; Fri, 1 Jun 2018 08:00:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKxMDdTKNGFmfdzj5/GnMxdmu4YgWhdxhrrSMRHnoP9BJnk+LjLRkyfmdsSvT+d6SLBWlGS X-Received: by 2002:a63:a60a:: with SMTP id t10-v6mr9159048pge.351.1527865251009; Fri, 01 Jun 2018 08:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527865250; cv=none; d=google.com; s=arc-20160816; b=ZT0ERvekC/28ROdjvhnlgces83e4adawIkB0ypWn9kOn36Rbm3TsHeG6niNf9pDOyF 0xh+8FAUlOYvL64JNqdGOivTDrtf86zM1bnBAUeXvbmvPR0jVqFWswLCbbI5D25bTpQh yGlrP18/P9S615TrWTkiFiTUDniYd5qkOURjLP8BiximD19ESQpkQ5thTCgZ7vOfF1+u +anPpC1ukEN7hfQ94RGlzeQ7PFXx0h0nDr2TZcZPrUtJBoKl3PzP/NJaFaXafA1LMwDQ Hy0oCa+EOQIcyUL1Zn+0INgysDdRj6IU3yLmjKbbIwDqSxt9SSLjwX99orCUmzGCHSWt gdCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=tBJmIWZ0Ho9smliQgwXlmMgDYRae9wRxd36DCUZ97Vw=; b=nygs0cb9+aYhmTiXUzP81ieUS6RrdepD8O7TfAo/A9njqtZ/ImVIaSen059qgrVbyq rIdUXgIqKJMlTncLnDS33AgKLqfY8nyJ3Wja51ceoS5LYVh9Sm2eQjtU7MPxIIH3IJwQ sycwBQ55sm8nb8BIfRpb09puB+3P7Q4mmTfV/ZpuJW+P8XnncMXJJOhOPNSZ8DXKmqtx QDLueh+a/qIgBfbh20xJyWBHf19TWki8foMaj95uS5KVJkba+P5qoKcoGs96SYEWsU3r InkNppLZFbHF15Q9JwhFy6wv/BycRvV1UU+YnBigFkk0cszvjPubAUft44bkaGmi9GlT WqPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=cRzxcV6I; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay5-v6si38735513plb.459.2018.06.01.08.00.35; Fri, 01 Jun 2018 08:00:50 -0700 (PDT) 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=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=cRzxcV6I; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbeFAPAB (ORCPT + 99 others); Fri, 1 Jun 2018 11:00:01 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:54454 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752468AbeFAO76 (ORCPT ); Fri, 1 Jun 2018 10:59:58 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w51EvVSc070004; Fri, 1 Jun 2018 14:59:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=tBJmIWZ0Ho9smliQgwXlmMgDYRae9wRxd36DCUZ97Vw=; b=cRzxcV6IYw4U0afAii0bShz2Ff5AkSIwRiaTtCHrCH07cjZ4tT0iFawIFNZzwDU2eAzC QSlNOcpA8xO2bQcfwNZaPmG6Q5YuPTJgbp0YHMVxyUGfBo8jqR4N7AwCq5BrzpDiyclM SlIBvzVXlcpFdOoNsEM9mZ4LBWacBnQ35r1VU78Kxe1LDphq/U2zWupXSxAhqnFJEv2M 72sZFLvwNP4PIv2rEBhrorngbjRZFUp8ewbhNQdDrujsnxnsz2mvwMICEYbT4BSwkrx2 5OX2s3EqASvVZqROqytPpH0kIxczrZ8P2TCRfEf2cgHUdYHhZAcA76C+rdAGahf88pxP IA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2janje589d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Jun 2018 14:59:25 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w51ExP6H015262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Jun 2018 14:59:25 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w51ExNEM010806; Fri, 1 Jun 2018 14:59:24 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 01 Jun 2018 07:59:23 -0700 Received: by char.us.oracle.com (Postfix, from userid 1000) id 309626A00C1; Fri, 1 Jun 2018 10:59:22 -0400 (EDT) From: Konrad Rzeszutek Wilk To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, tglx@linutronix.de, andrew.cooper3@citrix.com Cc: Konrad Rzeszutek Wilk , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , David Woodhouse , Tom Lendacky , Janakarajan Natarajan , Andy Lutomirski Subject: [PATCH v1 1/3] x86/bugs: Add AMD's variant of SSB_NO. Date: Fri, 1 Jun 2018 10:59:19 -0400 Message-Id: <20180601145921.9500-2-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20180601145921.9500-1-konrad.wilk@oracle.com> References: <20180601145921.9500-1-konrad.wilk@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8911 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806010174 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The AMD document outlining the SSBD handling 124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf mentions that the CPUID 8000_0008.EBX[26] will mean that the speculative store bypass disable is no longer needed. A copy of this document is available at https://bugzilla.kernel.org/show_bug.cgi?id=199889 Signed-off-by: Konrad Rzeszutek Wilk --- Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Borislav Petkov Cc: David Woodhouse Cc: Konrad Rzeszutek Wilk Cc: Tom Lendacky Cc: Janakarajan Natarajan Cc: Andy Lutomirski --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/common.c | 3 ++- arch/x86/kvm/cpuid.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index fb00a2fca990..b6d7ce32927a 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -283,6 +283,7 @@ #define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ #define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ #define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */ +#define X86_FEATURE_AMD_SSB_NO (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */ /* 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/common.c b/arch/x86/kernel/cpu/common.c index 38276f58d3bf..494735cf63f5 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -972,7 +972,8 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap); if (!x86_match_cpu(cpu_no_spec_store_bypass) && - !(ia32_cap & ARCH_CAP_SSB_NO)) + !(ia32_cap & ARCH_CAP_SSB_NO) && + !cpu_has(c, X86_FEATURE_AMD_SSB_NO)) setup_force_cpu_bug(X86_BUG_SPEC_STORE_BYPASS); if (x86_match_cpu(cpu_no_meltdown)) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 92bf2f2e7cdd..132f8a58692e 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -379,7 +379,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, /* cpuid 0x80000008.ebx */ const u32 kvm_cpuid_8000_0008_ebx_x86_features = - F(AMD_IBPB) | F(AMD_IBRS) | F(VIRT_SSBD); + F(AMD_IBPB) | F(AMD_IBRS) | F(VIRT_SSBD) | F(AMD_SSB_NO); /* cpuid 0xC0000001.edx */ const u32 kvm_cpuid_C000_0001_edx_x86_features = -- 2.13.4