Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp695485imm; Fri, 1 Jun 2018 08:03:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJJTW4/Ao0Xn07OvrFZ+TLoV+Xy0WSwh9Mo197MWVU/TV1d7/fJLwFBBsrV6jbUJFHUwSbO X-Received: by 2002:a62:8a5b:: with SMTP id y88-v6mr11227550pfd.103.1527865385201; Fri, 01 Jun 2018 08:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527865385; cv=none; d=google.com; s=arc-20160816; b=wmfrCBqBDjksZCBld+kzHqhy5fFC4RvBX549e3bvGfkITwQWgNENoTj2U3UY/9k9hW c+orhewLTQDEli8uWIr5Vh3Ja8nBEjSuvnKp66/9rA6hgKHpFOn5kDOJm51Yqew9ncWa uz612+/8uxtExQQkmRFxbpuBcZfskKcHtPhlsbrj2g/nuKSorvxMhl92V+fTRDJDvAOQ c6jmlTOTWNZBzyCb46Z//Li48TEHYNq/4d3QQMMdFcpxyjsLN+nMyl1W866UFrExCQ5b nGNHNvdZKQhJY+KSrf5/7u+50BO+Fjlo4LLzFL0NNLXKy1fOnAUrpH9+GlQh+pQiuQG4 Mtxg== 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=/dAZm+bcBoQgwLMabQCXRwrbG6oSL0LZLfsSvGr9eP8=; b=EYiB1QB6Z19JpB78bvEceMDdLCCSXLuvdj/D5LwgZHIloY8pyE6hJiBkx7ycZxCn93 s8ld3N/yfO9D7GusZvnqYXbrPaSWWqnOQtsXdhIiQ+dWdk9at1m/nG/bz/aZDvSgrFH4 B1wzXz+bi666YMvjek5QYtlC+HWQBWaIpD9xVhWGP2QXPC9kkwQNh2+6i0CsPI0dIIvG KdOeYKbPav3jttCL7XmdSoVXakZ3q9DQKocJmbgRdwN8jaoJlBWcn6X+iYkQHhb4RI4d 4D+/frUGj5k6dNUHm7F+kNNaK9xD6cSL6tcbR+JHyy8cGhEpAsn75QhsRWv8F4C94gUa aAWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=BfjEYR++; 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 w1-v6si23906540ply.425.2018.06.01.08.02.49; Fri, 01 Jun 2018 08:03:05 -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=BfjEYR++; 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 S1752709AbeFAPA0 (ORCPT + 99 others); Fri, 1 Jun 2018 11:00:26 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:40258 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752487AbeFAPAA (ORCPT ); Fri, 1 Jun 2018 11:00:00 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w51EvR4W006751; Fri, 1 Jun 2018 14:59:24 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=/dAZm+bcBoQgwLMabQCXRwrbG6oSL0LZLfsSvGr9eP8=; b=BfjEYR++QMlSv2k+GNUcd0CT69/Uj7xnQcyxS2ejJ/lMVzc+qgFGI61CGfcge9c3fFj6 AdVd+ag4mXeE+rmnDgh8lzVXh9odiFt7bBWYFMY/908QqEahdnH1B/kWC1psGhRuJ5qP S9k5jrIa4NGama/92vdhoHO7o4Oj/TA1zs3tMVK5HPnFyUxS4Srehjfhr6OUIk9ubT0X VYamaMTs0Bjb7cB8wNcPLNmTE/M9ZaGwqXoMMUiWLTYZKtRDJ9qMetOv72lOGd0Z1Tmv epzsZACzwSzlzvljqYwSflUvrgsYDbkyfCKa4rZTxWddG4ewM9s7Z0tCHFwpkQihzi+F VA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2janje58kh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Jun 2018 14:59:24 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w51ExOLv015237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Jun 2018 14:59:24 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w51ExNGX017134; Fri, 1 Jun 2018 14:59:23 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 5F4E76A00E8; 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 , Kees Cook , KarimAllah Ahmed Subject: [PATCH v1 3/3] x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features Date: Fri, 1 Jun 2018 10:59:21 -0400 Message-Id: <20180601145921.9500-4-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=910 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 Both AMD and Intel can have SPEC CTRL MSR for SSBD. However AMD also has two more other ways of doing it - which are !SPEC_CTRL MSR ways. Signed-off-by: Konrad Rzeszutek Wilk --- Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Konrad Rzeszutek Wilk Cc: Borislav Petkov Cc: David Woodhouse Cc: Kees Cook Cc: KarimAllah Ahmed --- arch/x86/kernel/cpu/bugs.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 6bea81855cdd..cd0fda1fff6d 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -532,17 +532,12 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void) * Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may * use a completely different MSR and bit dependent on family. */ - switch (boot_cpu_data.x86_vendor) { - case X86_VENDOR_INTEL: - case X86_VENDOR_AMD: - if (!static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) { - x86_amd_ssb_disable(); - break; - } + if (!static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) + x86_amd_ssb_disable(); + else { x86_spec_ctrl_base |= SPEC_CTRL_SSBD; x86_spec_ctrl_mask |= SPEC_CTRL_SSBD; wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); - break; } } -- 2.13.4