hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/tools/power/cpupower/utils/cpufreq-info.c
....@@ -1,7 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * (C) 2004-2009 Dominik Brodowski <linux@dominikbrodowski.de>
3
- *
4
- * Licensed under the terms of the GNU GPL License version 2.
54 */
65
76
....@@ -161,17 +160,11 @@
161160 return;
162161 }
163162
164
-/* --boost / -b */
165
-
166
-static int get_boost_mode(unsigned int cpu)
163
+static int get_boost_mode_x86(unsigned int cpu)
167164 {
168165 int support, active, b_states = 0, ret, pstate_no, i;
169166 /* ToDo: Make this more global */
170167 unsigned long pstates[MAX_HW_PSTATES] = {0,};
171
-
172
- if (cpupower_cpu_info.vendor != X86_VENDOR_AMD &&
173
- cpupower_cpu_info.vendor != X86_VENDOR_INTEL)
174
- return 0;
175168
176169 ret = cpufreq_has_boost_support(cpu, &support, &active, &b_states);
177170 if (ret) {
....@@ -190,8 +183,9 @@
190183 printf(_(" Supported: %s\n"), support ? _("yes") : _("no"));
191184 printf(_(" Active: %s\n"), active ? _("yes") : _("no"));
192185
193
- if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
194
- cpupower_cpu_info.family >= 0x10) {
186
+ if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
187
+ cpupower_cpu_info.family >= 0x10) ||
188
+ cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
195189 ret = decode_pstates(cpu, cpupower_cpu_info.family, b_states,
196190 pstates, &pstate_no);
197191 if (ret)
....@@ -246,6 +240,33 @@
246240 return 0;
247241 }
248242
243
+/* --boost / -b */
244
+
245
+static int get_boost_mode(unsigned int cpu)
246
+{
247
+ struct cpufreq_available_frequencies *freqs;
248
+
249
+ if (cpupower_cpu_info.vendor == X86_VENDOR_AMD ||
250
+ cpupower_cpu_info.vendor == X86_VENDOR_HYGON ||
251
+ cpupower_cpu_info.vendor == X86_VENDOR_INTEL)
252
+ return get_boost_mode_x86(cpu);
253
+
254
+ freqs = cpufreq_get_boost_frequencies(cpu);
255
+ if (freqs) {
256
+ printf(_(" boost frequency steps: "));
257
+ while (freqs->next) {
258
+ print_speed(freqs->frequency);
259
+ printf(", ");
260
+ freqs = freqs->next;
261
+ }
262
+ print_speed(freqs->frequency);
263
+ printf("\n");
264
+ cpufreq_put_available_frequencies(freqs);
265
+ }
266
+
267
+ return 0;
268
+}
269
+
249270 /* --freq / -f */
250271
251272 static int get_freq_kernel(unsigned int cpu, unsigned int human)