mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Borislav Petkov (AMD)" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Brian Gerst <brgerst@gmail.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/cpu] x86/CPU/AMD: Add X86_FEATURE_ZEN1
Date: Tue, 12 Dec 2023 10:33:17 -0000	[thread overview]
Message-ID: <170237719725.398.5191492346336231574.tip-bot2@tip-bot2> (raw)
In-Reply-To: <dc3835e3-0731-4230-bbb9-336bbe3d042b@amd.com>

The following commit has been merged into the x86/cpu branch of tip:

Commit-ID:     232afb557835d6f6859c73bf610bad308c96b131
Gitweb:        https://git.kernel.org/tip/232afb557835d6f6859c73bf610bad308c96b131
Author:        Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate:    Sat, 02 Dec 2023 12:50:23 +01:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Tue, 12 Dec 2023 11:17:37 +01:00

x86/CPU/AMD: Add X86_FEATURE_ZEN1

Add a synthetic feature flag specifically for first generation Zen
machines. There's need to have a generic flag for all Zen generations so
make X86_FEATURE_ZEN be that flag.

Fixes: 30fa92832f40 ("x86/CPU/AMD: Add ZenX generations flags")
Suggested-by: Brian Gerst <brgerst@gmail.com>
Suggested-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/dc3835e3-0731-4230-bbb9-336bbe3d042b@amd.com
---
 arch/x86/include/asm/cpufeatures.h       |  3 ++-
 arch/x86/kernel/cpu/amd.c                | 11 ++++++-----
 tools/arch/x86/include/asm/cpufeatures.h |  2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 149cc5d..632c26c 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -218,7 +218,7 @@
 #define X86_FEATURE_IBRS		( 7*32+25) /* Indirect Branch Restricted Speculation */
 #define X86_FEATURE_IBPB		( 7*32+26) /* Indirect Branch Prediction Barrier */
 #define X86_FEATURE_STIBP		( 7*32+27) /* Single Thread Indirect Branch Predictors */
-#define X86_FEATURE_ZEN			( 7*32+28) /* "" CPU based on Zen microarchitecture */
+#define X86_FEATURE_ZEN			( 7*32+28) /* "" Generic flag for all Zen and newer */
 #define X86_FEATURE_L1TF_PTEINV		( 7*32+29) /* "" L1TF workaround PTE inversion */
 #define X86_FEATURE_IBRS_ENHANCED	( 7*32+30) /* Enhanced IBRS */
 #define X86_FEATURE_MSR_IA32_FEAT_CTL	( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */
@@ -315,6 +315,7 @@
 #define X86_FEATURE_ZEN2		(11*32+28) /* "" CPU based on Zen2 microarchitecture */
 #define X86_FEATURE_ZEN3		(11*32+29) /* "" CPU based on Zen3 microarchitecture */
 #define X86_FEATURE_ZEN4		(11*32+30) /* "" CPU based on Zen4 microarchitecture */
+#define X86_FEATURE_ZEN1		(11*32+31) /* "" CPU based on Zen1 microarchitecture */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
 #define X86_FEATURE_AVX_VNNI		(12*32+ 4) /* AVX VNNI instructions */
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 89bbb1a..3395863 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -542,7 +542,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
 		switch (c->x86_model) {
 		case 0x00 ... 0x2f:
 		case 0x50 ... 0x5f:
-			setup_force_cpu_cap(X86_FEATURE_ZEN);
+			setup_force_cpu_cap(X86_FEATURE_ZEN1);
 			break;
 		case 0x30 ... 0x4f:
 		case 0x60 ... 0x7f:
@@ -948,12 +948,13 @@ void init_spectral_chicken(struct cpuinfo_x86 *c)
 
 static void init_amd_zen_common(void)
 {
+	setup_force_cpu_cap(X86_FEATURE_ZEN);
 #ifdef CONFIG_NUMA
 	node_reclaim_distance = 32;
 #endif
 }
 
-static void init_amd_zen(struct cpuinfo_x86 *c)
+static void init_amd_zen1(struct cpuinfo_x86 *c)
 {
 	init_amd_zen_common();
 	fix_erratum_1386(c);
@@ -1075,8 +1076,8 @@ static void init_amd(struct cpuinfo_x86 *c)
 	case 0x16: init_amd_jg(c); break;
 	}
 
-	if (boot_cpu_has(X86_FEATURE_ZEN))
-		init_amd_zen(c);
+	if (boot_cpu_has(X86_FEATURE_ZEN1))
+		init_amd_zen1(c);
 	else if (boot_cpu_has(X86_FEATURE_ZEN2))
 		init_amd_zen2(c);
 	else if (boot_cpu_has(X86_FEATURE_ZEN3))
@@ -1143,7 +1144,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 	 * Counter May Be Inaccurate".
 	 */
 	if (cpu_has(c, X86_FEATURE_IRPERF) &&
-	    (boot_cpu_has(X86_FEATURE_ZEN) && c->x86_model > 0x2f))
+	    (boot_cpu_has(X86_FEATURE_ZEN1) && c->x86_model > 0x2f))
 		msr_set_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
 
 	check_null_seg_clears_base(c);
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h
index 798e60b..845a402 100644
--- a/tools/arch/x86/include/asm/cpufeatures.h
+++ b/tools/arch/x86/include/asm/cpufeatures.h
@@ -219,7 +219,7 @@
 #define X86_FEATURE_IBRS		( 7*32+25) /* Indirect Branch Restricted Speculation */
 #define X86_FEATURE_IBPB		( 7*32+26) /* Indirect Branch Prediction Barrier */
 #define X86_FEATURE_STIBP		( 7*32+27) /* Single Thread Indirect Branch Predictors */
-#define X86_FEATURE_ZEN			(7*32+28) /* "" CPU based on Zen microarchitecture */
+#define X86_FEATURE_ZEN			( 7*32+28) /* "" Generic flag for all Zen and newer */
 #define X86_FEATURE_L1TF_PTEINV		( 7*32+29) /* "" L1TF workaround PTE inversion */
 #define X86_FEATURE_IBRS_ENHANCED	( 7*32+30) /* Enhanced IBRS */
 #define X86_FEATURE_MSR_IA32_FEAT_CTL	( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */

  parent reply	other threads:[~2023-12-12 10:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 10:41 [PATCH 00/13] x86/CPU/AMD: Rework Zen family detection and other fun Borislav Petkov
2023-11-20 10:41 ` [PATCH 01/13] x86/CPU/AMD: Add ZenX generations flags Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-30 17:05   ` [PATCH 01/13] " Tom Lendacky
2023-11-30 17:13     ` Borislav Petkov
2023-11-30 17:30       ` Brian Gerst
2023-11-30 18:17       ` Tom Lendacky
2023-11-30 18:50         ` Borislav Petkov
2023-12-02 12:49           ` [PATCH] x86/CPU/AMD: Add X86_FEATURE_ZEN1 Borislav Petkov
2023-12-04 14:36             ` Tom Lendacky
2023-12-04 15:32               ` Borislav Petkov
2023-12-12 10:33     ` tip-bot2 for Borislav Petkov (AMD) [this message]
2023-11-20 10:41 ` [PATCH 02/13] x86/CPU/AMD: Carve out the erratum 1386 fix Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 03/13] x86/CPU/AMD: Move the Zen3 BTC_NO detection to the Zen3 init function Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 04/13] x86/CPU/AMD: Move erratum 1076 fix into the Zen1 " Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 05/13] x86/CPU/AMD: Call the spectral chicken in the Zen2 " Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 06/13] x86/CPU/AMD: Rename init_amd_zn() to init_amd_zen_common() Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 07/13] x86/CPU/AMD: Move Zenbleed check to the Zen2 init function Borislav Petkov
2023-11-20 12:53   ` Nikolay Borisov
2023-11-21 10:41     ` Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 08/13] x86/CPU/AMD: Move the DIV0 bug detection to the Zen1 " Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 09/13] x86/CPU/AMD: Get rid of amd_erratum_1054[] Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 10/13] x86/CPU/AMD: Get rid of amd_erratum_383[] Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 11/13] x86/CPU/AMD: Get rid of amd_erratum_400[] Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 12/13] x86/CPU/AMD: Get rid of amd_erratum_1485[] Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 10:41 ` [PATCH 13/13] x86/CPU/AMD: Drop now unused CPU erratum checking function Borislav Petkov
2023-11-29 11:22   ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2023-11-20 15:08 ` [PATCH 00/13] x86/CPU/AMD: Rework Zen family detection and other fun Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170237719725.398.5191492346336231574.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®