Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2124685rdb; Mon, 20 Nov 2023 02:43:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFuRLwYrQdXajnJpvoN6qAPTD8/RdcmMdPKTTbscfder9r/7ssNjTsOw1nEuSaRjDwW4wQ X-Received: by 2002:a05:6358:e822:b0:16d:bd74:19c9 with SMTP id gi34-20020a056358e82200b0016dbd7419c9mr6573969rwb.16.1700476986404; Mon, 20 Nov 2023 02:43:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700476986; cv=none; d=google.com; s=arc-20160816; b=Uea/2HYF96V6NZwEWSsNYnU4DQ8qRv9SfbiN9ImP6ChGgsLotw9Ua43MYltHZd3IIx toMxFWkRuiXN55ceftqiyKX0UmUydVq9H7/Bkggf7XDlw79AVqF0m7756i+Re2csL/rE u6Ie4c9BETnsC6ir9t67zXAcNQsrbXAPpFqKfJhG27vhf7gs3/YUY0JtLPtEGurrnGOB juWc5X7jLJ5lqcWBg7l3iFynox841A4Q+eNUk35OjK8nNlx6MNtIr5zJ5HcExu7Nk1tw YkSkxBH+xmx8qPodlnSZXfqCAK9q0EbTib1jYqk5S0/coyMLm+Kgr0S6LRmfDZBsSeIV 1Ciw== 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=IOgvUPBoapJ273whkDlrSmNDGjGTMGUTwbnlaqq//BQ=; fh=yRofEPOsMYSFYi/7/f3tXB782BWAy0107oR1j5aafGk=; b=TXhBSsPf3CBnSS89cR7GiH42Hkp0K8mfGaMUT0tXY0XkWoCvdIXbJ9xp+buHNIS0o7 op2fyTjiDe2aA3ou9wLXElJ5GMmMzg6fY70EvpQkgqz45C3O2Ds0iqTVmM58xGKE/ORK Ujn7H3VvikpdtffTG/aHCpr5pC1KdIAWFS6cGt3SprblSucj6zdmZwW15zvnnN33ZsP4 Mcixwdl9LTsPlKvKyHrOWeUxi4A1bkGpksnKjUlUCojzagwnKdWu/x0IE9Ao6m1T+UjN 5MN28c24dW5AzI5TPvWw6PdfRAOiAJlK8t92VZ4fz5zLw9Cd2b41KpXx59BLZRLRENUF tT0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=GcXwUuf3; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id i64-20020a639d43000000b00563d791d978si7589773pgd.750.2023.11.20.02.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:43:06 -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=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=GcXwUuf3; 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=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 agentk.vger.email (Postfix) with ESMTP id 4B90F8047471; Mon, 20 Nov 2023 02:42:56 -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 S233224AbjKTKm1 (ORCPT + 99 others); Mon, 20 Nov 2023 05:42:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233185AbjKTKmU (ORCPT ); Mon, 20 Nov 2023 05:42:20 -0500 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE209F1 for ; Mon, 20 Nov 2023 02:42:16 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 5A74040E01A4; Mon, 20 Nov 2023 10:42:15 +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 mUTZmNe3o_yt; Mon, 20 Nov 2023 10:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1700476933; bh=zSsMqSBzaGE3GgC230bZyMSbMWkZEifLyp6tOh9UKYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GcXwUuf3TIxj6wQEkO/VjCeM4dRufo8nMzORXihxsDqHvx3xwAX6jn9dPNM35LGUM KjPWSqvhxIkto8BGAeJ5ZAOBlt/sIPHg411HYH7k1+mC8jXc7KQmodVYl7e5+pth6X tRp+vIvfB4vMCWdlcmCFK25+ymVcb8WUUltWD6RBfd9fS2tRftVG1peeWJEjR/bma2 YhT5WPVUuV8Ioia3QIFta+9HIvWZiXm6kxlg1uklmnBE4ZXhkedoO4XNiwTMVFPyXB xkrspt2TkUXxYtJS5liS2on+KsLHE316IBU7+TKXQjZH29VZ4swHkvCxbzowDubx2c U4NdoWuCKYN0O3ENXik7RFzx0wGC+6twroXrflyboJISN9YFz8rUWlAv3mIvsYWuN2 f7Rnrpx5Uxaa+FyqbEclbM9GjiXcfRMkSFL56/6oWz5pG2n1EiAtaxo7/1rtlHVpcJ pc4yNMHI+Mb3OFzPlsuvBbPEtf4BIL3/gRLC+Y6OPiLQlfeG1w5ZIQYM1YnRd2C4HP 1BHe+B1+LmYp/Ovo1Y5S0bVtMyOR8yPKwzy3t9GJ6DP96TYd2H3yoH0z9DLtEOFl2L AUoK/12epO/9ePpIKs5lLDLCuTsnFe/1baD//F3qSNGblayhh1BAI6HtYLSyvjkBT5 5iv/cPDQfCF8PWH4y9YsSIIU= 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 0800740E0031; Mon, 20 Nov 2023 10:42:10 +0000 (UTC) From: Borislav Petkov To: X86 ML Cc: LKML Subject: [PATCH 03/13] x86/CPU/AMD: Move the Zen3 BTC_NO detection to the Zen3 init function Date: Mon, 20 Nov 2023 11:41:42 +0100 Message-ID: <20231120104152.13740-4-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=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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]); Mon, 20 Nov 2023 02:42:56 -0800 (PST) From: "Borislav Petkov (AMD)" No functional changes. Signed-off-by: Borislav Petkov (AMD) --- arch/x86/kernel/cpu/amd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index b3f939101368..92202bad9bd3 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -1031,14 +1031,6 @@ static void init_amd_zn(struct cpuinfo_x86 *c) /* Erratum 1076: CPB feature bit not being set in CPUID. */ if (!cpu_has(c, X86_FEATURE_CPB)) set_cpu_cap(c, X86_FEATURE_CPB); - - /* - * Zen3 (Fam19 model < 0x10) parts are not susceptible to - * Branch Type Confusion, but predate the allocation of the - * BTC_NO bit. - */ - if (c->x86 =3D=3D 0x19 && !cpu_has(c, X86_FEATURE_BTC_NO)) - set_cpu_cap(c, X86_FEATURE_BTC_NO); } } =20 @@ -1054,6 +1046,15 @@ static void init_amd_zen2(struct cpuinfo_x86 *c) =20 static void init_amd_zen3(struct cpuinfo_x86 *c) { + if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) { + /* + * Zen3 (Fam19 model < 0x10) parts are not susceptible to + * Branch Type Confusion, but predate the allocation of the + * BTC_NO bit. + */ + if (!cpu_has(c, X86_FEATURE_BTC_NO)) + set_cpu_cap(c, X86_FEATURE_BTC_NO); + } } =20 static void init_amd_zen4(struct cpuinfo_x86 *c) --=20 2.42.0.rc0.25.ga82fb66fed25