mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
cpufreq: Remove driver default policy->min/max init
Prior to commit521223d8b3("cpufreq: Fix initialization of min and max frequency QoS requests"), drivers were setting policy->min/max and these values were used as initial policy QoS constraints. After the above commit, these values are only used temporarily, as cpufreq_set_policy() ultimately overrides them through: cpufreq_policy_online() \-cpufreq_init_policy() \-cpufreq_set_policy() \-/* Set policy->min/max */ A subsequent change will restore the previous behavior allowing drivers to request special min/max QoS frequencies instead of FREQ_QOS_MIN_DEFAULT_VALUE and FREQ_QOS_MAX_DEFAULT_VALUE, respectively, if desired. For instance, the CPPC driver wants to advertise the lowest non-linear frequency that should be used as the initial minimum frequency QoS request. However, for this purpose, all drivers setting policy->min/max to policy->cpuinfo.min/max_freq, respectively, need to be updated so their initial policy->min/max settings don't limit the frequency scaling unnecessarily going forward (which would defeat the purpose of commit521223d8b3), so do that. This does not actually alter the observed behavior of all of the drivers in question because setting policy->min/max to policy->cpuinfo.min/max_freq, respectively, is not necessary or even useful any more after a previous change ("cpufreq: Set default policy->min/max values for all drivers"). Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Jie Zhan <zhanjie9@hisilicon.com> [ rjw: Changelog rewrite ] Link: https://patch.msgid.link/20260528090913.2759118-4-pierre.gondois@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
743a3cddb1
commit
db80ad776c
|
|
@ -1080,10 +1080,9 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
|
|||
|
||||
perf = READ_ONCE(cpudata->perf);
|
||||
|
||||
policy->cpuinfo.min_freq = policy->min = perf_to_freq(perf,
|
||||
cpudata->nominal_freq,
|
||||
perf.lowest_perf);
|
||||
policy->cpuinfo.max_freq = policy->max = cpudata->max_freq;
|
||||
policy->cpuinfo.min_freq = perf_to_freq(perf, cpudata->nominal_freq,
|
||||
perf.lowest_perf);
|
||||
policy->cpuinfo.max_freq = cpudata->max_freq;
|
||||
|
||||
policy->driver_data = cpudata;
|
||||
ret = amd_pstate_cppc_enable(policy);
|
||||
|
|
@ -1909,10 +1908,9 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
|
|||
|
||||
perf = READ_ONCE(cpudata->perf);
|
||||
|
||||
policy->cpuinfo.min_freq = policy->min = perf_to_freq(perf,
|
||||
cpudata->nominal_freq,
|
||||
perf.lowest_perf);
|
||||
policy->cpuinfo.max_freq = policy->max = cpudata->max_freq;
|
||||
policy->cpuinfo.min_freq = perf_to_freq(perf, cpudata->nominal_freq,
|
||||
perf.lowest_perf);
|
||||
policy->cpuinfo.max_freq = cpudata->max_freq;
|
||||
policy->driver_data = cpudata;
|
||||
|
||||
ret = amd_pstate_cppc_enable(policy);
|
||||
|
|
|
|||
|
|
@ -660,8 +660,6 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||
* Section 8.4.7.1.1.5 of ACPI 6.1 spec)
|
||||
*/
|
||||
policy->min = cppc_perf_to_khz(caps, caps->lowest_nonlinear_perf);
|
||||
policy->max = cppc_perf_to_khz(caps, policy->boost_enabled ?
|
||||
caps->highest_perf : caps->nominal_perf);
|
||||
|
||||
/*
|
||||
* Set cpuinfo.min_freq to Lowest to make the full range of performance
|
||||
|
|
@ -669,7 +667,8 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||
* nonlinear perf
|
||||
*/
|
||||
policy->cpuinfo.min_freq = cppc_perf_to_khz(caps, caps->lowest_perf);
|
||||
policy->cpuinfo.max_freq = policy->max;
|
||||
policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, policy->boost_enabled ?
|
||||
caps->highest_perf : caps->nominal_perf);
|
||||
|
||||
policy->transition_delay_us = cppc_cpufreq_get_transition_delay_us(cpu);
|
||||
policy->shared_type = cpu_data->shared_type;
|
||||
|
|
|
|||
|
|
@ -355,8 +355,8 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy)
|
|||
min_fsb = NFORCE2_MIN_FSB;
|
||||
|
||||
/* cpuinfo and default policy values */
|
||||
policy->min = policy->cpuinfo.min_freq = min_fsb * fid * 100;
|
||||
policy->max = policy->cpuinfo.max_freq = max_fsb * fid * 100;
|
||||
policy->cpuinfo.min_freq = min_fsb * fid * 100;
|
||||
policy->cpuinfo.max_freq = max_fsb * fid * 100;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,16 +49,15 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy)
|
|||
max_freq = freq;
|
||||
}
|
||||
|
||||
policy->min = policy->cpuinfo.min_freq = min_freq;
|
||||
policy->max = max_freq;
|
||||
policy->cpuinfo.min_freq = min_freq;
|
||||
/*
|
||||
* If the driver has set its own cpuinfo.max_freq above max_freq, leave
|
||||
* it as is.
|
||||
*/
|
||||
if (policy->cpuinfo.max_freq < max_freq)
|
||||
policy->max = policy->cpuinfo.max_freq = max_freq;
|
||||
policy->cpuinfo.max_freq = max_freq;
|
||||
|
||||
if (policy->min == ~0)
|
||||
if (min_freq == ~0)
|
||||
return -EINVAL;
|
||||
else
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy)
|
|||
policy->min = maxfreq / max_duration;
|
||||
else
|
||||
policy->min = maxfreq / POLICY_MIN_DIV;
|
||||
policy->max = maxfreq;
|
||||
|
||||
policy->cpuinfo.min_freq = maxfreq / max_duration;
|
||||
policy->cpuinfo.max_freq = maxfreq;
|
||||
|
||||
|
|
|
|||
|
|
@ -3051,9 +3051,6 @@ static int __intel_pstate_cpu_init(struct cpufreq_policy *policy)
|
|||
policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ?
|
||||
cpu->pstate.max_freq : cpu->pstate.turbo_freq;
|
||||
|
||||
policy->min = policy->cpuinfo.min_freq;
|
||||
policy->max = policy->cpuinfo.max_freq;
|
||||
|
||||
intel_pstate_init_acpi_perf_limits(policy);
|
||||
|
||||
policy->fast_switch_possible = true;
|
||||
|
|
|
|||
|
|
@ -553,13 +553,11 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||
goto out;
|
||||
}
|
||||
|
||||
policy->max = policy->cpuinfo.max_freq =
|
||||
ioread32(&pcch_hdr->nominal) * 1000;
|
||||
policy->min = policy->cpuinfo.min_freq =
|
||||
ioread32(&pcch_hdr->minimum_frequency) * 1000;
|
||||
policy->cpuinfo.max_freq = ioread32(&pcch_hdr->nominal) * 1000;
|
||||
policy->cpuinfo.min_freq = ioread32(&pcch_hdr->minimum_frequency) * 1000;
|
||||
|
||||
pr_debug("init: policy->max is %d, policy->min is %d\n",
|
||||
policy->max, policy->min);
|
||||
pr_debug("init: max_freq is %d, min_freq is %d\n",
|
||||
policy->cpuinfo.max_freq, policy->cpuinfo.min_freq);
|
||||
out:
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,9 +185,8 @@ static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy)
|
|||
int ret = -EINVAL;
|
||||
|
||||
/* set default policy and cpuinfo */
|
||||
policy->min = policy->cpuinfo.min_freq = 104000;
|
||||
policy->max = policy->cpuinfo.max_freq =
|
||||
(cpu_is_pxa320()) ? 806000 : 624000;
|
||||
policy->cpuinfo.min_freq = 104000;
|
||||
policy->cpuinfo.max_freq = (cpu_is_pxa320()) ? 806000 : 624000;
|
||||
policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */
|
||||
|
||||
if (cpu_is_pxa300() || cpu_is_pxa310())
|
||||
|
|
|
|||
|
|
@ -124,10 +124,8 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
|||
dev_notice(dev, "no frequency table found, falling back "
|
||||
"to rate rounding.\n");
|
||||
|
||||
policy->min = policy->cpuinfo.min_freq =
|
||||
(clk_round_rate(cpuclk, 1) + 500) / 1000;
|
||||
policy->max = policy->cpuinfo.max_freq =
|
||||
(clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
|
||||
policy->cpuinfo.min_freq = (clk_round_rate(cpuclk, 1) + 500) / 1000;
|
||||
policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -164,10 +164,7 @@ static int virt_cpufreq_get_freq_info(struct cpufreq_policy *policy)
|
|||
policy->cpuinfo.min_freq = 1;
|
||||
policy->cpuinfo.max_freq = virt_cpufreq_get_perftbl_entry(policy->cpu, 0);
|
||||
|
||||
policy->min = policy->cpuinfo.min_freq;
|
||||
policy->max = policy->cpuinfo.max_freq;
|
||||
|
||||
policy->cur = policy->max;
|
||||
policy->cur = policy->cpuinfo.max_freq;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user