diff options
author | Pu Wen <puwen@hygon.cn> | 2019-08-30 22:20:31 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2019-08-31 14:48:39 -0400 |
commit | c1c10cc77883932abdb7b103687ecbb01e80bef9 (patch) | |
tree | 8ff227871808a1aae2e6b26709c594400e4fbf7c | |
parent | 9cfa8e042f7cbb1994cc5923e46c78b36f6054f4 (diff) |
tools/power turbostat: Add support for Hygon Fam 18h (Dhyana) RAPL
Commit 9392bd98bba760be96ee ("tools/power turbostat: Add support for AMD
Fam 17h (Zen) RAPL") and the commit 3316f99a9f1b68c578c5 ("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 <puwen@hygon.cn>
Reviewed-by: Calvin Walton <calvin.walton@kepstin.ca>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 6cec6aa01241..e8b6c608d6d1 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -59,6 +59,7 @@ unsigned int do_irtl_hsw; | |||
59 | unsigned int units = 1000000; /* MHz etc */ | 59 | unsigned int units = 1000000; /* MHz etc */ |
60 | unsigned int genuine_intel; | 60 | unsigned int genuine_intel; |
61 | unsigned int authentic_amd; | 61 | unsigned int authentic_amd; |
62 | unsigned int hygon_genuine; | ||
62 | unsigned int max_level, max_extended_level; | 63 | unsigned int max_level, max_extended_level; |
63 | unsigned int has_invariant_tsc; | 64 | unsigned int has_invariant_tsc; |
64 | unsigned int do_nhm_platform_info; | 65 | unsigned int do_nhm_platform_info; |
@@ -1730,7 +1731,7 @@ void get_apic_id(struct thread_data *t) | |||
1730 | if (!DO_BIC(BIC_X2APIC)) | 1731 | if (!DO_BIC(BIC_X2APIC)) |
1731 | return; | 1732 | return; |
1732 | 1733 | ||
1733 | if (authentic_amd) { | 1734 | if (authentic_amd || hygon_genuine) { |
1734 | unsigned int topology_extensions; | 1735 | unsigned int topology_extensions; |
1735 | 1736 | ||
1736 | if (max_extended_level < 0x8000001e) | 1737 | if (max_extended_level < 0x8000001e) |
@@ -3831,6 +3832,7 @@ double get_tdp_amd(unsigned int family) | |||
3831 | { | 3832 | { |
3832 | switch (family) { | 3833 | switch (family) { |
3833 | case 0x17: | 3834 | case 0x17: |
3835 | case 0x18: | ||
3834 | default: | 3836 | default: |
3835 | /* This is the max stock TDP of HEDT/Server Fam17h chips */ | 3837 | /* This is the max stock TDP of HEDT/Server Fam17h chips */ |
3836 | return 250.0; | 3838 | return 250.0; |
@@ -4011,6 +4013,7 @@ void rapl_probe_amd(unsigned int family, unsigned int model) | |||
4011 | 4013 | ||
4012 | switch (family) { | 4014 | switch (family) { |
4013 | case 0x17: /* Zen, Zen+ */ | 4015 | case 0x17: /* Zen, Zen+ */ |
4016 | case 0x18: /* Hygon Dhyana */ | ||
4014 | do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY; | 4017 | do_rapl = RAPL_AMD_F17H | RAPL_PER_CORE_ENERGY; |
4015 | if (rapl_joules) { | 4018 | if (rapl_joules) { |
4016 | BIC_PRESENT(BIC_Pkg_J); | 4019 | BIC_PRESENT(BIC_Pkg_J); |
@@ -4047,7 +4050,7 @@ void rapl_probe(unsigned int family, unsigned int model) | |||
4047 | { | 4050 | { |
4048 | if (genuine_intel) | 4051 | if (genuine_intel) |
4049 | rapl_probe_intel(family, model); | 4052 | rapl_probe_intel(family, model); |
4050 | if (authentic_amd) | 4053 | if (authentic_amd || hygon_genuine) |
4051 | rapl_probe_amd(family, model); | 4054 | rapl_probe_amd(family, model); |
4052 | } | 4055 | } |
4053 | 4056 | ||
@@ -4632,6 +4635,8 @@ void process_cpuid() | |||
4632 | genuine_intel = 1; | 4635 | genuine_intel = 1; |
4633 | else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) | 4636 | else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) |
4634 | authentic_amd = 1; | 4637 | authentic_amd = 1; |
4638 | else if (ebx == 0x6f677948 && ecx == 0x656e6975 && edx == 0x6e65476e) | ||
4639 | hygon_genuine = 1; | ||
4635 | 4640 | ||
4636 | if (!quiet) | 4641 | if (!quiet) |
4637 | fprintf(outf, "CPUID(0): %.4s%.4s%.4s ", | 4642 | fprintf(outf, "CPUID(0): %.4s%.4s%.4s ", |