Commit 6bcca4fd authored by Len Brown's avatar Len Brown Committed by Tim Gardner

tools/power turbostat: CPUID(0x16) leaf shows base, max, and bus frequency

BugLink: http://bugs.launchpad.net/bugs/1591802

This CPUID leaf is available on Skylake:

CPUID(0x16): base_mhz: 1500 max_mhz: 2200 bus_mhz: 100
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
(cherry picked from commit 61a87ba7)
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
Acked-by: default avatarBrad Figg <brad.figg@canonical.com>
Acked-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 6a09d181
...@@ -2688,7 +2688,7 @@ void decode_misc_enable_msr(void) ...@@ -2688,7 +2688,7 @@ void decode_misc_enable_msr(void)
void process_cpuid() void process_cpuid()
{ {
unsigned int eax, ebx, ecx, edx, max_level; unsigned int eax, ebx, ecx, edx, max_level, max_extended_level;
unsigned int fms, family, model, stepping; unsigned int fms, family, model, stepping;
eax = ebx = ecx = edx = 0; eax = ebx = ecx = edx = 0;
...@@ -2732,9 +2732,9 @@ void process_cpuid() ...@@ -2732,9 +2732,9 @@ void process_cpuid()
* This check is valid for both Intel and AMD. * This check is valid for both Intel and AMD.
*/ */
ebx = ecx = edx = 0; ebx = ecx = edx = 0;
__get_cpuid(0x80000000, &max_level, &ebx, &ecx, &edx); __get_cpuid(0x80000000, &max_extended_level, &ebx, &ecx, &edx);
if (max_level >= 0x80000007) { if (max_extended_level >= 0x80000007) {
/* /*
* Non-Stop TSC is advertised by CPUID.EAX=0x80000007: EDX.bit8 * Non-Stop TSC is advertised by CPUID.EAX=0x80000007: EDX.bit8
...@@ -2765,7 +2765,7 @@ void process_cpuid() ...@@ -2765,7 +2765,7 @@ void process_cpuid()
if (debug) if (debug)
decode_misc_enable_msr(); decode_misc_enable_msr();
if (max_level > 0x15) { if (max_level >= 0x15) {
unsigned int eax_crystal; unsigned int eax_crystal;
unsigned int ebx_tsc; unsigned int ebx_tsc;
...@@ -2799,6 +2799,19 @@ void process_cpuid() ...@@ -2799,6 +2799,19 @@ void process_cpuid()
} }
} }
} }
if (max_level >= 0x16) {
unsigned int base_mhz, max_mhz, bus_mhz, edx;
/*
* CPUID 16H Base MHz, Max MHz, Bus MHz
*/
base_mhz = max_mhz = bus_mhz = edx = 0;
__get_cpuid(0x16, &base_mhz, &max_mhz, &bus_mhz, &edx);
if (debug)
fprintf(stderr, "CPUID(0x16): base_mhz: %d max_mhz: %d bus_mhz: %d\n",
base_mhz, max_mhz, bus_mhz);
}
if (has_aperf) if (has_aperf)
aperf_mperf_multiplier = get_aperf_mperf_multiplier(family, model); aperf_mperf_multiplier = get_aperf_mperf_multiplier(family, model);
...@@ -3151,7 +3164,7 @@ int get_and_dump_counters(void) ...@@ -3151,7 +3164,7 @@ int get_and_dump_counters(void)
} }
void print_version() { void print_version() {
fprintf(stderr, "turbostat version 4.8 26-Sep, 2015" fprintf(stderr, "turbostat version 4.9 22 Nov, 2015"
" - Len Brown <lenb@kernel.org>\n"); " - Len Brown <lenb@kernel.org>\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment