Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3304350imu; Sun, 11 Nov 2018 12:00:41 -0800 (PST) X-Google-Smtp-Source: AJdET5eNsQRn2F4mYI5hdR7kpOp418QIB/1M3/QoKbYyF2kQQYI7yeJU0EfCgmSt1rwISrtrKD9+ X-Received: by 2002:a17:902:b217:: with SMTP id t23-v6mr5265620plr.128.1541966441156; Sun, 11 Nov 2018 12:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966441; cv=none; d=google.com; s=arc-20160816; b=LFQfVBIvETJZTmNina/hMCt2tfU59Lcl/8jl0VRqdYnkNNblyVVFBR3rq5qeDbMnLB ipq6l0My2sar3PbO0hDIFUEs6BZxVUdKHs+VZh6KACXtxaLifgkM/Mw3JzHz3yK87OCh 3TvK5BHJNg+a39r2iIjGPa2O11q9bV9CeIv2+s1Db2Z8UybLIcXKw/1Zb0jNALy8tQbD z43K5JANP5ilgWZv1L4OcQjC/+qBc2ecZ0pwIFzEU12KofXsf6RzKoqXNkP9P6LJruRn aQHxrsWGpAwtYNUPtGjNGHfrC5ewX9K97xv78s9n7qpE5vrmER8/6GYmnangQEmnMx6m Q1kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=8ze6d3wFkxb2HO13eJbkqYlAaeU48WDVMsle4AacpbQ=; b=0KF34TaK4Yi83hqWshbMZt5cR8hZ6qXYai8dEJFZReVZ4SAi4XNGsC9HNZiBC8j1os pJEnzGMHDcrJw0dSCeSWze8DRwSZ7KBN77CyPwj2AwQYl4/vnJMcDHwlj9fEzEhu8frv N1aPSoHuAkVpFuCkY0xymdY93W+1dQX4sTK/ePNWXJsNlMWQMmyp6yJbb6pCn+4YBQ9I XWoAeh8zuU+FaFdERUhnm1WvtYWfAbTdjKzIcq5PU6B+zSjl1UtYDvyTS4YQ/splQFDk LGVHbSnaXCrGhbfkZ05/1awuGCFxchJOPqMP1gzI1GNL2kVkVIjJC0sM4UdevmIdJSvf 2Fiw== 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 l20-v6si4769994pff.126.2018.11.11.12.00.25; Sun, 11 Nov 2018 12:00:41 -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 S1730944AbeKLFs6 (ORCPT + 99 others); Mon, 12 Nov 2018 00:48:58 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51416 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730900AbeKLFsk (ORCPT ); Mon, 12 Nov 2018 00:48:40 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvst-0000oF-Gl; Sun, 11 Nov 2018 19:59:03 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsV-0001fU-Bc; Sun, 11 Nov 2018 19:58:39 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, andrew.cooper3@citrix.com, "H. Peter Anvin" , "David Woodhouse" , "Kees Cook" , "Konrad Rzeszutek Wilk" , "Borislav Petkov" , "KarimAllah Ahmed" , kvm@vger.kernel.org, "Thomas Gleixner" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 222/366] x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Konrad Rzeszutek Wilk commit 108fab4b5c8f12064ef86e02cb0459992affb30f upstream. 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 Signed-off-by: Thomas Gleixner Cc: Kees Cook Cc: kvm@vger.kernel.org Cc: KarimAllah Ahmed Cc: andrew.cooper3@citrix.com Cc: "H. Peter Anvin" Cc: Borislav Petkov Cc: David Woodhouse Link: https://lkml.kernel.org/r/20180601145921.9500-4-konrad.wilk@oracle.com Signed-off-by: Ben Hutchings --- arch/x86/kernel/cpu/bugs.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -573,17 +573,12 @@ static enum ssb_mitigation __init __ssb_ * 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; } }