Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4502065rdh; Wed, 29 Nov 2023 03:23:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWi24sdD0RiNaRm/AJAzo8b7sSKEUwwrVI459n/LgDNu74C4FLphNG9YCZfLWCtGpnArzk X-Received: by 2002:a05:6808:2026:b0:3b2:d8cb:8e14 with SMTP id q38-20020a056808202600b003b2d8cb8e14mr24034488oiw.28.1701256995801; Wed, 29 Nov 2023 03:23:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701256995; cv=none; d=google.com; s=arc-20160816; b=uhy+SpMVBYpzKPbFeVb3Aw8fJ0torJQoe46FDq8MFasAy71PgHdvVKP2EmiKeElOpp CRylztWmTe4JtUkTHzsYshyfqs7z9brvlVPHuYXnou7a/flpdQnH2MPf9J2dK7LoqQmD NO5OK6yO3hd2gDbqETWMDI+hIPJP9UmtTWaNYYnsD2RvYnXkmcW1CeEhIvnP+WUnwXCP Rx813Pr2tMyvzLec3Y9s3+WfGAxPvCq3egRK7rHCdP2RrcwdFsZ57i9uILsEy+0zfouq oQREL9NN5sHI7FnAPgr8/kahZZagvfIHgYwTIlyWoiIOheOxvj2Iq49fbKiInQ55U7T5 6rkA== 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 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h29-20020a63575d000000b005b93bfe91f3si13752903pgm.577.2023.11.29.03.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 03:23:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; 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 2620:137:e000::3:7 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 3BEE58031C43; Wed, 29 Nov 2023 03:23:14 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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:14 -0800 (PST) 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)