summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2025-12-05 11:38:27 -0500
committerLen Brown <len.brown@intel.com>2026-02-04 14:52:11 -0600
commit00b9e2a7fa671e960f8d708b06fb6b4b87ffec15 (patch)
treef00dc9530683aef23eee473cb4a0d25157a94e62
parentbd1b6608d7640aa8b1f1afa831331df7c13184ad (diff)
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>
-rw-r--r--tools/power/x86/turbostat/turbostat.c7
1 files 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 <lenb@kernel.org>\n");
+ fprintf(outf, "turbostat version 2025.12.05 - Len Brown <lenb@kernel.org>\n");
}
#define COMMAND_LINE_SIZE 2048