Skip to content

Commit 00b9e2a

Browse files
committed
tools/power turbostat: Dump CPUID.1.ECX[31] (Hypervisor)
Both Intel and AMD use CPUID.1.ECX[31] to distinguish between hypervisor and real hardware. Indicate "HV" or "No-HV" accordingly. Signed-off-by: Len Brown <len.brown@intel.com>
1 parent bd1b660 commit 00b9e2a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ unsigned int list_header_only;
498498
unsigned int dump_only;
499499
unsigned int force_load;
500500
unsigned int cpuid_has_aperf_mperf;
501+
unsigned int cpuid_has_hv;
501502
unsigned int has_aperf_access;
502503
unsigned int has_epb;
503504
unsigned int has_turbo;
@@ -8803,6 +8804,7 @@ void process_cpuid()
88038804
model += ((fms >> 16) & 0xf) << 4;
88048805
ecx_flags = ecx;
88058806
edx_flags = edx;
8807+
cpuid_has_hv = ecx_flags & (1 << 31);
88068808

88078809
if (!no_msr) {
88088810
if (get_msr(sched_getcpu(), MSR_IA32_UCODE_REV, &ucode_patch))
@@ -8826,12 +8828,13 @@ void process_cpuid()
88268828
fputc('\n', outf);
88278829

88288830
fprintf(outf, "CPUID(0x80000000): max_extended_levels: 0x%x\n", max_extended_level);
8829-
fprintf(outf, "CPUID(1): %sSSE3 %sMONITOR %sSMX %sEIST %sTM2 %sTSC %sMSR %sACPI-TM %sHT %sTM\n",
8831+
fprintf(outf, "CPUID(1): %sSSE3 %sMONITOR %sSMX %sEIST %sTM2 %sHV %sTSC %sMSR %sACPI-TM %sHT %sTM\n",
88308832
ecx_flags & (1 << 0) ? "" : "No-",
88318833
ecx_flags & (1 << 3) ? "" : "No-",
88328834
ecx_flags & (1 << 6) ? "" : "No-",
88338835
ecx_flags & (1 << 7) ? "" : "No-",
88348836
ecx_flags & (1 << 8) ? "" : "No-",
8837+
cpuid_has_hv ? "" : "No-",
88358838
edx_flags & (1 << 4) ? "" : "No-",
88368839
edx_flags & (1 << 5) ? "" : "No-",
88378840
edx_flags & (1 << 22) ? "" : "No-", edx_flags & (1 << 28) ? "" : "No-", edx_flags & (1 << 29) ? "" : "No-");
@@ -10145,7 +10148,7 @@ int get_and_dump_counters(void)
1014510148

1014610149
void print_version()
1014710150
{
10148-
fprintf(outf, "turbostat version 2025.12.02 - Len Brown <lenb@kernel.org>\n");
10151+
fprintf(outf, "turbostat version 2025.12.05 - Len Brown <lenb@kernel.org>\n");
1014910152
}
1015010153

1015110154
#define COMMAND_LINE_SIZE 2048

0 commit comments

Comments
 (0)