mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
cpufreq: Pass policy pointer to ->update_limits()
Since cpufreq_update_limits() obtains a cpufreq policy pointer for the given CPU and reference counts the corresponding policy object, it may as well pass the policy pointer to the cpufreq driver's ->update_limits() callback which allows that callback to avoid invoking cpufreq_cpu_get() for the same CPU. Accordingly, redefine ->update_limits() to take a policy pointer instead of a CPU number and update both drivers implementing it, intel_pstate and amd-pstate, as needed. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Tested-by: Sudeep Holla <sudeep.holla@arm.com> Link: https://patch.msgid.link/8560367.NyiUUSuA9g@rjwysocki.net
This commit is contained in:
parent
684e185521
commit
eaff6b62d3
|
|
@ -821,19 +821,16 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
|
|||
schedule_work(&sched_prefcore_work);
|
||||
}
|
||||
|
||||
static void amd_pstate_update_limits(unsigned int cpu)
|
||||
static void amd_pstate_update_limits(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
|
||||
struct amd_cpudata *cpudata;
|
||||
u32 prev_high = 0, cur_high = 0;
|
||||
bool highest_perf_changed = false;
|
||||
unsigned int cpu = policy->cpu;
|
||||
|
||||
if (!amd_pstate_prefcore)
|
||||
return;
|
||||
|
||||
if (!policy)
|
||||
return;
|
||||
|
||||
if (amd_get_highest_perf(cpu, &cur_high))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -2769,7 +2769,7 @@ void cpufreq_update_limits(unsigned int cpu)
|
|||
return;
|
||||
|
||||
if (cpufreq_driver->update_limits)
|
||||
cpufreq_driver->update_limits(cpu);
|
||||
cpufreq_driver->update_limits(policy);
|
||||
else
|
||||
cpufreq_policy_refresh(policy);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1353,14 +1353,9 @@ static void intel_pstate_update_policies(void)
|
|||
cpufreq_update_policy(cpu);
|
||||
}
|
||||
|
||||
static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
|
||||
static void __intel_pstate_update_max_freq(struct cpufreq_policy *policy,
|
||||
struct cpudata *cpudata)
|
||||
{
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy);
|
||||
|
||||
policy = cpufreq_cpu_get(cpudata->cpu);
|
||||
if (!policy)
|
||||
return false;
|
||||
|
||||
guard(cpufreq_policy_write)(policy);
|
||||
|
||||
if (hwp_active)
|
||||
|
|
@ -1370,16 +1365,28 @@ static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
|
|||
cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
|
||||
|
||||
refresh_frequency_limits(policy);
|
||||
}
|
||||
|
||||
static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
|
||||
{
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy);
|
||||
|
||||
policy = cpufreq_cpu_get(cpudata->cpu);
|
||||
if (!policy)
|
||||
return false;
|
||||
|
||||
__intel_pstate_update_max_freq(policy, cpudata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void intel_pstate_update_limits(unsigned int cpu)
|
||||
static void intel_pstate_update_limits(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpudata *cpudata = all_cpu_data[cpu];
|
||||
struct cpudata *cpudata = all_cpu_data[policy->cpu];
|
||||
|
||||
if (intel_pstate_update_max_freq(cpudata))
|
||||
hybrid_update_capacity(cpudata);
|
||||
__intel_pstate_update_max_freq(policy, cpudata);
|
||||
|
||||
hybrid_update_capacity(cpudata);
|
||||
}
|
||||
|
||||
static void intel_pstate_update_limits_for_all(void)
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ struct cpufreq_driver {
|
|||
unsigned int (*get)(unsigned int cpu);
|
||||
|
||||
/* Called to update policy limits on firmware notifications. */
|
||||
void (*update_limits)(unsigned int cpu);
|
||||
void (*update_limits)(struct cpufreq_policy *policy);
|
||||
|
||||
/* optional */
|
||||
int (*bios_limit)(int cpu, unsigned int *limit);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user