mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
tools/power turbostat: Print ucode revision only if valid
[ Upstream commit fb5ceca046 ]
If the MSR read were to fail, turbostat would print "microcode 0x0"
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Reviewed-by: Len Brown <len.brown@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fdfd3e3072
commit
8eaefb463e
@@ -5679,6 +5679,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 long long ucode_patch = 0;
|
unsigned long long ucode_patch = 0;
|
||||||
|
bool ucode_patch_valid = false;
|
||||||
|
|
||||||
eax = ebx = ecx = edx = 0;
|
eax = ebx = ecx = edx = 0;
|
||||||
|
|
||||||
@@ -5708,6 +5709,8 @@ void process_cpuid()
|
|||||||
|
|
||||||
if (get_msr(sched_getcpu(), MSR_IA32_UCODE_REV, &ucode_patch))
|
if (get_msr(sched_getcpu(), MSR_IA32_UCODE_REV, &ucode_patch))
|
||||||
warnx("get_msr(UCODE)");
|
warnx("get_msr(UCODE)");
|
||||||
|
else
|
||||||
|
ucode_patch_valid = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check max extended function levels of CPUID.
|
* check max extended function levels of CPUID.
|
||||||
@@ -5718,9 +5721,12 @@ 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, "CPUID(1): family:model:stepping 0x%x:%x:%x (%d:%d:%d) microcode 0x%x\n",
|
fprintf(outf, "CPUID(1): family:model:stepping 0x%x:%x:%x (%d:%d:%d)",
|
||||||
family, model, stepping, family, model, stepping,
|
family, model, stepping, family, model, stepping);
|
||||||
(unsigned int)((ucode_patch >> 32) & 0xFFFFFFFF));
|
if (ucode_patch_valid)
|
||||||
|
fprintf(outf, " microcode 0x%x", (unsigned int)((ucode_patch >> 32) & 0xFFFFFFFF));
|
||||||
|
fputc('\n', outf);
|
||||||
|
|
||||||
fprintf(outf, "CPUID(0x80000000): max_extended_levels: 0x%x\n", max_extended_level);
|
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" : "-",
|
||||||
|
|||||||
Reference in New Issue
Block a user