Lines Matching full:policy
247 if (epp > 0 && cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) { in amd_pstate_set_energy_pref_index()
248 pr_debug("EPP cannot be set under performance policy\n"); in amd_pstate_set_energy_pref_index()
495 static int amd_pstate_verify(struct cpufreq_policy_data *policy) in amd_pstate_verify() argument
497 cpufreq_verify_within_cpu_limits(policy); in amd_pstate_verify()
502 static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy) in amd_pstate_update_min_max_limit() argument
505 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_update_min_max_limit()
507 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_update_min_max_limit()
508 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_update_min_max_limit()
512 WRITE_ONCE(cpudata->max_limit_freq, policy->max); in amd_pstate_update_min_max_limit()
513 WRITE_ONCE(cpudata->min_limit_freq, policy->min); in amd_pstate_update_min_max_limit()
518 static int amd_pstate_update_freq(struct cpufreq_policy *policy, in amd_pstate_update_freq() argument
522 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_update_freq()
528 if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) in amd_pstate_update_freq()
529 amd_pstate_update_min_max_limit(policy); in amd_pstate_update_freq()
535 freqs.old = policy->cur; in amd_pstate_update_freq()
541 WARN_ON(fast_switch && !policy->fast_switch_enabled); in amd_pstate_update_freq()
548 cpufreq_freq_transition_begin(policy, &freqs); in amd_pstate_update_freq()
551 max_perf, fast_switch, policy->governor->flags); in amd_pstate_update_freq()
554 cpufreq_freq_transition_end(policy, &freqs, false); in amd_pstate_update_freq()
559 static int amd_pstate_target(struct cpufreq_policy *policy, in amd_pstate_target() argument
563 return amd_pstate_update_freq(policy, target_freq, false); in amd_pstate_target()
566 static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy, in amd_pstate_fast_switch() argument
569 if (!amd_pstate_update_freq(policy, target_freq, true)) in amd_pstate_fast_switch()
571 return policy->cur; in amd_pstate_fast_switch()
581 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in amd_pstate_adjust_perf() local
585 if (!policy) in amd_pstate_adjust_perf()
588 cpudata = policy->driver_data; in amd_pstate_adjust_perf()
590 if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) in amd_pstate_adjust_perf()
591 amd_pstate_update_min_max_limit(policy); in amd_pstate_adjust_perf()
615 policy->cur = target_freq; in amd_pstate_adjust_perf()
618 policy->governor->flags); in amd_pstate_adjust_perf()
619 cpufreq_cpu_put(policy); in amd_pstate_adjust_perf()
694 static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) in amd_pstate_set_boost() argument
696 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_set_boost()
705 policy->cpuinfo.max_freq = cpudata->max_freq; in amd_pstate_set_boost()
707 policy->cpuinfo.max_freq = cpudata->nominal_freq; in amd_pstate_set_boost()
709 policy->max = policy->cpuinfo.max_freq; in amd_pstate_set_boost()
712 policy->cpuinfo.max_freq); in amd_pstate_set_boost()
812 static int amd_pstate_cpu_init(struct cpufreq_policy *policy) in amd_pstate_cpu_init() argument
822 amd_perf_ctl_reset(policy->cpu); in amd_pstate_cpu_init()
823 dev = get_cpu_device(policy->cpu); in amd_pstate_cpu_init()
831 cpudata->cpu = policy->cpu; in amd_pstate_cpu_init()
851 policy->cpuinfo.transition_latency = AMD_PSTATE_TRANSITION_LATENCY; in amd_pstate_cpu_init()
852 policy->transition_delay_us = AMD_PSTATE_TRANSITION_DELAY; in amd_pstate_cpu_init()
854 policy->min = min_freq; in amd_pstate_cpu_init()
855 policy->max = max_freq; in amd_pstate_cpu_init()
857 policy->cpuinfo.min_freq = min_freq; in amd_pstate_cpu_init()
858 policy->cpuinfo.max_freq = max_freq; in amd_pstate_cpu_init()
861 policy->cur = policy->cpuinfo.min_freq; in amd_pstate_cpu_init()
864 policy->fast_switch_possible = true; in amd_pstate_cpu_init()
866 ret = freq_qos_add_request(&policy->constraints, &cpudata->req[0], in amd_pstate_cpu_init()
867 FREQ_QOS_MIN, policy->cpuinfo.min_freq); in amd_pstate_cpu_init()
873 ret = freq_qos_add_request(&policy->constraints, &cpudata->req[1], in amd_pstate_cpu_init()
874 FREQ_QOS_MAX, policy->cpuinfo.max_freq); in amd_pstate_cpu_init()
888 policy->driver_data = cpudata; in amd_pstate_cpu_init()
903 static int amd_pstate_cpu_exit(struct cpufreq_policy *policy) in amd_pstate_cpu_exit() argument
905 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_cpu_exit()
909 policy->fast_switch_possible = false; in amd_pstate_cpu_exit()
915 static int amd_pstate_cpu_resume(struct cpufreq_policy *policy) in amd_pstate_cpu_resume() argument
926 static int amd_pstate_cpu_suspend(struct cpufreq_policy *policy) in amd_pstate_cpu_suspend() argument
944 static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy, in show_amd_pstate_max_freq() argument
948 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_max_freq()
957 static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *policy, in show_amd_pstate_lowest_nonlinear_freq() argument
961 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_lowest_nonlinear_freq()
974 static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, in show_amd_pstate_highest_perf() argument
978 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_highest_perf()
985 static ssize_t show_amd_pstate_hw_prefcore(struct cpufreq_policy *policy, in show_amd_pstate_hw_prefcore() argument
989 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_hw_prefcore()
997 struct cpufreq_policy *policy, char *buf) in show_energy_performance_available_preferences() argument
1001 struct amd_cpudata *cpudata = policy->driver_data; in show_energy_performance_available_preferences()
1003 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in show_energy_performance_available_preferences()
1016 struct cpufreq_policy *policy, const char *buf, size_t count) in store_energy_performance_preference() argument
1018 struct amd_cpudata *cpudata = policy->driver_data; in store_energy_performance_preference()
1038 struct cpufreq_policy *policy, char *buf) in show_energy_performance_preference() argument
1040 struct amd_cpudata *cpudata = policy->driver_data; in show_energy_performance_preference()
1268 static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_init() argument
1279 amd_perf_ctl_reset(policy->cpu); in amd_pstate_epp_cpu_init()
1280 dev = get_cpu_device(policy->cpu); in amd_pstate_epp_cpu_init()
1288 cpudata->cpu = policy->cpu; in amd_pstate_epp_cpu_init()
1308 policy->cpuinfo.min_freq = min_freq; in amd_pstate_epp_cpu_init()
1309 policy->cpuinfo.max_freq = max_freq; in amd_pstate_epp_cpu_init()
1311 policy->cur = policy->cpuinfo.min_freq; in amd_pstate_epp_cpu_init()
1319 policy->driver_data = cpudata; in amd_pstate_epp_cpu_init()
1323 policy->min = policy->cpuinfo.min_freq; in amd_pstate_epp_cpu_init()
1324 policy->max = policy->cpuinfo.max_freq; in amd_pstate_epp_cpu_init()
1327 * Set the policy to provide a valid fallback value in case in amd_pstate_epp_cpu_init()
1332 policy->policy = CPUFREQ_POLICY_PERFORMANCE; in amd_pstate_epp_cpu_init()
1334 policy->policy = CPUFREQ_POLICY_POWERSAVE; in amd_pstate_epp_cpu_init()
1356 static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_exit() argument
1358 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_exit()
1362 policy->driver_data = NULL; in amd_pstate_epp_cpu_exit()
1365 pr_debug("CPU %d exiting\n", policy->cpu); in amd_pstate_epp_cpu_exit()
1369 static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy) in amd_pstate_epp_update_limit() argument
1371 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_update_limit()
1378 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_epp_update_limit()
1379 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_epp_update_limit()
1390 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in amd_pstate_epp_update_limit()
1404 cpudata->epp_policy = cpudata->policy; in amd_pstate_epp_update_limit()
1416 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in amd_pstate_epp_update_limit()
1429 static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy) in amd_pstate_epp_set_policy() argument
1431 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_set_policy()
1433 if (!policy->cpuinfo.max_freq) in amd_pstate_epp_set_policy()
1436 pr_debug("set_policy: cpuinfo.max %u policy->max %u\n", in amd_pstate_epp_set_policy()
1437 policy->cpuinfo.max_freq, policy->max); in amd_pstate_epp_set_policy()
1439 cpudata->policy = policy->policy; in amd_pstate_epp_set_policy()
1441 amd_pstate_epp_update_limit(policy); in amd_pstate_epp_set_policy()
1468 static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_online() argument
1470 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_online()
1482 static void amd_pstate_epp_offline(struct cpufreq_policy *policy) in amd_pstate_epp_offline() argument
1484 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_offline()
1511 static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_offline() argument
1513 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_offline()
1521 amd_pstate_epp_offline(policy); in amd_pstate_epp_cpu_offline()
1526 static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy) in amd_pstate_epp_verify_policy() argument
1528 cpufreq_verify_within_cpu_limits(policy); in amd_pstate_epp_verify_policy()
1529 pr_debug("policy_max =%d, policy_min=%d\n", policy->max, policy->min); in amd_pstate_epp_verify_policy()
1533 static int amd_pstate_epp_suspend(struct cpufreq_policy *policy) in amd_pstate_epp_suspend() argument
1535 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_suspend()
1553 static int amd_pstate_epp_resume(struct cpufreq_policy *policy) in amd_pstate_epp_resume() argument
1555 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_resume()