Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2277756imm; Thu, 27 Sep 2018 10:07:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Dl5xgoiuS3t6PUY+/nff+9tn26LJ9dWhiiETWRNVWGLUyp+bDpGcy1SPyU5pjP387faU0 X-Received: by 2002:a65:608b:: with SMTP id t11-v6mr1985532pgu.259.1538068029471; Thu, 27 Sep 2018 10:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538068029; cv=none; d=google.com; s=arc-20160816; b=RU0c0XXjdg1tw8K7FcKAvBY1m4Hj4KNhRVPpS4J3mrKebbt3eZE0vZVkPevloEbAoD qfsC3TzTPbiLKDZur9vhM6QLqU3rJjWaicLjSYfx1BAMKwH1Q9QLyr0OWzQB7cK9azet JBw20vn3wCb557ZpUM0E8AuM0iO3oG1qgol94XiWY8bJvCHp0rI8xEwEJAZ+ACYdbqav REOsKt60lTnMQAhG4ezxsVY5BV5AZ8iOO9k8zxKoK9TQNWV5vda4QovZFcURl6wmmNB1 DLqcr2b1kS5Hug1ddCWgfz80UZTzaW1WNO71kn0BYmadZSEWluEKTQZZMrFGJ5UWXZd+ 6vFw== 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; bh=YLfXJuClyWarg/rdQllNfE4LwUMfGXl5VcNNteBnqvc=; b=qkpjB46ynTouacfaDzSKUc4NlrxH79GP3fEGCOelst0FKx9EynGT724G/ppaecv8lQ 6X3tJqJO0pI0OmZTbSaKlRyYB4IL7oTDadHbFpPv+dzrH828dUR7ldYseQC7XoQUSlrB xr1mBm2Pe3auxQAOCxHqr0xyMfvm5LIMAl3IBsKxUv0fKFybzat4aj/PiNWpnh1+zIev 5uKvadKtAw7uhOHr2a2EyExRwuwBpCYiIzHK57nVPeRc6khbrmz6LYFUTca5EastAcbk C7c5CP0ZGogJLyW2hORPoKVTUs4HOuq5bkOfAMi0eZ04Fy/tpUTLFqPaye3OfnNgZxaE 96IA== 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 u10-v6si2601498pfd.297.2018.09.27.10.06.53; Thu, 27 Sep 2018 10:07:09 -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 S1728413AbeI0XZ3 (ORCPT + 99 others); Thu, 27 Sep 2018 19:25:29 -0400 Received: from terminus.zytor.com ([198.137.202.136]:32979 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727621AbeI0XZ3 (ORCPT ); Thu, 27 Sep 2018 19:25:29 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8RH67NJ102135 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Sep 2018 10:06:07 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8RH66Ul102132; Thu, 27 Sep 2018 10:06:06 -0700 Date: Thu, 27 Sep 2018 10:06:06 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Pu Wen Message-ID: Cc: tglx@linutronix.de, puwen@hygon.cn, bp@suse.de, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, bp@suse.de, tglx@linutronix.de, puwen@hygon.cn In-Reply-To: <0861d39c8a103fc0deca15bafbc85d403666d9ef.1537533369.git.puwen@hygon.cn> References: <0861d39c8a103fc0deca15bafbc85d403666d9ef.1537533369.git.puwen@hygon.cn> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cpu] x86/bugs: Add Hygon Dhyana to the respective mitigation machinery Git-Commit-ID: 1a576b23d63794f39a247fb31056eecccbf9a287 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.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_24_48 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: 1a576b23d63794f39a247fb31056eecccbf9a287 Gitweb: https://git.kernel.org/tip/1a576b23d63794f39a247fb31056eecccbf9a287 Author: Pu Wen AuthorDate: Sun, 23 Sep 2018 17:35:50 +0800 Committer: Borislav Petkov CommitDate: Thu, 27 Sep 2018 18:28:59 +0200 x86/bugs: Add Hygon Dhyana to the respective mitigation machinery The Hygon Dhyana CPU has the same speculative execution as AMD family 17h, so share AMD spectre mitigation code with Hygon Dhyana. Also Hygon Dhyana is not affected by meltdown, so add exception for it. Signed-off-by: Pu Wen Signed-off-by: Borislav Petkov Cc: tglx@linutronix.de Cc: mingo@redhat.com Cc: hpa@zytor.com Cc: x86@kernel.org Cc: thomas.lendacky@amd.com Link: https://lkml.kernel.org/r/0861d39c8a103fc0deca15bafbc85d403666d9ef.1537533369.git.puwen@hygon.cn --- arch/x86/kernel/cpu/bugs.c | 4 +++- arch/x86/kernel/cpu/common.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 40bdaea97fe7..b810cc239375 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -312,6 +312,7 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void) } if (cmd == SPECTRE_V2_CMD_RETPOLINE_AMD && + boot_cpu_data.x86_vendor != X86_VENDOR_HYGON && boot_cpu_data.x86_vendor != X86_VENDOR_AMD) { pr_err("retpoline,amd selected but CPU is not AMD. Switching to AUTO select\n"); return SPECTRE_V2_CMD_AUTO; @@ -371,7 +372,8 @@ static void __init spectre_v2_select_mitigation(void) return; retpoline_auto: - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { retpoline_amd: if (!boot_cpu_has(X86_FEATURE_LFENCE_RDTSC)) { pr_err("Spectre mitigation: LFENCE not serializing, switching to generic retpoline\n"); diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 658c85d16a9b..d14c879ba7ba 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -963,6 +963,7 @@ static const __initconst struct x86_cpu_id cpu_no_speculation[] = { static const __initconst struct x86_cpu_id cpu_no_meltdown[] = { { X86_VENDOR_AMD }, + { X86_VENDOR_HYGON }, {} };