Skip to content

Commit c1c10cc

Browse files
Pu Wenlenb
authored andcommitted
tools/power turbostat: Add support for Hygon Fam 18h (Dhyana) RAPL
Commit 9392bd9 ("tools/power turbostat: Add support for AMD Fam 17h (Zen) RAPL") and the commit 3316f99 ("tools/power turbostat: Also read package power on AMD F17h (Zen)") add AMD Fam 17h RAPL support. Hygon Family 18h(Dhyana) support RAPL in bit 14 of CPUID 0x80000007 EDX, and has MSRs RAPL_PWR_UNIT/CORE_ENERGY_STAT/PKG_ENERGY_STAT. So add Hygon Dhyana Family 18h support for RAPL. Already tested on Hygon multi-node systems and it shows correct per-core energy usage and the total package power. Signed-off-by: Pu Wen <[email protected]> Reviewed-by: Calvin Walton <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent 9cfa8e0 commit c1c10cc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ unsigned int do_irtl_hsw;
5959
unsigned int units = 1000000; /* MHz etc */
6060
unsigned int genuine_intel;
6161
unsigned int authentic_amd;
62+
unsigned int hygon_genuine;
6263
unsigned int max_level, max_extended_level;
6364
unsigned int has_invariant_tsc;
6465
unsigned int do_nhm_platform_info;
@@ -1730,7 +1731,7 @@ void get_apic_id(struct thread_data *t)
17301731
if (!DO_BIC(BIC_X2APIC))
17311732
return;
17321733

1733-
if (authentic_amd) {
1734+
if (authentic_amd || hygon_genuine) {
17341735
unsigned int topology_extensions;
17351736

17361737
if (max_extended_level < 0x8000001e)
@@ -3831,6 +3832,7 @@ double get_tdp_amd(unsigned int family)
38313832
{
38323833
switch (family) {
38333834
case 0x17:
3835+
case 0x18:
38343836
default:
38353837
/* This is the max stock TDP of HEDT/Server Fam17h chips */
38363838
return 250.0;
@@ -4011,6 +4013,7 @@ void rapl_probe_amd(unsigned int family, unsigned int model)
40114013

40124014
switch (family) {
40134015
case 0x17: /* Zen, Zen+ */
4016+
case 0x18: /* Hygon Dhyana */
40144017
do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY;
40154018
if (rapl_joules) {
40164019
BIC_PRESENT(BIC_Pkg_J);
@@ -4047,7 +4050,7 @@ void rapl_probe(unsigned int family, unsigned int model)
40474050
{
40484051
if (genuine_intel)
40494052
rapl_probe_intel(family, model);
4050-
if (authentic_amd)
4053+
if (authentic_amd || hygon_genuine)
40514054
rapl_probe_amd(family, model);
40524055
}
40534056

@@ -4632,6 +4635,8 @@ void process_cpuid()
46324635
genuine_intel = 1;
46334636
else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
46344637
authentic_amd = 1;
4638+
else if (ebx == 0x6f677948 && ecx == 0x656e6975 && edx == 0x6e65476e)
4639+
hygon_genuine = 1;
46354640

46364641
if (!quiet)
46374642
fprintf(outf, "CPUID(0): %.4s%.4s%.4s ",

0 commit comments

Comments
 (0)