Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2019-05-19 16:53:24 +0200
committerBorislav Petkov <bp@suse.de>2019-05-19 16:53:24 +0200
commitbc59bd03590adb81a2c7d1ae8c1c9470883f0880 (patch)
treee4a64fa2550f2e484a2f9815eaf6db7a833523a4
parent41d77bc1c64153d50b6cadb6c45139e0ec02c811 (diff)
tools/cpupower: Add Hygon Dhyana support (fate#327735).
-rw-r--r--patches.arch/tools-cpupower-add-hygon-dhyana-support.patch115
-rw-r--r--series.conf1
2 files changed, 116 insertions, 0 deletions
diff --git a/patches.arch/tools-cpupower-add-hygon-dhyana-support.patch b/patches.arch/tools-cpupower-add-hygon-dhyana-support.patch
new file mode 100644
index 0000000000..2509caa3f4
--- /dev/null
+++ b/patches.arch/tools-cpupower-add-hygon-dhyana-support.patch
@@ -0,0 +1,115 @@
+From: Pu Wen <puwen@hygon.cn>
+Date: Thu, 4 Oct 2018 09:21:43 +0800
+Subject: tools/cpupower: Add Hygon Dhyana support
+Git-commit: 995d5f64b62f20f05b8e0972f07ec4d6c23333c9
+Patch-mainline: v4.20-rc1
+References: fate#327735
+
+The tool cpupower is useful to get CPU frequency information and monitor
+power stats on the Hygon Dhyana platform. So add Hygon Dhyana support to
+it by checking vendor and family to share the code path of AMD family
+17h.
+
+Signed-off-by: Pu Wen <puwen@hygon.cn>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Acked-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
+CC: Prarit Bhargava <prarit@redhat.com>
+CC: Shuah Khan <shuah@kernel.org>
+CC: Thomas Gleixner <tglx@linutronix.de>
+CC: Thomas Renninger <trenn@suse.com>
+CC: linux-pm@vger.kernel.org
+Link: http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn
+---
+ tools/power/cpupower/utils/cpufreq-info.c | 6 ++++--
+ tools/power/cpupower/utils/helpers/amd.c | 1 -
+ tools/power/cpupower/utils/helpers/cpuid.c | 8 +++++---
+ tools/power/cpupower/utils/helpers/helpers.h | 2 +-
+ tools/power/cpupower/utils/idle_monitor/mperf_monitor.c | 3 ++-
+ 5 files changed, 12 insertions(+), 8 deletions(-)
+
+--- a/tools/power/cpupower/utils/cpufreq-info.c
++++ b/tools/power/cpupower/utils/cpufreq-info.c
+@@ -172,6 +172,7 @@ static int get_boost_mode(unsigned int c
+ unsigned long pstates[MAX_HW_PSTATES] = {0,};
+
+ if (cpupower_cpu_info.vendor != X86_VENDOR_AMD &&
++ cpupower_cpu_info.vendor != X86_VENDOR_HYGON &&
+ cpupower_cpu_info.vendor != X86_VENDOR_INTEL)
+ return 0;
+
+@@ -192,8 +193,9 @@ static int get_boost_mode(unsigned int c
+ printf(_(" Supported: %s\n"), support ? _("yes") : _("no"));
+ printf(_(" Active: %s\n"), active ? _("yes") : _("no"));
+
+- if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
+- cpupower_cpu_info.family >= 0x10) {
++ if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
++ cpupower_cpu_info.family >= 0x10) ||
++ cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
+ ret = decode_pstates(cpu, cpupower_cpu_info.family, b_states,
+ pstates, &pstate_no);
+ if (ret)
+--- a/tools/power/cpupower/utils/helpers/amd.c
++++ b/tools/power/cpupower/utils/helpers/amd.c
+@@ -47,7 +47,6 @@ static int get_cof(int family, union msr
+ int fid, did;
+
+ did = get_did(family, pstate);
+-
+ t = 0x10;
+ fid = pstate.bits.fid;
+ if (family == 0x11)
+--- a/tools/power/cpupower/utils/helpers/cpuid.c
++++ b/tools/power/cpupower/utils/helpers/cpuid.c
+@@ -7,7 +7,7 @@
+ #include "helpers/helpers.h"
+
+ static const char *cpu_vendor_table[X86_VENDOR_MAX] = {
+- "Unknown", "GenuineIntel", "AuthenticAMD",
++ "Unknown", "GenuineIntel", "AuthenticAMD", "HygonGenuine",
+ };
+
+ #if defined(__i386__) || defined(__x86_64__)
+@@ -108,6 +108,7 @@ out:
+ fclose(fp);
+ /* Get some useful CPU capabilities from cpuid */
+ if (cpu_info->vendor != X86_VENDOR_AMD &&
++ cpu_info->vendor != X86_VENDOR_HYGON &&
+ cpu_info->vendor != X86_VENDOR_INTEL)
+ return ret;
+
+@@ -123,8 +124,9 @@ out:
+ if (cpuid_level >= 6 && (cpuid_ecx(6) & 0x1))
+ cpu_info->caps |= CPUPOWER_CAP_APERF;
+
+- /* AMD Boost state enable/disable register */
+- if (cpu_info->vendor == X86_VENDOR_AMD) {
++ /* AMD or Hygon Boost state enable/disable register */
++ if (cpu_info->vendor == X86_VENDOR_AMD ||
++ cpu_info->vendor == X86_VENDOR_HYGON) {
+ if (ext_cpuid_level >= 0x80000007 &&
+ (cpuid_edx(0x80000007) & (1 << 9)))
+ cpu_info->caps |= CPUPOWER_CAP_AMD_CBP;
+--- a/tools/power/cpupower/utils/helpers/helpers.h
++++ b/tools/power/cpupower/utils/helpers/helpers.h
+@@ -60,7 +60,7 @@ extern int be_verbose;
+
+ /* cpuid and cpuinfo helpers **************************/
+ enum cpupower_cpu_vendor {X86_VENDOR_UNKNOWN = 0, X86_VENDOR_INTEL,
+- X86_VENDOR_AMD, X86_VENDOR_MAX};
++ X86_VENDOR_AMD, X86_VENDOR_HYGON, X86_VENDOR_MAX};
+
+ #define CPUPOWER_CAP_INV_TSC 0x00000001
+ #define CPUPOWER_CAP_APERF 0x00000002
+--- a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
++++ b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c
+@@ -240,7 +240,8 @@ static int init_maxfreq_mode(void)
+ if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_INV_TSC))
+ goto use_sysfs;
+
+- if (cpupower_cpu_info.vendor == X86_VENDOR_AMD) {
++ if (cpupower_cpu_info.vendor == X86_VENDOR_AMD ||
++ cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
+ /* MSR_AMD_HWCR tells us whether TSC runs at P0/mperf
+ * freq.
+ * A test whether hwcr is accessable/available would be:
diff --git a/series.conf b/series.conf
index 5f4a3a8d23..e87c392a40 100644
--- a/series.conf
+++ b/series.conf
@@ -40270,6 +40270,7 @@
patches.arch/x86-xen-add-hygon-dhyana-support-to-xen.patch
patches.arch/acpi-add-hygon-dhyana-support.patch
patches.arch/cpufreq-add-hygon-dhyana-support.patch
+ patches.arch/tools-cpupower-add-hygon-dhyana-support.patch
patches.fixes/0001-x86-xen-Fix-boot-loader-version-reported-for-PVH-gue.patch
patches.suse/msft-hv-1772-x86-hyperv-Suppress-PCI-Fatal-No-config-space-access.patch
patches.suse/msft-hv-1773-x86-hyperv-Remove-unused-include.patch