Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1370069imm; Sun, 23 Sep 2018 02:36:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV623/mzFOBQ1/E5T+bpil31xfqybeSalRflA83Q7FjEmoIkJPOaFdJSHD6BgGCYoZpDuhfva X-Received: by 2002:a63:6243:: with SMTP id w64-v6mr5249986pgb.145.1537695415907; Sun, 23 Sep 2018 02:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537695415; cv=none; d=google.com; s=arc-20160816; b=DJpRaVCrnkUtaEIUi2PyMiJVSjMc0tqX5X6cElhGvFvtPyjoKUvM66xdJTzwjFAycV 5rmXSZ7hxGy9YNx49CXJk/8llV05gSTTeg/3WZbui79eaOnvKU7Ms7PFHXcJJBGzpSEj xbHbEY8EWecWMImSa59WBktk/vaE3yNNDkq7tRgTiJDqDVA0J7Ontl/iRST8mzfVSkBM LR62tbGEi1tEGPedDl622G4J7/9IRkFA6EqDmSPj4eYrjV5N7QuqOTD1370b30yhnH8o S0OUPOLaAh53OT92dxYLcuH1HuP83E3fV38OAUnfSW86IhSW01TtUZsEyQRHY7fIPbNR lxoQ== 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; bh=lrmSbYqigyNA9z/g/GtTPLogN5HyqXWnr5jeThi+NuU=; b=os4C+NMD1xcpYaqCVG6mzu9brnQLdeGop0sxZ7PV42cX55Q5tyDIV16Jg/ooY/+/SB DQpGzgvfo34/YSIaj0XCvG1kThYYIiyc2TPWsnOEOvk46sQ/Qif3lB0cpAYO8VPo1ZU7 t86Wr0Yx9vntA2lgxz4JefErRjsHT/n0Ux1XA/ef85Gw9EHZAHHm6pjvqoqJIdMEE5zH RJ7LLIYhoAqxzZGPOYfy9EJWJeoiDui0Tx0CKBGMrSc2/7otZMjcFswwHkMgmtA2RJ73 Zuc/ztm/+JLMazaaSsBYXTffqkcgopEw7Eo7wffaXWzUCnN191o+tBe6XJSoScdsTGUq TQOg== 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 i186-v6si29917714pge.414.2018.09.23.02.36.40; Sun, 23 Sep 2018 02:36:55 -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 S1726319AbeIWPc6 (ORCPT + 99 others); Sun, 23 Sep 2018 11:32:58 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:48943 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726052AbeIWPc5 (ORCPT ); Sun, 23 Sep 2018 11:32:57 -0400 Received: from pw-vbox.higon.com (unknown [182.150.46.145]) by APP-01 (Coremail) with SMTP id qwCowACHZ+R5Xqdb7FCzDA--.39S2; Sun, 23 Sep 2018 17:35:56 +0800 (CST) From: Pu Wen To: bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, thomas.lendacky@amd.com Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Pu Wen Subject: [PATCH v8 09/16] x86/bugs: Add mitigation to spectre and no meltdown for Hygon Dhyana Date: Sun, 23 Sep 2018 17:35:50 +0800 Message-Id: <0861d39c8a103fc0deca15bafbc85d403666d9ef.1537533369.git.puwen@hygon.cn> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-CM-TRANSID: qw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derInfo: psxzv046klw03qof0z/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Hygon Dhyana CPU has the same speculative execution as AMD family 17h, so share AMD spectre mitigation code for Hygon Dhyana. Also Hygon Dhyana is not affected by meltdown vulnerability, so add exception for it. Signed-off-by: Pu Wen --- 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 40bdaea..b810cc2 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 44c4ef3..851cbe7 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 }, {} }; -- 2.7.4