git: d1c4838a7464 - stable/15 - x86: add cpu_stdext_feature5

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 28 Sep 2026 01:04:53 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=d1c4838a746489dc2f53bef5964f8ad40ced7173

commit d1c4838a746489dc2f53bef5964f8ad40ced7173
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-19 08:02:56 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-28 01:03:27 +0000

    x86: add cpu_stdext_feature5
    
    (cherry picked from commit 71f08bfa02a93d5d165ce96abc9077f36e4963b6)
---
 sys/x86/include/specialreg.h |  5 +++++
 sys/x86/include/x86_var.h    |  1 +
 sys/x86/x86/identcpu.c       | 10 ++++++++++
 3 files changed, 16 insertions(+)

diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h
index 41ca638152d3..f32faec25e45 100644
--- a/sys/x86/include/specialreg.h
+++ b/sys/x86/include/specialreg.h
@@ -558,6 +558,11 @@
 #define	CPUID_STDEXT4_NMISRC		0x00100000
 #define	CPUID_STDEXT4_LAM		0x04000000
 
+/*
+ * CPUID instruction 7 Structured Extended Features, leaf 1 ecx info
+ */
+#define	CPUID_STDEXT5_MSR_IMM		0x00000020
+
 /* CPUID_HYBRID_ID leaf 0x1a */
 #define	CPUID_HYBRID_CORE_MASK	0xff000000
 #define	CPUID_HYBRID_SMALL_CORE	0x20000000
diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h
index 1711b13b6af6..ca0ac1e97768 100644
--- a/sys/x86/include/x86_var.h
+++ b/sys/x86/include/x86_var.h
@@ -51,6 +51,7 @@ extern	u_int	cpu_stdext_feature;
 extern	u_int	cpu_stdext_feature2;
 extern	u_int	cpu_stdext_feature3;
 extern	u_int	cpu_stdext_feature4;
+extern	u_int	cpu_stdext_feature5;
 extern	uint64_t cpu_ia32_arch_caps;
 extern	u_int	cpu_high;
 extern	u_int	cpu_id;
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index 51ee58f4de87..208ac8a7bddc 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -117,6 +117,7 @@ u_int	cpu_stdext_feature2;	/* %ecx */
 u_int	cpu_stdext_feature3;	/* %edx */
 /* leaf 7 %ecx = 1 */
 u_int	cpu_stdext_feature4;	/* %eax */
+u_int	cpu_stdext_feature5;	/* %ecx */
 uint64_t cpu_ia32_arch_caps;
 u_int	cpu_max_ext_state_size;
 u_int	cpu_mon_mwait_flags;	/* MONITOR/MWAIT flags (CPUID.05H.ECX) */
@@ -1063,6 +1064,14 @@ printcpuinfo(void)
 				       );
 			}
 
+			if (cpu_stdext_feature5 != 0) {
+				printf("\n  Structured Extended Features5=0x%b",
+				    cpu_stdext_feature5,
+				       "\020"
+				       "\006MSR_IMM"
+				       );
+			}
+
 			if ((cpu_feature2 & CPUID2_XSAVE) != 0) {
 				cpuid_count(0xd, 0x1, regs);
 				if (regs[0] != 0) {
@@ -1615,6 +1624,7 @@ identify_cpu2(void)
 		if (max_eax_l7 >= 1) {
 			cpuid_count(7, 1, regs);
 			cpu_stdext_feature4 = regs[0];
+			cpu_stdext_feature5 = regs[2];
 		}
 	}
 }