[V3,1/2] cpufreq: Export cpufreq_update_pressure

Message ID 20240227181632.659133-2-quic_sibis@quicinc.com
State New
Headers
Series firmware: arm_scmi: Register and handle limits change notification |

Commit Message

Sibi Sankar Feb. 27, 2024, 6:16 p.m. UTC
  The SCMI cpufreq driver doesn't require any additional signal
smoothing provided by arch_update_hw_pressure interface, export
cpufreq_update_pressure so that it can be called upon directly
instead.

Suggested-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
---
 drivers/cpufreq/cpufreq.c | 3 ++-
 include/linux/cpufreq.h   | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
  

Comments

Trilok Soni Feb. 27, 2024, 7:32 p.m. UTC | #1
On 2/27/2024 10:16 AM, Sibi Sankar wrote:
> The SCMI cpufreq driver doesn't require any additional signal
> smoothing provided by arch_update_hw_pressure interface, export
> cpufreq_update_pressure so that it can be called upon directly
> instead.
> 
> Suggested-by: Lukasz Luba <lukasz.luba@arm.com>
> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
> ---
>  drivers/cpufreq/cpufreq.c | 3 ++-
>  include/linux/cpufreq.h   | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 76002aa3d12d..bdec2dfd77eb 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2573,7 +2573,7 @@ DEFINE_PER_CPU(unsigned long, cpufreq_pressure);
>   *
>   * Update the value of cpufreq pressure for all @cpus in the policy.
>   */
> -static void cpufreq_update_pressure(struct cpufreq_policy *policy)
> +void cpufreq_update_pressure(struct cpufreq_policy *policy)
>  {
>  	unsigned long max_capacity, capped_freq, pressure;
>  	u32 max_freq;
> @@ -2598,6 +2598,7 @@ static void cpufreq_update_pressure(struct cpufreq_policy *policy)
>  	for_each_cpu(cpu, policy->related_cpus)
>  		WRITE_ONCE(per_cpu(cpufreq_pressure, cpu), pressure);
>  }
> +EXPORT_SYMBOL(cpufreq_update_pressure);

EXPORT_SYMBOL_GPL please. Other symbols in this file are _GPL as well. 

>  
>  /**
>   * cpufreq_set_policy - Modify cpufreq policy parameters.
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index 414bfc976b30..957bf8e4ca0d 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -241,6 +241,7 @@ struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
>  void cpufreq_enable_fast_switch(struct cpufreq_policy *policy);
>  void cpufreq_disable_fast_switch(struct cpufreq_policy *policy);
>  bool has_target_index(void);
> +void cpufreq_update_pressure(struct cpufreq_policy *policy);
>  
>  DECLARE_PER_CPU(unsigned long, cpufreq_pressure);
>  static inline unsigned long cpufreq_get_pressure(int cpu)
> @@ -270,6 +271,7 @@ static inline bool cpufreq_supports_freq_invariance(void)
>  }
>  static inline void disable_cpufreq(void) { }
>  static inline void cpufreq_update_limits(unsigned int cpu) { }
> +static inline void cpufreq_update_pressure(struct cpufreq_policy *policy) { }
>  static inline unsigned long cpufreq_get_pressure(int cpu)
>  {
>  	return 0;
  
Sibi Sankar Feb. 28, 2024, 5:16 a.m. UTC | #2
On 2/28/24 01:02, Trilok Soni wrote:
> On 2/27/2024 10:16 AM, Sibi Sankar wrote:
>> The SCMI cpufreq driver doesn't require any additional signal
>> smoothing provided by arch_update_hw_pressure interface, export
>> cpufreq_update_pressure so that it can be called upon directly
>> instead.
>>
>> Suggested-by: Lukasz Luba <lukasz.luba@arm.com>
>> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
>> ---
>>   drivers/cpufreq/cpufreq.c | 3 ++-
>>   include/linux/cpufreq.h   | 2 ++
>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 76002aa3d12d..bdec2dfd77eb 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -2573,7 +2573,7 @@ DEFINE_PER_CPU(unsigned long, cpufreq_pressure);
>>    *
>>    * Update the value of cpufreq pressure for all @cpus in the policy.
>>    */
>> -static void cpufreq_update_pressure(struct cpufreq_policy *policy)
>> +void cpufreq_update_pressure(struct cpufreq_policy *policy)
>>   {
>>   	unsigned long max_capacity, capped_freq, pressure;
>>   	u32 max_freq;
>> @@ -2598,6 +2598,7 @@ static void cpufreq_update_pressure(struct cpufreq_policy *policy)
>>   	for_each_cpu(cpu, policy->related_cpus)
>>   		WRITE_ONCE(per_cpu(cpufreq_pressure, cpu), pressure);
>>   }
>> +EXPORT_SYMBOL(cpufreq_update_pressure);
> 
> EXPORT_SYMBOL_GPL please. Other symbols in this file are _GPL as well.

Hey Trilok,

Thanks for catching this. Will fix it in the re-spin.

-Sibi

> 
>>   
>>   /**
>>    * cpufreq_set_policy - Modify cpufreq policy parameters.
>> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
>> index 414bfc976b30..957bf8e4ca0d 100644
>> --- a/include/linux/cpufreq.h
>> +++ b/include/linux/cpufreq.h
>> @@ -241,6 +241,7 @@ struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
>>   void cpufreq_enable_fast_switch(struct cpufreq_policy *policy);
>>   void cpufreq_disable_fast_switch(struct cpufreq_policy *policy);
>>   bool has_target_index(void);
>> +void cpufreq_update_pressure(struct cpufreq_policy *policy);
>>   
>>   DECLARE_PER_CPU(unsigned long, cpufreq_pressure);
>>   static inline unsigned long cpufreq_get_pressure(int cpu)
>> @@ -270,6 +271,7 @@ static inline bool cpufreq_supports_freq_invariance(void)
>>   }
>>   static inline void disable_cpufreq(void) { }
>>   static inline void cpufreq_update_limits(unsigned int cpu) { }
>> +static inline void cpufreq_update_pressure(struct cpufreq_policy *policy) { }
>>   static inline unsigned long cpufreq_get_pressure(int cpu)
>>   {
>>   	return 0;
  

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 76002aa3d12d..bdec2dfd77eb 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2573,7 +2573,7 @@  DEFINE_PER_CPU(unsigned long, cpufreq_pressure);
  *
  * Update the value of cpufreq pressure for all @cpus in the policy.
  */
-static void cpufreq_update_pressure(struct cpufreq_policy *policy)
+void cpufreq_update_pressure(struct cpufreq_policy *policy)
 {
 	unsigned long max_capacity, capped_freq, pressure;
 	u32 max_freq;
@@ -2598,6 +2598,7 @@  static void cpufreq_update_pressure(struct cpufreq_policy *policy)
 	for_each_cpu(cpu, policy->related_cpus)
 		WRITE_ONCE(per_cpu(cpufreq_pressure, cpu), pressure);
 }
+EXPORT_SYMBOL(cpufreq_update_pressure);
 
 /**
  * cpufreq_set_policy - Modify cpufreq policy parameters.
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 414bfc976b30..957bf8e4ca0d 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -241,6 +241,7 @@  struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
 void cpufreq_enable_fast_switch(struct cpufreq_policy *policy);
 void cpufreq_disable_fast_switch(struct cpufreq_policy *policy);
 bool has_target_index(void);
+void cpufreq_update_pressure(struct cpufreq_policy *policy);
 
 DECLARE_PER_CPU(unsigned long, cpufreq_pressure);
 static inline unsigned long cpufreq_get_pressure(int cpu)
@@ -270,6 +271,7 @@  static inline bool cpufreq_supports_freq_invariance(void)
 }
 static inline void disable_cpufreq(void) { }
 static inline void cpufreq_update_limits(unsigned int cpu) { }
+static inline void cpufreq_update_pressure(struct cpufreq_policy *policy) { }
 static inline unsigned long cpufreq_get_pressure(int cpu)
 {
 	return 0;