Lines Matching +full:kernel +full:- +full:policy
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
11 * (SBIOS/Firmware or Hardware). 2) Kernel can have a basic function
12 * test to avoid the kernel regression during the update. 3) We can
19 * See Documentation/admin-guide/pm/amd-pstate.rst Unit Tests for
20 * amd-pstate to get more detail.
25 #include <linux/kernel.h>
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
127 struct cpufreq_policy *policy = NULL; in amd_pstate_ut_check_perf() local
131 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_perf()
132 if (!policy) in amd_pstate_ut_check_perf()
134 cpudata = policy->driver_data; 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()
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()
185 cpufreq_cpu_put(policy); in amd_pstate_ut_check_perf()
191 cpufreq_cpu_put(policy); in amd_pstate_ut_check_perf()
202 struct cpufreq_policy *policy = NULL; in amd_pstate_ut_check_freq() local
206 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_freq()
207 if (!policy) 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()
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()
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()
236 __func__, cpu, policy->max, cpudata->max_freq, in amd_pstate_ut_check_freq()
237 cpudata->nominal_freq); in amd_pstate_ut_check_freq()
245 cpufreq_cpu_put(policy); in amd_pstate_ut_check_freq()
251 cpufreq_cpu_put(policy); 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");