Commit ed0757b8 authored by Len Brown's avatar Len Brown

tools/power turbostat: print microcode patch level

(also available via "grep microcode /proc/cpuinfo")
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 2af4f9b8
...@@ -5118,6 +5118,7 @@ void process_cpuid() ...@@ -5118,6 +5118,7 @@ void process_cpuid()
unsigned int eax, ebx, ecx, edx; unsigned int eax, ebx, ecx, edx;
unsigned int fms, family, model, stepping, ecx_flags, edx_flags; unsigned int fms, family, model, stepping, ecx_flags, edx_flags;
unsigned int has_turbo; unsigned int has_turbo;
unsigned long long ucode_patch = 0;
eax = ebx = ecx = edx = 0; eax = ebx = ecx = edx = 0;
...@@ -5131,8 +5132,8 @@ void process_cpuid() ...@@ -5131,8 +5132,8 @@ void process_cpuid()
hygon_genuine = 1; hygon_genuine = 1;
if (!quiet) if (!quiet)
fprintf(outf, "CPUID(0): %.4s%.4s%.4s ", fprintf(outf, "CPUID(0): %.4s%.4s%.4s 0x%x CPUID levels\n",
(char *)&ebx, (char *)&edx, (char *)&ecx); (char *)&ebx, (char *)&edx, (char *)&ecx, max_level);
__cpuid(1, fms, ebx, ecx, edx); __cpuid(1, fms, ebx, ecx, edx);
family = (fms >> 8) & 0xf; family = (fms >> 8) & 0xf;
...@@ -5145,6 +5146,9 @@ void process_cpuid() ...@@ -5145,6 +5146,9 @@ void process_cpuid()
ecx_flags = ecx; ecx_flags = ecx;
edx_flags = edx; edx_flags = edx;
if (get_msr(sched_getcpu(), MSR_IA32_UCODE_REV, &ucode_patch))
warnx("get_msr(UCODE)\n");
/* /*
* check max extended function levels of CPUID. * check max extended function levels of CPUID.
* This is needed to check for invariant TSC. * This is needed to check for invariant TSC.
...@@ -5154,8 +5158,9 @@ void process_cpuid() ...@@ -5154,8 +5158,9 @@ void process_cpuid()
__cpuid(0x80000000, max_extended_level, ebx, ecx, edx); __cpuid(0x80000000, max_extended_level, ebx, ecx, edx);
if (!quiet) { if (!quiet) {
fprintf(outf, "0x%x CPUID levels; 0x%x xlevels; family:model:stepping 0x%x:%x:%x (%d:%d:%d)\n", fprintf(outf, "CPUID(1): family:model:stepping 0x%x:%x:%x (%d:%d:%d) microcode 0x%x\n",
max_level, max_extended_level, family, model, stepping, family, model, stepping); family, model, stepping, family, model, stepping, (unsigned int)((ucode_patch >> 32) & 0xFFFFFFFF));
fprintf(outf, "CPUID(0x80000000): max_extended_levels: 0x%x\n", max_extended_level);
fprintf(outf, "CPUID(1): %s %s %s %s %s %s %s %s %s %s\n", fprintf(outf, "CPUID(1): %s %s %s %s %s %s %s %s %s %s\n",
ecx_flags & (1 << 0) ? "SSE3" : "-", ecx_flags & (1 << 0) ? "SSE3" : "-",
ecx_flags & (1 << 3) ? "MONITOR" : "-", ecx_flags & (1 << 3) ? "MONITOR" : "-",
......
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