Lines Matching +full:test +full:- +full:cpu
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * AMD Processor P-state Frequency Driver Unit Test
9 * The AMD P-State Unit Test is a test module for testing the amd-pstate
12 * test to avoid the kernel regression during the update. 3) We can
17 * additional test cases to improve the depth and coverage of the test.
19 * See Documentation/admin-guide/pm/amd-pstate.rst Unit Tests for
20 * amd-pstate to get more detail.
29 #include <linux/amd-pstate.h>
35 * amd_pstate_ut: used as a shortform for AMD P-State unit test.
50 * Kernel module for testing the AMD P-State unit test
123 int cpu = 0, ret = 0; in amd_pstate_ut_check_perf() local
130 for_each_possible_cpu(cpu) { in amd_pstate_ut_check_perf()
131 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_perf()
134 cpudata = policy->driver_data; in amd_pstate_ut_check_perf()
137 ret = cppc_get_perf_caps(cpu, &cppc_perf); in amd_pstate_ut_check_perf()
149 ret = rdmsrl_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1); in amd_pstate_ut_check_perf()
162 if ((highest_perf != READ_ONCE(cpudata->highest_perf)) || in amd_pstate_ut_check_perf()
163 (nominal_perf != READ_ONCE(cpudata->nominal_perf)) || in amd_pstate_ut_check_perf()
164 (lowest_nonlinear_perf != READ_ONCE(cpudata->lowest_nonlinear_perf)) || in amd_pstate_ut_check_perf()
165 (lowest_perf != READ_ONCE(cpudata->lowest_perf))) { in amd_pstate_ut_check_perf()
167 …pr_err("%s cpu%d highest=%d %d nominal=%d %d lowest_nonlinear=%d %d lowest=%d %d, they should be e… in amd_pstate_ut_check_perf()
168 __func__, cpu, highest_perf, cpudata->highest_perf, in amd_pstate_ut_check_perf()
169 nominal_perf, cpudata->nominal_perf, in amd_pstate_ut_check_perf()
170 lowest_nonlinear_perf, cpudata->lowest_nonlinear_perf, in amd_pstate_ut_check_perf()
171 lowest_perf, cpudata->lowest_perf); in amd_pstate_ut_check_perf()
180 …pr_err("%s cpu%d highest=%d >= nominal=%d > lowest_nonlinear=%d > lowest=%d > 0, the formula is in… in amd_pstate_ut_check_perf()
181 __func__, cpu, highest_perf, nominal_perf, in amd_pstate_ut_check_perf()
201 int cpu = 0; in amd_pstate_ut_check_freq() local
205 for_each_possible_cpu(cpu) { in amd_pstate_ut_check_freq()
206 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_freq()
209 cpudata = policy->driver_data; in amd_pstate_ut_check_freq()
211 if (!((cpudata->max_freq >= cpudata->nominal_freq) && in amd_pstate_ut_check_freq()
212 (cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) && in amd_pstate_ut_check_freq()
213 (cpudata->lowest_nonlinear_freq > cpudata->min_freq) && in amd_pstate_ut_check_freq()
214 (cpudata->min_freq > 0))) { in amd_pstate_ut_check_freq()
216 …pr_err("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect… in amd_pstate_ut_check_freq()
217 __func__, cpu, cpudata->max_freq, cpudata->nominal_freq, in amd_pstate_ut_check_freq()
218 cpudata->lowest_nonlinear_freq, cpudata->min_freq); in amd_pstate_ut_check_freq()
222 if (cpudata->min_freq != policy->min) { in amd_pstate_ut_check_freq()
224 pr_err("%s cpu%d cpudata_min_freq=%d policy_min=%d, they should be equal!\n", in amd_pstate_ut_check_freq()
225 __func__, cpu, cpudata->min_freq, policy->min); in amd_pstate_ut_check_freq()
229 if (cpudata->boost_supported) { in amd_pstate_ut_check_freq()
230 if ((policy->max == cpudata->max_freq) || in amd_pstate_ut_check_freq()
231 (policy->max == cpudata->nominal_freq)) in amd_pstate_ut_check_freq()
235 pr_err("%s cpu%d policy_max=%d should be equal cpu_max=%d or cpu_nominal=%d !\n", in amd_pstate_ut_check_freq()
236 __func__, cpu, policy->max, cpudata->max_freq, in amd_pstate_ut_check_freq()
237 cpudata->nominal_freq); in amd_pstate_ut_check_freq()
242 pr_err("%s cpu%d must support boost!\n", __func__, cpu); in amd_pstate_ut_check_freq()
262 pr_info("%-4d %-20s\t success!\n", i+1, amd_pstate_ut_cases[i].name); in amd_pstate_ut_init()
266 pr_info("%-4d %-20s\t fail!\n", i+1, amd_pstate_ut_cases[i].name); in amd_pstate_ut_init()
282 MODULE_DESCRIPTION("AMD P-state driver Test module");