From patchwork Wed Nov 29 11:22:29 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: 171278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp267972vqn; Wed, 29 Nov 2023 03:23:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IGg2uSMuanRqvTPBybVpl5zyMJLgsOwCzAJmGrVAtkjn0cE8JW5RqKBcaSramvT8olyuLJO X-Received: by 2002:a05:6a21:3514:b0:188:1df7:9afe with SMTP id zc20-20020a056a21351400b001881df79afemr20561341pzb.30.1701257016422; Wed, 29 Nov 2023 03:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701257016; cv=none; d=google.com; s=arc-20160816; b=MtyXVV5EPnZ4oRzEg6afiSFarYEfxTTAedO73q6OSaSmBZNCUb40LzuMZdKlktsbkv a3huzjT0Uq20ZhKNyf/W+GbqriyfWdm+n5TetbdutMGSLJ0d0Q1DlP9+Sf4GgZgFdqkK iB6Ha5YdqFP4BTjeRUu58m6GspJr1cVPHfL49Yyq9V+jCoQ2hC2jJSslRnR8zwj3skHm YqZz4RmEbsQD7Ma+XHajj3aDiEp+UaHpPS9RrlxzsJkbW+DeVbPZCDgJP/pmGvCA551p nnkk2nuEKuOP3oNwx7ZrQczJb5VykhrvojDtWHNzC8rdhY0c/qMfKU1/yItBcBFjTAXc pKJw== 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=++C9fCyPTZf5m4s6SYgnlSiDBPDbvOlA+9j4OOKLHCU=; fh=rR8KC3MdVVkWqW1DLWNOtxrtJ4e446FIKUSpWnemrcA=; b=e0OArS5ICrX2CNSwzZ8O4nsttNIrfb4zIODpJyw+sd5+8y0Nz1L46o71WVlmILas0D 5TJ+gkDGMXOBMCM0OlXFxL1ylllNAnA0KjCnlPufMrtykMi/ibCsrhcy52Hz9k7M/xq9 n9GwOKDGxoqBTZQbolf3ovaSqVvc9wjZCBvZFNGUd6KEoHSVlUsN1S7udlsyKUm2+Ylo Xe/xdPNPlUJkoePgo30TxR0I3y8x9tlsnmQmsBcTZ1UO42cMZfqrbC+nrX1CfyWV0YOE m5M+dBNlqMHdJPLaFZvFVGZyeI3zyli71EKGgVQO3JLm7dSZ9NDp3tMCpwRhfpxdUqBG tVUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2vVXrnnQ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="60d+/AoU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a70-20020a639049000000b005c60b583ee5si726263pge.848.2023.11.29.03.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 03:23:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2vVXrnnQ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="60d+/AoU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 389FD8041FE4; Wed, 29 Nov 2023 03:23:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232766AbjK2LWl (ORCPT + 99 others); Wed, 29 Nov 2023 06:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232041AbjK2LWY (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 6A0E4171D; Wed, 29 Nov 2023 03:22:31 -0800 (PST) Date: Wed, 29 Nov 2023 11:22:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701256950; 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=++C9fCyPTZf5m4s6SYgnlSiDBPDbvOlA+9j4OOKLHCU=; b=2vVXrnnQjbXmYmdLB7avZgnhwRDkjNM2UbYngMxMGUk+B4pxeydyn1vhOT0iezWNuvzmCd cXt8NrNsT0KOQAZ7S/vRv1fZi1A0qsTD3UjwaLlaiOvksPsim24fGG6Muzo7IHyMkRh4Aj j+g1/ag69ba5MRM2C83liHZuEYyCm1TXUsuKDoOWrHrRaQ8PEu6uyHYTtTmCy4prgr4xoU g9hoGVdSHsacVAAMwuEeO22PJwfhmm+bCPDerPU3JZNqaNisAXmESLhNXYNxd9y+E32rL4 UazPXXYO9HGZxeN2njb4thOavK8XSerQjg4uZbJuZhdCrdRX4hRF+zb6jN4cIg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701256950; 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=++C9fCyPTZf5m4s6SYgnlSiDBPDbvOlA+9j4OOKLHCU=; b=60d+/AoUJuzPBYPGhStOl16GUwDTPr6ccC/TlasjqZEGLO+mixF/ZM59Jjy/wY9IuFBx/h OZ4SG6xwlmYzGtDA== 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 Zenbleed check to the Zen2 init function Cc: "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231120104152.13740-8-bp@alien8.de> References: <20231120104152.13740-8-bp@alien8.de> MIME-Version: 1.0 Message-ID: <170125694941.398.1156683558217970718.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 agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 03:23:32 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783079396777730543 X-GMAIL-MSGID: 1783897277474121776 The following commit has been merged into the x86/cpu branch of tip: Commit-ID: f69759be251dce722942594fbc62e53a40822a82 Gitweb: https://git.kernel.org/tip/f69759be251dce722942594fbc62e53a40822a82 Author: Borislav Petkov (AMD) AuthorDate: Wed, 01 Nov 2023 12:38:35 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 29 Nov 2023 12:12:34 +01:00 x86/CPU/AMD: Move Zenbleed check to the Zen2 init function Prefix it properly so that it is clear which generation it is dealing with. No functional changes. Signed-off-by: Borislav Petkov (AMD) Link: http://lore.kernel.org/r/20231120104152.13740-8-bp@alien8.de --- arch/x86/kernel/cpu/amd.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index f53e0a2..3c3b4c1 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -70,12 +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_zenbleed[] = - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0x30, 0x0, 0x4f, 0xf), - AMD_MODEL_RANGE(0x17, 0x60, 0x0, 0x7f, 0xf), - AMD_MODEL_RANGE(0x17, 0x90, 0x0, 0x91, 0xf), - AMD_MODEL_RANGE(0x17, 0xa0, 0x0, 0xaf, 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)); @@ -1059,11 +1053,8 @@ static bool cpu_has_zenbleed_microcode(void) return true; } -static void zenbleed_check(struct cpuinfo_x86 *c) +static void zen2_zenbleed_check(struct cpuinfo_x86 *c) { - if (!cpu_has_amd_erratum(c, amd_zenbleed)) - return; - if (cpu_has(c, X86_FEATURE_HYPERVISOR)) return; @@ -1084,6 +1075,7 @@ static void init_amd_zen2(struct cpuinfo_x86 *c) init_amd_zen_common(); init_spectral_chicken(c); fix_erratum_1386(c); + zen2_zenbleed_check(c); } static void init_amd_zen3(struct cpuinfo_x86 *c) @@ -1227,8 +1219,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)); - zenbleed_check(c); - 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); @@ -1393,7 +1383,7 @@ static void zenbleed_check_cpu(void *unused) { struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); - zenbleed_check(c); + zen2_zenbleed_check(c); } void amd_check_microcode(void)