From patchwork Wed Nov 29 11:22:33 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: 171276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp267825vqn; Wed, 29 Nov 2023 03:23:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjhzWVq+0ZKa1zt68SWqxrIrWSYN111vZ97gxygRRB9S2reoGbuIp2KDXtZABq7S6u+4rL X-Received: by 2002:a17:902:9883:b0:1cf:9420:4e6c with SMTP id s3-20020a170902988300b001cf94204e6cmr15277074plp.36.1701256994529; Wed, 29 Nov 2023 03:23:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701256994; cv=none; d=google.com; s=arc-20160816; b=DhCBSkU/t1tz6if+tQM/woD9FQXsfAW14rTazwgxYlDySVXto4Dxq7Vm8q03XccPF8 DSHzmm34N5GnajgkKhTTqNrlZw+0s9ddQV52oHjQrq74g7bckPvoR5QD/twQpPfoS2/s gTNpOQMSd0Bm5+4c4Tufw8q1OMWF4IdQQ1BhDVXtdvlegMH4+h5uV5VX8psqA79UZk9k QYusoSqX3QqyNKVLbP9R7Ewemqa5X3uora0V0WnR/KBc4LEFOs7vwcU1kra5P9a7qpx5 lBq5z3g1ED35xS2XP3tqvZ0OD2tPP8Eh7ZDbHfUmyw72X4wkvlOP+N45Fb0snJkutLUb 2q2g== 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=wRWoLYfCxb2rD35PLDvM7TDZLoRJJmNWECOPej3NnVA=; fh=UD1ZRCSS/l4PYbuMk1gSsIJwAKOC33PKfkYvw4GUlo4=; b=wG8f3nyLHxspaQIb+r/tlutvxOKq9uHBV8NKwMu7yCuaLQVjYHIcOGKn/tHnyF0wbq q0J6oHbEgbfyz0DTGk2nvyJ2Wm9ughHM1I4XNuVx0xeJtvww78/5pCmp2acR4e1FW3yb DG1mFNz5TBRGKCpcsKEjNaqTTbfVyIkZzldg1KOHcdsnds16S63EtdhdAtILTnlySRLv 6v/IwT3xZp+JZfcdXKit7kzHJwfLzJAiFHmhq7M3O3s1hk/Z79aWZFI0qT8Rej8/orD4 1/g98GkkfkzYZj641MBvFTsppdr6c/eO2wZemP4TVm3Wg0F0MVT5APQYDjNiAH9LrQC6 TjUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UHCc4r0e; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t14-20020a1709027fce00b001ce5b7bd150si13130751plb.607.2023.11.29.03.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 03:23:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UHCc4r0e; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 2093780C65D6; Wed, 29 Nov 2023 03:23:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232802AbjK2LXA (ORCPT + 99 others); Wed, 29 Nov 2023 06:23:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232708AbjK2LWf (ORCPT ); Wed, 29 Nov 2023 06:22:35 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08FAD1BC5; Wed, 29 Nov 2023 03:22:35 -0800 (PST) Date: Wed, 29 Nov 2023 11:22:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701256953; 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=wRWoLYfCxb2rD35PLDvM7TDZLoRJJmNWECOPej3NnVA=; b=UHCc4r0eYu/bBA5ggnGjrHpge1W6RzmZiWa0brChWDkjZp0+TFxewiPUGWmj5wJDDNl8xE H87hR/AWuaomWp1uWZyYmLYPuNsYFTAYqM5EmyrAkX8XhV3tcHLwhuM99pnuXeoObjc4Aw aUEHTeiRalAXKFsPSt1eJ4FE9IJbMmLYJ4Hj8g3Cvw0TLMY7aZoBnYuMeitt71yTp+DXIX G7kV+eIXNJ+3/5DLv2S7hRLh2zSOUTHabC59BrLVLvXZFYJIL3EHT9u1EItt9ZaV5NpplH jS6O4symOTENdt4o3fa21sIk6044PikyhXXfXt6M1P2SXAs35GxzliPkaUStxQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701256953; 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=wRWoLYfCxb2rD35PLDvM7TDZLoRJJmNWECOPej3NnVA=; b=9P8DFIFDjCfoQD9SVXUfEIiga5vi+CCwtEk5WmAwaJXXFn/VstJ8SKgY5tqtZ495erII7A osE+KkvkKsPQXoBA== 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: Carve out the erratum 1386 fix Cc: "Borislav Petkov (AMD)" , Nikolay Borisov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231120104152.13740-3-bp@alien8.de> References: <20231120104152.13740-3-bp@alien8.de> MIME-Version: 1.0 Message-ID: <170125695303.398.11143867605692920679.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 03:23:13 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783079338712098417 X-GMAIL-MSGID: 1783897254298822862 The following commit has been merged into the x86/cpu branch of tip: Commit-ID: a7c32a1ae9ee43abfe884f5af376877c4301d166 Gitweb: https://git.kernel.org/tip/a7c32a1ae9ee43abfe884f5af376877c4301d166 Author: Borislav Petkov (AMD) AuthorDate: Wed, 01 Nov 2023 11:14:59 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 29 Nov 2023 12:11:21 +01:00 x86/CPU/AMD: Carve out the erratum 1386 fix Call it on the affected CPU generations. No functional changes. Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Nikolay Borisov Link: http://lore.kernel.org/r/20231120104152.13740-3-bp@alien8.de --- arch/x86/kernel/cpu/amd.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 6aba224..0a499cb 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -984,6 +984,19 @@ static void init_amd_bd(struct cpuinfo_x86 *c) clear_rdrand_cpuid_bit(c); } +static void fix_erratum_1386(struct cpuinfo_x86 *c) +{ + /* + * Work around Erratum 1386. The XSAVES instruction malfunctions in + * certain circumstances on Zen1/2 uarch, and not all parts have had + * updated microcode at the time of writing (March 2023). + * + * Affected parts all have no supervisor XSAVE states, meaning that + * the XSAVEC instruction (which works fine) is equivalent. + */ + clear_cpu_cap(c, X86_FEATURE_XSAVES); +} + void init_spectral_chicken(struct cpuinfo_x86 *c) { #ifdef CONFIG_CPU_UNRET_ENTRY @@ -1004,15 +1017,6 @@ void init_spectral_chicken(struct cpuinfo_x86 *c) } } #endif - /* - * Work around Erratum 1386. The XSAVES instruction malfunctions in - * certain circumstances on Zen1/2 uarch, and not all parts have had - * updated microcode at the time of writing (March 2023). - * - * Affected parts all have no supervisor XSAVE states, meaning that - * the XSAVEC instruction (which works fine) is equivalent. - */ - clear_cpu_cap(c, X86_FEATURE_XSAVES); } static void init_amd_zn(struct cpuinfo_x86 *c) @@ -1080,10 +1084,12 @@ static void zenbleed_check(struct cpuinfo_x86 *c) static void init_amd_zen(struct cpuinfo_x86 *c) { + fix_erratum_1386(c); } static void init_amd_zen2(struct cpuinfo_x86 *c) { + fix_erratum_1386(c); } static void init_amd_zen3(struct cpuinfo_x86 *c)