Commit 00b9e2a7 authored by Len Brown's avatar Len Brown
Browse files

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: default avatarLen Brown <len.brown@intel.com>
parent bd1b6608
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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