Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2125106rdb; Mon, 20 Nov 2023 02:44:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFw8Y2CPDny080eS0ccGVVPXXNBhKNjUojOsN1maPtSY+ylN7WfMv7ezb2U2Q8+HNmV+Tam X-Received: by 2002:a17:902:e5ca:b0:1ce:6600:39e6 with SMTP id u10-20020a170902e5ca00b001ce660039e6mr9486668plf.0.1700477048442; Mon, 20 Nov 2023 02:44:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700477048; cv=none; d=google.com; s=arc-20160816; b=UJB9iHeDY0MSHmoUpTffPPR1E5gMKV0njBdC0vlSOJEN7eRKUsAtDFnFRl7siN9Hgz G2JAlh+D7l00Vac1huLSnzLHad9PzKx69hmINYZlAKfOIZCBY//ACbAymYTzOkyBE9U2 93sknxxvZ8YU0d8ZZhonbIqfhiHDIEmyp4A+gzPV023Dx4vrhI71TKOq6f/ILkzXhfZd bReXHlHNYJPacCQmZpIzqs14np+V2DjgEB+seADiYySs2x5+AJlNkcKL1c4sorn9r1Bq o02qnlrlA0tQ8zm1d/Q0RLNzSVomOxxW9/09482B7fqyvtQc5qixYLOD6p/d+fBcG+ir B+8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o9Scu5DzQgUAyUiYXDj9ShBZx68Z/8kv9SCbk0GohKU=; fh=yRofEPOsMYSFYi/7/f3tXB782BWAy0107oR1j5aafGk=; b=beTgem6RSxS89G3flo7Zeb4v72ej6uLLgIH0I982mB+FmYgAJsv3Ir4OmFDSJbuj0L zY6tpZzIsXt5L95NGALM9rfomqj9tA6KpYum1Y5aPd1+0KhycIkTZ90FC+mwigyeXk5y /X5weVrLce0c5deRSpWfbjZ+j98mH/DV5aqDT0KbNixL8IhKrDwR+bxYQDa57+7JM0w9 pjKQj51yv6fKzgOZXinA3lbAR5DVanbD/AJz+lRthUGdHrtWkzG6zVlXCDhU/PGrXjYa /QowoFrCtTmDO7xS/AVpnUpd+U7AbFebJlRnDtXiFv++nzYEfztIqDhmFAhG2j23N1QN ZEvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=kvheRbZg; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k3-20020a170902c40300b001c9b5d2c3fasi8531002plk.523.2023.11.20.02.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:44:08 -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=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=kvheRbZg; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id EB8F780CF542; Mon, 20 Nov 2023 02:42:36 -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 S233174AbjKTKmV (ORCPT + 99 others); Mon, 20 Nov 2023 05:42:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233169AbjKTKmR (ORCPT ); Mon, 20 Nov 2023 05:42:17 -0500 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE2ACA for ; Mon, 20 Nov 2023 02:42:14 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id DAE3740E0191; Mon, 20 Nov 2023 10:42:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=fail (4096-bit key) reason="fail (body has been altered)" header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zQK2PZAC1s1k; Mon, 20 Nov 2023 10:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1700476929; bh=dv3r8X4PHcRGZmkccWpMHrdFrdRvuJJOngRouvfj1cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kvheRbZgGhDZDztAyWLdFiT2cZuMpgLvBcqrYW+D7vobax6NfFD0mf/Cpnx3X17+6 pzxJxMNRT/hPi7F+/ErWPgJNFtne/BCNWqu5q9qbiaBrOOGGohLtq95IQtcf2rzicB LPCY2kFEreePjhWkvyH+wJDhSO+HioKRw4HGT6Vpi8+Mn53Q4oY2vAXg7MF4UAftRu O3xkCwTHFrAdjrG+t+muI2kNdjmJtdejZwjpvYsZ15ttZ+xhOj8v/bmhwxZDaP+pf5 z+BD4WfkEWHiWWBPN0b1TarApXOOI8X/l0OTuFKjzE1ZqQmafdd0QdB+nJRSvZnOBx RRQiTURetORNbTlVcH8DQzXeYr4c1KH2eg4oa8GauobXA1YA9iHVldq5PNaWOMDkMc SlPyiV1A4Vc0uR3HFVNjFnxQA3A+mmy6heAqz6nA7+m/QPZXjRBC5QcWiW9+ZwipVa kzA7n+5FwGbOQ7Kl+DPb3EzgHO77hkvqlJGqi7JcMlzz3xBmQNWVtbVXm/K3C6TjiI Zi8ramvdJP9MXKxLcYruG6uOQrzlb8b5qELG3aUETUIk/oJQ5sr8Dz4iLmuNoP75MD tAXxh1lxG0LTOFxNsGCPnmesd4Yd4KZFM4jq7A3sTJ7fyFjxSuDVeOnRflRvvkhzLO DNHSqYGJorxQpvRy00rJedDw= Received: from zn.tnic (pd95304da.dip0.t-ipconnect.de [217.83.4.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 6283440E0030; Mon, 20 Nov 2023 10:42:07 +0000 (UTC) From: Borislav Petkov To: X86 ML Cc: LKML Subject: [PATCH 02/13] x86/CPU/AMD: Carve out the erratum 1386 fix Date: Mon, 20 Nov 2023 11:41:41 +0100 Message-ID: <20231120104152.13740-3-bp@alien8.de> X-Mailer: git-send-email 2.42.0.rc0.25.ga82fb66fed25 In-Reply-To: <20231120104152.13740-1-bp@alien8.de> References: <20231120104152.13740-1-bp@alien8.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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]); Mon, 20 Nov 2023 02:42:37 -0800 (PST) From: "Borislav Petkov (AMD)" Call it on the affected CPU generations. No functional changes. Signed-off-by: Borislav Petkov (AMD) --- 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 fa6ba63ca7e2..b3f939101368 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); } =20 +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); } =20 static void init_amd_zn(struct cpuinfo_x86 *c) @@ -1040,10 +1044,12 @@ static void init_amd_zn(struct cpuinfo_x86 *c) =20 static void init_amd_zen(struct cpuinfo_x86 *c) { + fix_erratum_1386(c); } =20 static void init_amd_zen2(struct cpuinfo_x86 *c) { + fix_erratum_1386(c); } =20 static void init_amd_zen3(struct cpuinfo_x86 *c) --=20 2.42.0.rc0.25.ga82fb66fed25