Skip to content

Commit 33eb822

Browse files
kimphillamdlenb
authored andcommitted
tools/power turbostat: Support AMD Family 19h
Family 19h processors have the same RAPL (Running average power limit) hardware register interface as Family 17h processors. Change the family checks to succeed for Family 17h and above to enable core and package energy measurement on Family 19h machines. Also update the TDP to the largest found at the bottom of the page at amd.com->processors->servers->epyc->2nd-gen-epyc, i.e., the EPYC 7H12. Signed-off-by: Kim Phillips <kim.phillips@amd.com> Cc: Len Brown <len.brown@intel.com> Cc: Len Brown <lenb@kernel.org> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 20de0da commit 33eb822

1 file changed

Lines changed: 11 additions & 23 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4162,13 +4162,8 @@ double get_tdp_intel(unsigned int model)
41624162

41634163
double get_tdp_amd(unsigned int family)
41644164
{
4165-
switch (family) {
4166-
case 0x17:
4167-
case 0x18:
4168-
default:
4169-
/* This is the max stock TDP of HEDT/Server Fam17h chips */
4170-
return 250.0;
4171-
}
4165+
/* This is the max stock TDP of HEDT/Server Fam17h+ chips */
4166+
return 280.0;
41724167
}
41734168

41744169
/*
@@ -4358,27 +4353,20 @@ void rapl_probe_amd(unsigned int family, unsigned int model)
43584353

43594354
if (max_extended_level >= 0x80000007) {
43604355
__cpuid(0x80000007, eax, ebx, ecx, edx);
4361-
/* RAPL (Fam 17h) */
4356+
/* RAPL (Fam 17h+) */
43624357
has_rapl = edx & (1 << 14);
43634358
}
43644359

4365-
if (!has_rapl)
4360+
if (!has_rapl || family < 0x17)
43664361
return;
43674362

4368-
switch (family) {
4369-
case 0x17: /* Zen, Zen+ */
4370-
case 0x18: /* Hygon Dhyana */
4371-
do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY;
4372-
if (rapl_joules) {
4373-
BIC_PRESENT(BIC_Pkg_J);
4374-
BIC_PRESENT(BIC_Cor_J);
4375-
} else {
4376-
BIC_PRESENT(BIC_PkgWatt);
4377-
BIC_PRESENT(BIC_CorWatt);
4378-
}
4379-
break;
4380-
default:
4381-
return;
4363+
do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY;
4364+
if (rapl_joules) {
4365+
BIC_PRESENT(BIC_Pkg_J);
4366+
BIC_PRESENT(BIC_Cor_J);
4367+
} else {
4368+
BIC_PRESENT(BIC_PkgWatt);
4369+
BIC_PRESENT(BIC_CorWatt);
43824370
}
43834371

43844372
if (get_msr(base_cpu, MSR_RAPL_PWR_UNIT, &msr))

0 commit comments

Comments
 (0)