From 30f9599dcfe8d99dff7a25599dcb2953f1c9765c Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Thu, 22 Aug 2024 14:18:59 +0200 Subject: [PATCH] WIP intel hybrid freqs CPUID leaf 0x16 reports base and max freqs. They could be used for better cpukind info, especially when hybrid CPUs have both normal and low-power E-core. However 0x16 reports same freqs for these cores on MTL, while Linux cpufreq is able to distinguish them. Hence those freqs wouldn't bring any precise/useful info yet. Signed-off-by: Brice Goglin --- hwloc/topology-x86.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hwloc/topology-x86.c b/hwloc/topology-x86.c index 55e1fcfab..31d06ec80 100644 --- a/hwloc/topology-x86.c +++ b/hwloc/topology-x86.c @@ -232,6 +232,8 @@ struct procinfo { unsigned hybridcoretype; unsigned hybridnativemodel; + unsigned basefreq; + unsigned maxfreq; }; enum cpuid_type { @@ -744,13 +746,20 @@ static void look_proc(struct hwloc_backend *backend, struct procinfo *infos, uns } if (highest_cpuid >= 0x1a && has_hybrid(features)) { + data->is_hybrid = 1; /* Get hybrid cpu information from cpuid 0x1a on Intel */ eax = 0x1a; ecx = 0; cpuid_or_from_dump(&eax, &ebx, &ecx, &edx, src_cpuiddump); infos->hybridcoretype = eax >> 24; infos->hybridnativemodel = eax & 0xffffff; - data->is_hybrid = 1; + /* Get base and max freq from cpuid 0x16 on Intel */ + eax = 0x16; + ecx = 0; + cpuid_or_from_dump(&eax, &ebx, &ecx, &edx, src_cpuiddump); + infos->basefreq = eax & 0xffff; + infos->maxfreq = ebx & 0xffff; +printf("base %u max %u\n", infos->basefreq, infos->maxfreq); } /*********************************************************************************