]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tools/power turbostat: Dump hypervisor name
authorLen Brown <len.brown@intel.com>
Fri, 5 Dec 2025 17:24:20 +0000 (12:24 -0500)
committerLen Brown <len.brown@intel.com>
Wed, 4 Feb 2026 20:52:11 +0000 (14:52 -0600)
Sometimes useful to know which hypervisor is running beneath us...

Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c

index 0ef36f0330a95f7dbfaa4980618fcd71665b9200..97cd9c5a00929d133c230c2d4fe1591e5b900f19 100644 (file)
@@ -8772,6 +8772,27 @@ void probe_pstates(void)
        for_all_cpus(print_epb, ODD_COUNTERS);
        for_all_cpus(print_perf_limit, ODD_COUNTERS);
 }
+void dump_word_chars(unsigned int word)
+{
+       int i;
+
+       for (i = 0; i < 4; ++i)
+               fprintf(outf, "%c", (word >> (i * 8)) & 0xFF);
+}
+void dump_cpuid_hypervisor(void)
+{
+       unsigned int ebx = 0;
+       unsigned int ecx = 0;
+       unsigned int edx = 0;
+
+       __cpuid(0x40000000, max_extended_level, ebx, ecx, edx);
+
+       fprintf(outf, "Hypervisor: ");
+       dump_word_chars(ebx);
+       dump_word_chars(ecx);
+       dump_word_chars(edx);
+       fprintf(outf, "\n");
+}
 
 void process_cpuid()
 {
@@ -8839,6 +8860,8 @@ void process_cpuid()
                        edx_flags & (1 << 5) ? "" : "No-",
                        edx_flags & (1 << 22) ? "" : "No-", edx_flags & (1 << 28) ? "" : "No-", edx_flags & (1 << 29) ? "" : "No-");
        }
+       if (!quiet && cpuid_has_hv)
+               dump_cpuid_hypervisor();
 
        probe_platform_features(family, model);