[PATCH v1 3/5] x86/cpu: Introduce identify_cpu_32() helper

From: Ihor Solodrai

Date: Fri Jul 03 2026 - 20:24:36 EST


Both identify_boot_cpu() and identify_secondary_cpu() call enable_sep_cpu()
under a CONFIG_X86_32 #ifdef. Move that into a new identify_cpu_32() helper
guarded by IS_ENABLED(CONFIG_X86_32).

Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
---
arch/x86/kernel/cpu/common.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index b9a736728a0e..519e495c4a14 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2146,14 +2146,20 @@ void enable_sep_cpu(void)
}
#endif

+static void identify_cpu_32(struct cpuinfo_x86 *c)
+{
+ if (!IS_ENABLED(CONFIG_X86_32))
+ return;
+
+ enable_sep_cpu();
+}
+
static __init void identify_boot_cpu(void)
{
identify_cpu(&boot_cpu_data);
if (HAS_KERNEL_IBT && cpu_feature_enabled(X86_FEATURE_IBT))
pr_info("CET detected: Indirect Branch Tracking enabled\n");
-#ifdef CONFIG_X86_32
- enable_sep_cpu();
-#endif
+ identify_cpu_32(&boot_cpu_data);
cpu_detect_tlb(&boot_cpu_data);
setup_cr_pinning();

@@ -2173,9 +2179,7 @@ void identify_secondary_cpu(unsigned int cpu)
c->cpu_index = cpu;

identify_cpu(c);
-#ifdef CONFIG_X86_32
- enable_sep_cpu();
-#endif
+ identify_cpu_32(c);
x86_spec_ctrl_setup_ap();
update_srbds_msr();
if (boot_cpu_has_bug(X86_BUG_GDS))
--
2.54.0