hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/tools/power/cpupower/utils/helpers/cpuid.c
....@@ -8,7 +8,7 @@
88 #include "helpers/helpers.h"
99
1010 static const char *cpu_vendor_table[X86_VENDOR_MAX] = {
11
- "Unknown", "GenuineIntel", "AuthenticAMD",
11
+ "Unknown", "GenuineIntel", "AuthenticAMD", "HygonGenuine",
1212 };
1313
1414 #if defined(__i386__) || defined(__x86_64__)
....@@ -109,6 +109,7 @@
109109 fclose(fp);
110110 /* Get some useful CPU capabilities from cpuid */
111111 if (cpu_info->vendor != X86_VENDOR_AMD &&
112
+ cpu_info->vendor != X86_VENDOR_HYGON &&
112113 cpu_info->vendor != X86_VENDOR_INTEL)
113114 return ret;
114115
....@@ -124,11 +125,16 @@
124125 if (cpuid_level >= 6 && (cpuid_ecx(6) & 0x1))
125126 cpu_info->caps |= CPUPOWER_CAP_APERF;
126127
127
- /* AMD Boost state enable/disable register */
128
- if (cpu_info->vendor == X86_VENDOR_AMD) {
128
+ /* AMD or Hygon Boost state enable/disable register */
129
+ if (cpu_info->vendor == X86_VENDOR_AMD ||
130
+ cpu_info->vendor == X86_VENDOR_HYGON) {
129131 if (ext_cpuid_level >= 0x80000007 &&
130132 (cpuid_edx(0x80000007) & (1 << 9)))
131133 cpu_info->caps |= CPUPOWER_CAP_AMD_CBP;
134
+
135
+ if (ext_cpuid_level >= 0x80000008 &&
136
+ cpuid_ebx(0x80000008) & (1 << 4))
137
+ cpu_info->caps |= CPUPOWER_CAP_AMD_RDPRU;
132138 }
133139
134140 if (cpu_info->vendor == X86_VENDOR_INTEL) {