[v2,2/4] cpufreq: Introduce CPUFREQ_GOV_FLAG_STRICT_TARGET
diff mbox series

Message ID 1691551.0Fp6MP5ZGR@kreacher
State New, archived
Headers show
Series
  • cpufreq: intel_pstate: Handle powersave governor correctly in the passive mode with HWP
Related show

Commit Message

Rafael J. Wysocki Nov. 9, 2020, 4:52 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Introduce a new governor flag, CPUFREQ_GOV_FLAG_STRICT_TARGET, for
the govenors that want the target frequency to be set exactly to the
given value without leaving any room for adjustments on the hardware
side and set this flag for the powersave and performance governors.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/cpufreq_performance.c |    1 +
 drivers/cpufreq/cpufreq_powersave.c   |    1 +
 include/linux/cpufreq.h               |    3 +++
 3 files changed, 5 insertions(+)

Comments

Viresh Kumar Nov. 10, 2020, 2:41 a.m. UTC | #1
On 09-11-20, 17:52, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Introduce a new governor flag, CPUFREQ_GOV_FLAG_STRICT_TARGET, for
> the govenors that want the target frequency to be set exactly to the
> given value without leaving any room for adjustments on the hardware
> side and set this flag for the powersave and performance governors.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpufreq/cpufreq_performance.c |    1 +
>  drivers/cpufreq/cpufreq_powersave.c   |    1 +
>  include/linux/cpufreq.h               |    3 +++
>  3 files changed, 5 insertions(+)
> 
> Index: linux-pm/drivers/cpufreq/cpufreq_performance.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/cpufreq_performance.c
> +++ linux-pm/drivers/cpufreq/cpufreq_performance.c
> @@ -20,6 +20,7 @@ static void cpufreq_gov_performance_limi
>  static struct cpufreq_governor cpufreq_gov_performance = {
>  	.name		= "performance",
>  	.owner		= THIS_MODULE,
> +	.flags		= CPUFREQ_GOV_FLAG_STRICT_TARGET,
>  	.limits		= cpufreq_gov_performance_limits,
>  };
>  
> Index: linux-pm/drivers/cpufreq/cpufreq_powersave.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/cpufreq_powersave.c
> +++ linux-pm/drivers/cpufreq/cpufreq_powersave.c
> @@ -21,6 +21,7 @@ static struct cpufreq_governor cpufreq_g
>  	.name		= "powersave",
>  	.limits		= cpufreq_gov_powersave_limits,
>  	.owner		= THIS_MODULE,
> +	.flags		= CPUFREQ_GOV_FLAG_STRICT_TARGET,
>  };
>  
>  MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
> Index: linux-pm/include/linux/cpufreq.h
> ===================================================================
> --- linux-pm.orig/include/linux/cpufreq.h
> +++ linux-pm/include/linux/cpufreq.h
> @@ -575,6 +575,9 @@ struct cpufreq_governor {
>  /* For governors which change frequency dynamically by themselves */
>  #define CPUFREQ_GOV_FLAG_DYN_SWITCH	BIT(0)
>  
> +/* For governors wanting the target frequency to be set exactly */
> +#define CPUFREQ_GOV_FLAG_STRICT_TARGET	BIT(1)
> +
>  
>  /* Pass a target to the cpufreq driver */
>  unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Patch
diff mbox series

Index: linux-pm/drivers/cpufreq/cpufreq_performance.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq_performance.c
+++ linux-pm/drivers/cpufreq/cpufreq_performance.c
@@ -20,6 +20,7 @@  static void cpufreq_gov_performance_limi
 static struct cpufreq_governor cpufreq_gov_performance = {
 	.name		= "performance",
 	.owner		= THIS_MODULE,
+	.flags		= CPUFREQ_GOV_FLAG_STRICT_TARGET,
 	.limits		= cpufreq_gov_performance_limits,
 };
 
Index: linux-pm/drivers/cpufreq/cpufreq_powersave.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq_powersave.c
+++ linux-pm/drivers/cpufreq/cpufreq_powersave.c
@@ -21,6 +21,7 @@  static struct cpufreq_governor cpufreq_g
 	.name		= "powersave",
 	.limits		= cpufreq_gov_powersave_limits,
 	.owner		= THIS_MODULE,
+	.flags		= CPUFREQ_GOV_FLAG_STRICT_TARGET,
 };
 
 MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
Index: linux-pm/include/linux/cpufreq.h
===================================================================
--- linux-pm.orig/include/linux/cpufreq.h
+++ linux-pm/include/linux/cpufreq.h
@@ -575,6 +575,9 @@  struct cpufreq_governor {
 /* For governors which change frequency dynamically by themselves */
 #define CPUFREQ_GOV_FLAG_DYN_SWITCH	BIT(0)
 
+/* For governors wanting the target frequency to be set exactly */
+#define CPUFREQ_GOV_FLAG_STRICT_TARGET	BIT(1)
+
 
 /* Pass a target to the cpufreq driver */
 unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,