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.
26 #include <linux/kernel.h>
34 #include "amd-pstate.h"
43 * Kernel module for testing the AMD P-State unit test
76 return -EINVAL; in amd_pstate_ut_acpi_cpc_valid()
101 return -EINVAL; in amd_pstate_ut_check_enabled()
120 struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL; in amd_pstate_ut_check_perf()
123 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_perf()
124 if (!policy) in amd_pstate_ut_check_perf()
126 cpudata = policy->driver_data; in amd_pstate_ut_check_perf()
152 cur_perf = READ_ONCE(cpudata->perf); in amd_pstate_ut_check_perf()
153 if (highest_perf != cur_perf.highest_perf && !cpudata->hw_prefcore) { in amd_pstate_ut_check_perf()
156 return -EINVAL; in amd_pstate_ut_check_perf()
165 return -EINVAL; in amd_pstate_ut_check_perf()
175 return -EINVAL; in amd_pstate_ut_check_perf()
192 struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL; in amd_pstate_ut_check_freq()
195 policy = cpufreq_cpu_get(cpu); in amd_pstate_ut_check_freq()
196 if (!policy) in amd_pstate_ut_check_freq()
198 cpudata = policy->driver_data; in amd_pstate_ut_check_freq()
200 if (!((policy->cpuinfo.max_freq >= cpudata->nominal_freq) && in amd_pstate_ut_check_freq()
201 (cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) && in amd_pstate_ut_check_freq()
202 (cpudata->lowest_nonlinear_freq >= policy->cpuinfo.min_freq) && in amd_pstate_ut_check_freq()
203 (policy->cpuinfo.min_freq > 0))) { in amd_pstate_ut_check_freq()
205 __func__, cpu, policy->cpuinfo.max_freq, cpudata->nominal_freq, in amd_pstate_ut_check_freq()
206 cpudata->lowest_nonlinear_freq, policy->cpuinfo.min_freq); in amd_pstate_ut_check_freq()
207 return -EINVAL; in amd_pstate_ut_check_freq()
210 if (cpudata->lowest_nonlinear_freq != policy->min) { in amd_pstate_ut_check_freq()
212 __func__, cpu, cpudata->lowest_nonlinear_freq, policy->min); in amd_pstate_ut_check_freq()
213 return -EINVAL; in amd_pstate_ut_check_freq()
216 if (cpudata->boost_supported) { in amd_pstate_ut_check_freq()
217 if ((policy->max != policy->cpuinfo.max_freq) && in amd_pstate_ut_check_freq()
218 (policy->max != cpudata->nominal_freq)) { in amd_pstate_ut_check_freq()
220 __func__, cpu, policy->max, policy->cpuinfo.max_freq, in amd_pstate_ut_check_freq()
221 cpudata->nominal_freq); in amd_pstate_ut_check_freq()
222 return -EINVAL; in amd_pstate_ut_check_freq()
226 return -EINVAL; in amd_pstate_ut_check_freq()
237 pr_debug("->setting mode to %s\n", mode_str); in amd_pstate_set_mode()
255 pr_err("%s: failed to update status for %s->%s\n", __func__, in amd_pstate_ut_check_driver()
274 pr_err("%-4d %-20s\t fail: %d!\n", i+1, amd_pstate_ut_cases[i].name, ret); in amd_pstate_ut_init()
276 pr_info("%-4d %-20s\t success!\n", i+1, amd_pstate_ut_cases[i].name); in amd_pstate_ut_init()
290 MODULE_DESCRIPTION("AMD P-state driver Test module");