]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools/power/x86/intel-speed-select: Fix cpu extended family ID decoding
authorZhang Rui <rui.zhang@intel.com>
Mon, 26 Jan 2026 00:27:01 +0000 (08:27 +0800)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Sun, 5 Apr 2026 18:44:38 +0000 (11:44 -0700)
When decode and use CPU extended family ID in intel-speed-select, there
are several potential issues,
1. Mask with 0x0f to get CPU extended family ID is bogus because
   CPU extended family ID takes 8 bits (bit 27:20).
2. Use CPU extended family ID fields without checking CPU family ID is
   risky. Because Intel SDM says, "The Extended Family ID needs to be
   examined only when the Family ID is 0FH."
3. Saving cpu family ID and cpu extended family ID separately doesn't
   align with Linux kernel. And it may bring extra complexity when
   making family specific changes in the future.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
tools/power/x86/intel-speed-select/isst-config.c

index 652ef1f567ad8f13e8d89f887d910c8d72cae6ba..3f2573ecca762c0bc05d94844b37e46090a0d9a2 100644 (file)
@@ -26,7 +26,7 @@ static FILE *outf;
 
 static int cpu_model;
 static int cpu_stepping;
-static int extended_family;
+static int cpu_family;
 
 #define MAX_CPUS_IN_ONE_REQ 512
 static short max_target_cpus;
@@ -158,7 +158,7 @@ int is_icx_platform(void)
 
 static int is_dmr_plus_platform(void)
 {
-       if (extended_family == 0x04)
+       if (cpu_family == 19)
                return 1;
 
        return 0;
@@ -167,13 +167,14 @@ static int is_dmr_plus_platform(void)
 static int update_cpu_model(void)
 {
        unsigned int ebx, ecx, edx;
-       unsigned int fms, family;
+       unsigned int fms;
 
        __cpuid(1, fms, ebx, ecx, edx);
-       family = (fms >> 8) & 0xf;
-       extended_family = (fms >> 20) & 0x0f;
+       cpu_family = (fms >> 8) & 0xf;
+       if (cpu_family == 0xf)
+               cpu_family += (fms >> 20) & 0xff;
        cpu_model = (fms >> 4) & 0xf;
-       if (family == 6 || family == 0xf)
+       if (cpu_family == 6 || cpu_family == 0xf)
                cpu_model += ((fms >> 16) & 0xf) << 4;
 
        cpu_stepping = fms & 0xf;