mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	cpufreq: Fix per-policy boost behavior on SoCs using cpufreq_boost_set_sw()
In the existing code, per-policy flags don't have any impact i.e.
if cpufreq_driver boost is enabled and boost is disabled for one or
more of the policies, the cpufreq driver will behave as if boost is
enabled.
Fix this by incorporating per-policy boost flag in the policy->max
computation used in cpufreq_frequency_table_cpuinfo and setting the
default per-policy boost to mirror the cpufreq_driver boost flag.
Fixes: 218a06a79d ("cpufreq: Support per-policy performance boost")
Reported-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
Tested-by:Yipeng Zou <zouyipeng@huawei.com> <mailto:zouyipeng@huawei.com>
Reviewed-by: Yipeng Zou <zouyipeng@huawei.com> <mailto:zouyipeng@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
			
			
This commit is contained in:
		
							parent
							
								
									07abb19a9b
								
							
						
					
					
						commit
						f37a4d6b4a
					
				
					 2 changed files with 14 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -653,14 +653,16 @@ static ssize_t store_local_boost(struct cpufreq_policy *policy,
 | 
			
		|||
	if (policy->boost_enabled == enable)
 | 
			
		||||
		return count;
 | 
			
		||||
 | 
			
		||||
	policy->boost_enabled = enable;
 | 
			
		||||
 | 
			
		||||
	cpus_read_lock();
 | 
			
		||||
	ret = cpufreq_driver->set_boost(policy, enable);
 | 
			
		||||
	cpus_read_unlock();
 | 
			
		||||
 | 
			
		||||
	if (ret)
 | 
			
		||||
	if (ret) {
 | 
			
		||||
		policy->boost_enabled = !policy->boost_enabled;
 | 
			
		||||
		return ret;
 | 
			
		||||
 | 
			
		||||
	policy->boost_enabled = enable;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return count;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1428,6 +1430,9 @@ static int cpufreq_online(unsigned int cpu)
 | 
			
		|||
			goto out_free_policy;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* Let the per-policy boost flag mirror the cpufreq_driver boost during init */
 | 
			
		||||
		policy->boost_enabled = cpufreq_boost_enabled() && policy_has_boost_freq(policy);
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * The initialization has succeeded and the policy is online.
 | 
			
		||||
		 * If there is a problem with its frequency table, take it
 | 
			
		||||
| 
						 | 
				
			
			@ -2769,11 +2774,12 @@ int cpufreq_boost_trigger_state(int state)
 | 
			
		|||
 | 
			
		||||
	cpus_read_lock();
 | 
			
		||||
	for_each_active_policy(policy) {
 | 
			
		||||
		ret = cpufreq_driver->set_boost(policy, state);
 | 
			
		||||
		if (ret)
 | 
			
		||||
			goto err_reset_state;
 | 
			
		||||
 | 
			
		||||
		policy->boost_enabled = state;
 | 
			
		||||
		ret = cpufreq_driver->set_boost(policy, state);
 | 
			
		||||
		if (ret) {
 | 
			
		||||
			policy->boost_enabled = !policy->boost_enabled;
 | 
			
		||||
			goto err_reset_state;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	cpus_read_unlock();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
 | 
			
		|||
	cpufreq_for_each_valid_entry(pos, table) {
 | 
			
		||||
		freq = pos->frequency;
 | 
			
		||||
 | 
			
		||||
		if (!cpufreq_boost_enabled()
 | 
			
		||||
		if ((!cpufreq_boost_enabled() || !policy->boost_enabled)
 | 
			
		||||
		    && (pos->flags & CPUFREQ_BOOST_FREQ))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue