Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp735849imm; Wed, 6 Jun 2018 05:19:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJBHTWZigbzuB6MT06gviTzUgVXwEwMe7VvMpAbBQJs/RoD1O7K904GP/bL6dZg6niTHMUn X-Received: by 2002:a62:6c87:: with SMTP id h129-v6mr2204190pfc.179.1528287545678; Wed, 06 Jun 2018 05:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528287545; cv=none; d=google.com; s=arc-20160816; b=hHjHWwoyC0pIrsclCeS4flwpMiga/0mSaRUG9W8qKC5OjmY2HqzbcXIEqOVK5LNrFn PixvBPqtv1DNe9YhMeiNrOK7AfSN/pSLJdW0EBnNbgxiyxArcD8TnYKqIszqE6snZBRy GFKbyw9Tr5mgi9C/6BZgjSQlgWio/dM/SGFa2TIrMX/G3HK5I3QO+baO/WzqZ9wygyvD 7NnQ903MMmSAj+3WMDavZMVCEl3wcH9g6y4pv9gG1kpya6XTXhoS3sAmnp8JaGu1s4iH jZWkYmhlRmFtZbgKVq+i8dVWodCbq/zoy6D+L6n8HR4tPCRar2HycxQDlfrEVWik0Zqf rOng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=2U8Ol4l5sY7e3cVnuqvXQzzjrUG0e7nSI8FlAQJMYKo=; b=A+YrmiZmWrJvoeOBSpPGCJ1p2DYXBWW3kMUOAPMExhix765jd2yVsHTllSzwej5wT0 v/7H7/dou4xFo0FQ01GurZ0AqcUyfDBUdEzHVv8jGbgSr3fjD4zhVS6SWe9fDtRlkBoQ 1CcBAmN46a1qxw4NOi0i0M/eiv/EBr+tRs3bMZhMQIoCHh2wL2vR3utEyfx/KOxls4zQ qvjqdaxY2XiM2TqV3QY2sEvsdziFoJLIEGLwGtPdATlmErnv8n3IAC94zAko0u2FKSKD dnzFMHi3jcHJ+cV/NepLv0MA9JNfwbkVA1Q6K8W/LzurAKDc9Jxg/XZYAoPvBdH9GRDH vNkQ== 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 k17-v6si51303537pfj.310.2018.06.06.05.18.51; Wed, 06 Jun 2018 05:19: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; 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 S1752172AbeFFMRF (ORCPT + 99 others); Wed, 6 Jun 2018 08:17:05 -0400 Received: from terminus.zytor.com ([198.137.202.136]:33113 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbeFFMRD (ORCPT ); Wed, 6 Jun 2018 08:17:03 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w56CGrgR1774280 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 6 Jun 2018 05:16:53 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w56CGrj31774277; Wed, 6 Jun 2018 05:16:53 -0700 Date: Wed, 6 Jun 2018 05:16:53 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Konrad Rzeszutek Wilk Message-ID: Cc: konrad.wilk@oracle.com, dwmw@amazon.co.uk, mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, bp@suse.de, keescook@chromium.org, linux-kernel@vger.kernel.org, karahmed@amazon.de Reply-To: hpa@zytor.com, dwmw@amazon.co.uk, tglx@linutronix.de, mingo@kernel.org, konrad.wilk@oracle.com, karahmed@amazon.de, linux-kernel@vger.kernel.org, keescook@chromium.org, bp@suse.de In-Reply-To: <20180601145921.9500-4-konrad.wilk@oracle.com> References: <20180601145921.9500-4-konrad.wilk@oracle.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features Git-Commit-ID: 108fab4b5c8f12064ef86e02cb0459992affb30f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 108fab4b5c8f12064ef86e02cb0459992affb30f Gitweb: https://git.kernel.org/tip/108fab4b5c8f12064ef86e02cb0459992affb30f Author: Konrad Rzeszutek Wilk AuthorDate: Fri, 1 Jun 2018 10:59:21 -0400 Committer: Thomas Gleixner CommitDate: Wed, 6 Jun 2018 14:13:17 +0200 x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features 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 --- 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; } }