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>
32 #include "amd-pstate.h"
36 * amd_pstate_ut: used as a shortform for AMD P-State unit test.
51 * Kernel module for testing the AMD P-State unit test
130 struct cpufreq_policy *policy = NULL; in amd_pstate_ut_check_perf() local
134 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_perf()
135 if (!policy) in amd_pstate_ut_check_perf()
137 cpudata = policy->driver_data; in amd_pstate_ut_check_perf()
165 if (highest_perf != READ_ONCE(cpudata->highest_perf) && !cpudata->hw_prefcore) { in amd_pstate_ut_check_perf()
167 __func__, cpu, highest_perf, cpudata->highest_perf); in amd_pstate_ut_check_perf()
170 if ((nominal_perf != READ_ONCE(cpudata->nominal_perf)) || in amd_pstate_ut_check_perf()
171 (lowest_nonlinear_perf != READ_ONCE(cpudata->lowest_nonlinear_perf)) || in amd_pstate_ut_check_perf()
172 (lowest_perf != READ_ONCE(cpudata->lowest_perf))) { in amd_pstate_ut_check_perf()
175 __func__, cpu, nominal_perf, cpudata->nominal_perf, in amd_pstate_ut_check_perf()
176 lowest_nonlinear_perf, cpudata->lowest_nonlinear_perf, in amd_pstate_ut_check_perf()
177 lowest_perf, cpudata->lowest_perf); in amd_pstate_ut_check_perf()
191 cpufreq_cpu_put(policy); in amd_pstate_ut_check_perf()
197 cpufreq_cpu_put(policy); in amd_pstate_ut_check_perf()
208 struct cpufreq_policy *policy = NULL; in amd_pstate_ut_check_freq() local
213 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_freq()
214 if (!policy) in amd_pstate_ut_check_freq()
216 cpudata = policy->driver_data; in amd_pstate_ut_check_freq()
218 nominal_freq_khz = cpudata->nominal_freq*1000; in amd_pstate_ut_check_freq()
219 if (!((cpudata->max_freq >= nominal_freq_khz) && in amd_pstate_ut_check_freq()
220 (nominal_freq_khz > cpudata->lowest_nonlinear_freq) && in amd_pstate_ut_check_freq()
221 (cpudata->lowest_nonlinear_freq > cpudata->min_freq) && in amd_pstate_ut_check_freq()
222 (cpudata->min_freq > 0))) { in amd_pstate_ut_check_freq()
225 __func__, cpu, cpudata->max_freq, nominal_freq_khz, in amd_pstate_ut_check_freq()
226 cpudata->lowest_nonlinear_freq, cpudata->min_freq); in amd_pstate_ut_check_freq()
230 if (cpudata->min_freq != policy->min) { in amd_pstate_ut_check_freq()
233 __func__, cpu, cpudata->min_freq, policy->min); in amd_pstate_ut_check_freq()
237 if (cpudata->boost_supported) { in amd_pstate_ut_check_freq()
238 if ((policy->max == cpudata->max_freq) || in amd_pstate_ut_check_freq()
239 (policy->max == nominal_freq_khz)) in amd_pstate_ut_check_freq()
244 __func__, cpu, policy->max, cpudata->max_freq, in amd_pstate_ut_check_freq()
253 cpufreq_cpu_put(policy); in amd_pstate_ut_check_freq()
259 cpufreq_cpu_put(policy); in amd_pstate_ut_check_freq()
266 pr_debug("->setting mode to %s\n", mode_str); in amd_pstate_set_mode()
290 pr_warn("%s: failed to update status for %s->%s: %d\n", __func__, in amd_pstate_ut_check_driver()
307 pr_info("%-4d %-20s\t success!\n", i+1, amd_pstate_ut_cases[i].name); in amd_pstate_ut_init()
311 pr_info("%-4d %-20s\t fail!\n", i+1, amd_pstate_ut_cases[i].name); in amd_pstate_ut_init()
327 MODULE_DESCRIPTION("AMD P-state driver Test module");