From 00b9e2a7fa671e960f8d708b06fb6b4b87ffec15 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Fri, 5 Dec 2025 11:38:27 -0500 Subject: [PATCH] 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 --- tools/power/x86/turbostat/turbostat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index a209c5d87ff7..0ef36f0330a9 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -498,6 +498,7 @@ unsigned int list_header_only; unsigned int dump_only; unsigned int force_load; unsigned int cpuid_has_aperf_mperf; +unsigned int cpuid_has_hv; unsigned int has_aperf_access; unsigned int has_epb; unsigned int has_turbo; @@ -8803,6 +8804,7 @@ void process_cpuid() model += ((fms >> 16) & 0xf) << 4; ecx_flags = ecx; edx_flags = edx; + cpuid_has_hv = ecx_flags & (1 << 31); if (!no_msr) { if (get_msr(sched_getcpu(), MSR_IA32_UCODE_REV, &ucode_patch)) @@ -8826,12 +8828,13 @@ void process_cpuid() fputc('\n', outf); fprintf(outf, "CPUID(0x80000000): max_extended_levels: 0x%x\n", max_extended_level); - fprintf(outf, "CPUID(1): %sSSE3 %sMONITOR %sSMX %sEIST %sTM2 %sTSC %sMSR %sACPI-TM %sHT %sTM\n", + fprintf(outf, "CPUID(1): %sSSE3 %sMONITOR %sSMX %sEIST %sTM2 %sHV %sTSC %sMSR %sACPI-TM %sHT %sTM\n", ecx_flags & (1 << 0) ? "" : "No-", ecx_flags & (1 << 3) ? "" : "No-", ecx_flags & (1 << 6) ? "" : "No-", ecx_flags & (1 << 7) ? "" : "No-", ecx_flags & (1 << 8) ? "" : "No-", + cpuid_has_hv ? "" : "No-", edx_flags & (1 << 4) ? "" : "No-", edx_flags & (1 << 5) ? "" : "No-", 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) void print_version() { - fprintf(outf, "turbostat version 2025.12.02 - Len Brown \n"); + fprintf(outf, "turbostat version 2025.12.05 - Len Brown \n"); } #define COMMAND_LINE_SIZE 2048 -- 2.47.3