From patchwork Wed Nov 29 11:22:32 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: 171275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp267817vqn; Wed, 29 Nov 2023 03:23:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9nbBDl9i/FgTsc6iwm01YvZRHbLbV7wfeESWng/OVZAQBN8qx8d70ubdwbf7V8HLP4bvv X-Received: by 2002:aa7:9dc7:0:b0:6cd:d707:a608 with SMTP id g7-20020aa79dc7000000b006cdd707a608mr680550pfq.14.1701256993032; Wed, 29 Nov 2023 03:23:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701256993; cv=none; d=google.com; s=arc-20160816; b=lBA9o7NEOQEz3tXDEP+1GfSWl3mJt2eveDT8GkiUANXf86d9dPukn1cCZdDbKB9s2y 6sDHTeD3ZbjFKccDVBdf6sOvU62uaBv7+h/iozhDfvDy/tjRPxO61Z401V3W+t2/l8Tx NVqpSZ74uEGm8+RGYwZA+oD6Ccy51GH3udedKyhMmYbxb/sNT7D8/Lw2HFXuxaQ+/UDr sg0zUwfeN9sZ0u33psIAd4menLpAmAG3gHyFpEZ2b1he9Sc7/tvWJqm64595aUuxxFJ8 eS0+Po2rCYFi29MR3vEfHcV4R+VYmDgpJfuBFNs70wjWS41EkisMng6eG97Oxk/myWFE ejtg== 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=KcsRdEhCEWuA2oxqFTOi/En70y4wwOfq3wTyKpaSxdY=; fh=UD1ZRCSS/l4PYbuMk1gSsIJwAKOC33PKfkYvw4GUlo4=; b=XTyi6XiLSO6Nwg9qLdhq8Ii+cieYgYM6okL2mQ5DwfplLXR5Vc5t9S3zfJRmaWTOjg eB3wUfUuJvbpwXc/uk1UnYZAoHzwzeSIdyUpIJ2JjNmdt3dssIaZ+ON+P6Gu19lb4j6g BK4DkG9ew5br1wncz0uyafqTfNb679TyP5V9x9wBA8Bcl6jULvBca4V6MZ07v3BdEfAR bRdqoS8mMcbMAlc9G08m8yTrORZ/mEOAaECaAIhUVXtfhd3ArFykoHyLBMd3SaxvyrLY uov2Xc9+9Dka1NmgebVOuejkFC0oJcVdcHJOO7fI0cqBRSFxk8Pp23DqwHSa3fSk8COI ifEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4VA5GbcJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=2yiEqc2G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id fh28-20020a056a00391c00b006cbaae6a079si14382014pfb.241.2023.11.29.03.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 03:23:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4VA5GbcJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=2yiEqc2G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 7D16D805F2C6; Wed, 29 Nov 2023 03:23:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233128AbjK2LW4 (ORCPT + 99 others); Wed, 29 Nov 2023 06:22:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232454AbjK2LWb (ORCPT ); Wed, 29 Nov 2023 06:22:31 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44CEE10DF; Wed, 29 Nov 2023 03:22:34 -0800 (PST) Date: Wed, 29 Nov 2023 11:22:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701256952; 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=KcsRdEhCEWuA2oxqFTOi/En70y4wwOfq3wTyKpaSxdY=; b=4VA5GbcJQ/Mcazc+zNZiIIHd4qskZMqM99NjUntuhghFVfN/NGV0nwbDPzxYKPcNCb21pD p1oYupoukW7zfHbnbRVp+9wN3qRHdfUYEXGHRMZ3cjI+ldWgZmb3pOongCkh2pUred3cqb Ig0NvBJSuajDLyHCYvWLlxyzKGcjIDO8/p9P5XwHjt8VubHl7cFZapq0fom1oodTCHHUBy 2C0SpM79dQvdziOxzt0smjyUwTZoSLk/r+zzONB/WxTACIWmcCVyvk21K3fOr9mUo7rHcI P7gwxsY6stSvai2Vo8ofPSW153z/UuefLcinNHteKUO35Vwu/5edxmJgSq+nWw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701256952; 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=KcsRdEhCEWuA2oxqFTOi/En70y4wwOfq3wTyKpaSxdY=; b=2yiEqc2Gl2zGQLyLryCeRn+XPI/rYtq80s5Tr7l9eSWQm+5loY0bbta0tiuHZaES2uNAof 1P0qLIFIjykac2DA== 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 the Zen3 BTC_NO detection to the Zen3 init function Cc: "Borislav Petkov (AMD)" , Nikolay Borisov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231120104152.13740-4-bp@alien8.de> References: <20231120104152.13740-4-bp@alien8.de> MIME-Version: 1.0 Message-ID: <170125695229.398.10463194066767455972.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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 29 Nov 2023 03:23:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783079380624508493 X-GMAIL-MSGID: 1783897252975914258 The following commit has been merged into the x86/cpu branch of tip: Commit-ID: affc66cb96f865b3763a8e18add52e133d864f04 Gitweb: https://git.kernel.org/tip/affc66cb96f865b3763a8e18add52e133d864f04 Author: Borislav Petkov (AMD) AuthorDate: Wed, 01 Nov 2023 11:28:31 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 29 Nov 2023 12:11:44 +01:00 x86/CPU/AMD: Move the Zen3 BTC_NO detection to the Zen3 init function No functional changes. Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Nikolay Borisov Link: http://lore.kernel.org/r/20231120104152.13740-4-bp@alien8.de --- 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 0a499cb..3d74347 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 == 0x19 && !cpu_has(c, X86_FEATURE_BTC_NO)) - set_cpu_cap(c, X86_FEATURE_BTC_NO); } } @@ -1094,6 +1086,15 @@ static void init_amd_zen2(struct cpuinfo_x86 *c) 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); + } } static void init_amd_zen4(struct cpuinfo_x86 *c)