This defines a generic policy in addition to the existing PERFORMANCE and POWERSAVE policies. The ADAPTIVE policy is expected to provide a variable trade-off between performance and energy efficiency based on the dynamic behavior of the workload -- E.g. whether the system has a bottleneck on the CPU or another IO device. Signed-off-by: Francisco Jerez <currojerez@xxxxxxxxxx> --- drivers/cpufreq/cpufreq.c | 10 ++++++++-- drivers/cpufreq/longrun.c | 1 + include/linux/cpufreq.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 045f9fe157ce..e87285b6294c 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -629,6 +629,9 @@ static unsigned int cpufreq_parse_policy(char *str_governor) if (!strncasecmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) return CPUFREQ_POLICY_POWERSAVE; + if (!strncasecmp(str_governor, "adaptive", CPUFREQ_NAME_LEN)) + return CPUFREQ_POLICY_ADAPTIVE; + return CPUFREQ_POLICY_UNKNOWN; } @@ -750,6 +753,8 @@ static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) return sprintf(buf, "powersave\n"); else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) return sprintf(buf, "performance\n"); + else if (policy->policy == CPUFREQ_POLICY_ADAPTIVE) + return sprintf(buf, "adaptive\n"); else if (policy->governor) return scnprintf(buf, CPUFREQ_NAME_PLEN, "%s\n", policy->governor->name); @@ -811,7 +816,7 @@ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, struct cpufreq_governor *t; if (!has_target()) { - i += sprintf(buf, "performance powersave"); + i += sprintf(buf, "performance powersave adaptive"); goto out; } @@ -1085,7 +1090,8 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) pol = policy->policy; } if (pol != CPUFREQ_POLICY_PERFORMANCE && - pol != CPUFREQ_POLICY_POWERSAVE) + pol != CPUFREQ_POLICY_POWERSAVE && + pol != CPUFREQ_POLICY_ADAPTIVE) return -ENODATA; } diff --git a/drivers/cpufreq/longrun.c b/drivers/cpufreq/longrun.c index 1caaec7c280b..cb70f0b7ff7a 100644 --- a/drivers/cpufreq/longrun.c +++ b/drivers/cpufreq/longrun.c @@ -99,6 +99,7 @@ static int longrun_set_policy(struct cpufreq_policy *policy) msr_lo |= 0x00000001; break; case CPUFREQ_POLICY_POWERSAVE: + case CPUFREQ_POLICY_ADAPTIVE: break; } wrmsr(MSR_TMTA_LONGRUN_FLAGS, msr_lo, msr_hi); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index f7240251a949..fa63df914f9f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -536,6 +536,7 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, */ #define CPUFREQ_POLICY_POWERSAVE (1) #define CPUFREQ_POLICY_PERFORMANCE (2) +#define CPUFREQ_POLICY_ADAPTIVE (3) /* * The polling frequency depends on the capability of the processor. Default -- 2.22.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx