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.
36 #include "amd-pstate.h"
45 * Kernel module for testing the AMD P-State unit test
78 return -EINVAL; in amd_pstate_ut_acpi_cpc_valid()
103 return -EINVAL; in amd_pstate_ut_check_enabled()
115 int cpu = 0, ret = 0; in amd_pstate_ut_check_perf() local
121 for_each_online_cpu(cpu) { in amd_pstate_ut_check_perf()
125 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_perf()
128 cpudata = policy->driver_data; in amd_pstate_ut_check_perf()
131 ret = cppc_get_perf_caps(cpu, &cppc_perf); in amd_pstate_ut_check_perf()
142 ret = rdmsrq_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1); in amd_pstate_ut_check_perf()
154 cur_perf = READ_ONCE(cpudata->perf); in amd_pstate_ut_check_perf()
155 if (highest_perf != cur_perf.highest_perf && !cpudata->hw_prefcore) { in amd_pstate_ut_check_perf()
156 pr_err("%s cpu%d highest=%d %d highest perf doesn't match\n", in amd_pstate_ut_check_perf()
157 __func__, cpu, highest_perf, cur_perf.highest_perf); in amd_pstate_ut_check_perf()
158 return -EINVAL; in amd_pstate_ut_check_perf()
163 pr_err("%s cpu%d nominal=%d %d lowest_nonlinear=%d %d lowest=%d %d, they should be equal!\n", in amd_pstate_ut_check_perf()
164 __func__, cpu, nominal_perf, cur_perf.nominal_perf, in amd_pstate_ut_check_perf()
167 return -EINVAL; in amd_pstate_ut_check_perf()
174 …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()
175 __func__, cpu, highest_perf, nominal_perf, in amd_pstate_ut_check_perf()
177 return -EINVAL; in amd_pstate_ut_check_perf()
191 int cpu = 0; in amd_pstate_ut_check_freq() local
193 for_each_online_cpu(cpu) { in amd_pstate_ut_check_freq()
197 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_freq()
200 cpudata = policy->driver_data; in amd_pstate_ut_check_freq()
202 if (!((policy->cpuinfo.max_freq >= cpudata->nominal_freq) && in amd_pstate_ut_check_freq()
203 (cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) && in amd_pstate_ut_check_freq()
204 (cpudata->lowest_nonlinear_freq >= policy->cpuinfo.min_freq) && in amd_pstate_ut_check_freq()
205 (policy->cpuinfo.min_freq > 0))) { in amd_pstate_ut_check_freq()
206 …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()
207 __func__, cpu, policy->cpuinfo.max_freq, cpudata->nominal_freq, in amd_pstate_ut_check_freq()
208 cpudata->lowest_nonlinear_freq, policy->cpuinfo.min_freq); in amd_pstate_ut_check_freq()
209 return -EINVAL; in amd_pstate_ut_check_freq()
212 if (cpudata->lowest_nonlinear_freq != policy->min) { in amd_pstate_ut_check_freq()
213 pr_err("%s cpu%d cpudata_lowest_nonlinear_freq=%d policy_min=%d, they should be equal!\n", in amd_pstate_ut_check_freq()
214 __func__, cpu, cpudata->lowest_nonlinear_freq, policy->min); in amd_pstate_ut_check_freq()
215 return -EINVAL; in amd_pstate_ut_check_freq()
218 if (cpudata->boost_supported) { in amd_pstate_ut_check_freq()
219 if ((policy->max != policy->cpuinfo.max_freq) && in amd_pstate_ut_check_freq()
220 (policy->max != cpudata->nominal_freq)) { in amd_pstate_ut_check_freq()
221 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()
222 __func__, cpu, policy->max, policy->cpuinfo.max_freq, in amd_pstate_ut_check_freq()
223 cpudata->nominal_freq); in amd_pstate_ut_check_freq()
224 return -EINVAL; in amd_pstate_ut_check_freq()
227 pr_err("%s cpu%d must support boost!\n", __func__, cpu); in amd_pstate_ut_check_freq()
228 return -EINVAL; in amd_pstate_ut_check_freq()
239 pr_debug("->setting mode to %s\n", mode_str); in amd_pstate_set_mode()
265 pr_warn("%s: failed to update status for %s->%s: %d\n", __func__, in amd_pstate_ut_check_driver()
281 pr_err("%-4d %-20s\t fail: %d!\n", i+1, amd_pstate_ut_cases[i].name, ret); in amd_pstate_ut_init()
283 pr_info("%-4d %-20s\t success!\n", i+1, amd_pstate_ut_cases[i].name); in amd_pstate_ut_init()
297 MODULE_DESCRIPTION("AMD P-state driver Test module");