From patchwork Wed Nov 29 11:22:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 171271 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp267770vqn; Wed, 29 Nov 2023 03:23:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IE466NkvkW7NBlpovwE9pS/Ka5+jJKnS8wpz8BZJfF72pIa0PSGf1wleCosDSqzqJZkjU4l X-Received: by 2002:a05:6a20:e118:b0:18c:26cc:c054 with SMTP id kr24-20020a056a20e11800b0018c26ccc054mr18736047pzb.7.1701256985936; Wed, 29 Nov 2023 03:23:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701256985; cv=none; d=google.com; s=arc-20160816; b=NhR01BW+TNUJu6F8T5lGbXIfJhlAjjoEfPlQOhvSs7luVwnVZz8kdefsWjpJlLEkes G7KTX64xmSvYLR8DGwLetEzYc4QVcODh3VHOtUSp3o84tP0NDHLz9pK3vqSCHqlHEegy y+E1Hh32mgOpnyAZ8AI4rG60VbIWVdVVu96tqHdRrDCpkUrB+Fbgr6SmmfjDiQgOS1Pd JzTxVtTm/s0C1k6C/l3c2Ywqbi5s2otOcytbF31rkpS8aaqwoNhyZAPT3fhLefGm/bzh sn9b4LLn7Z5R7tUQxMmKebt/6Kt5Kxy3IwdzHns4VDORL5co4UYtgoCs0lvjHKg5byWL Ezzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=uA9vhfzIXaSAQHK/BcA4eWekW0YPp/eISi/VhG2VkNA=; fh=UD1ZRCSS/l4PYbuMk1gSsIJwAKOC33PKfkYvw4GUlo4=; b=OVk7510AYTLVmbKKzRh9B9jPZ8uWxLSRMKjnqPzFTAcHHF/DR2yOZuNZmXdUVybHfV RPWFRH2PqJHVRdJ7Eoklx2WWcBDOL6zgIZXUbeVJQaN1/S7vQVzrLHZVgItNdvkGr9/5 fZKOZWV/JtK3TNBDRU2pqgQQFGOxsHMWqEabOicDZWEGw4LAnmOcnYiNd0auUq0VZxUB w49WPxs42GiXHRi8GOdH41GSqBQm2IZxQKh3QCOROEVytjpqJAXupMId2/Cr+1kYJABm lPtDYHnicjjjSmAh2RDs7SFkWuUgf2yj6MdyjkAyji2qzoiq/yYcpnKsHzttt+KEQtZT aIdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EoTMIsMB; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id cm7-20020a056a020a0700b005b96af23fe6si14735416pgb.284.2023.11.29.03.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 03:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EoTMIsMB; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DD5E380AE201; Wed, 29 Nov 2023 03:22:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232705AbjK2LWj (ORCPT + 99 others); Wed, 29 Nov 2023 06:22:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231634AbjK2LWY (ORCPT ); Wed, 29 Nov 2023 06:22:24 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE3EB172E; Wed, 29 Nov 2023 03:22:30 -0800 (PST) Date: Wed, 29 Nov 2023 11:22:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701256949; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uA9vhfzIXaSAQHK/BcA4eWekW0YPp/eISi/VhG2VkNA=; b=EoTMIsMBgj7Wpx9u+wILiOSRQHWZ9GRYZbpXVRmKhdGP3a+AqIeDerx+mGeYMU/tfhjIDD 7Pt/3iThUpOLbtb+sp7h1e9Xd5LVzzHznGjy2+rlgCwqV72jU4xkpQBYhopktkgicB3yMF BnvCPU3Df+LuLEm4OhrYvWtIQ2BxBxtDzHWnS+djpPDP7UN7yyAdR2BfzCrGye5VHscmJN qqpD5M976dhi2sJqJeJHA1PHIyZ7AFqxQMl2SwRUt2vCQSkWOOzuePUqOh3fgKGWMqT74H hCj8A/kSgtzt77I0CQBwiKpNhEHg0ngfIvMDSqvc3XxQr6ekS+UQkLNA+PCVnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701256949; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uA9vhfzIXaSAQHK/BcA4eWekW0YPp/eISi/VhG2VkNA=; b=UbDpVCQZ8XDC8ftB9/j82ytUOF0ztjCWGNpDDnFQeLxcDgscX2Sk/jWHXWUUVkuBHHOy01 w6p8RWngBYB6FCAQ== From: "tip-bot2 for Borislav Petkov (AMD)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/CPU/AMD: Move the DIV0 bug detection to the Zen1 init function Cc: "Borislav Petkov (AMD)" , Nikolay Borisov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231120104152.13740-9-bp@alien8.de> References: <20231120104152.13740-9-bp@alien8.de> MIME-Version: 1.0 Message-ID: <170125694868.398.10343927971091524715.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 03:22:58 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783079408160290133 X-GMAIL-MSGID: 1783897245255013023 The following commit has been merged into the x86/cpu branch of tip: Commit-ID: bfff3c6692ce64fa9d86eb829d18229c307a0855 Gitweb: https://git.kernel.org/tip/bfff3c6692ce64fa9d86eb829d18229c307a0855 Author: Borislav Petkov (AMD) AuthorDate: Wed, 01 Nov 2023 12:52:01 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 29 Nov 2023 12:12:42 +01:00 x86/CPU/AMD: Move the DIV0 bug detection to the Zen1 init function No functional changes. Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Nikolay Borisov Link: http://lore.kernel.org/r/20231120104152.13740-9-bp@alien8.de --- arch/x86/kernel/cpu/amd.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 3c3b4c1..13ad44b 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -70,10 +70,6 @@ static const int amd_erratum_383[] = static const int amd_erratum_1054[] = AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0, 0, 0x2f, 0xf)); -static const int amd_div0[] = - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0x00, 0x0, 0x2f, 0xf), - AMD_MODEL_RANGE(0x17, 0x50, 0x0, 0x5f, 0xf)); - static const int amd_erratum_1485[] = AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf), AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf)); @@ -1030,6 +1026,9 @@ static void init_amd_zen(struct cpuinfo_x86 *c) if (!cpu_has(c, X86_FEATURE_CPB)) set_cpu_cap(c, X86_FEATURE_CPB); } + + pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n"); + setup_force_cpu_bug(X86_BUG_DIV0); } static bool cpu_has_zenbleed_microcode(void) @@ -1067,7 +1066,6 @@ static void zen2_zenbleed_check(struct cpuinfo_x86 *c) } else { msr_clear_bit(MSR_AMD64_DE_CFG, MSR_AMD64_DE_CFG_ZEN2_FP_BACKUP_FIX_BIT); } - } static void init_amd_zen2(struct cpuinfo_x86 *c) @@ -1219,11 +1217,6 @@ static void init_amd(struct cpuinfo_x86 *c) cpu_has(c, X86_FEATURE_AUTOIBRS)) WARN_ON_ONCE(msr_set_bit(MSR_EFER, _EFER_AUTOIBRS)); - if (cpu_has_amd_erratum(c, amd_div0)) { - pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n"); - setup_force_cpu_bug(X86_BUG_DIV0); - } - if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && cpu_has_amd_erratum(c, amd_erratum_1485)) msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);