diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2018-06-05 17:42:41 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-06-06 02:37:52 -0400 |
commit | aaaece3de9d7709d79004dd5d5aa7c9b366f0675 (patch) | |
tree | fefb9446852b3afdafba4a83bac0b21e174f9385 | |
parent | 52ccc4314293272397b117f3cc6f0f368c81431c (diff) |
cpufreq: intel_pstate: New sysfs entry to control HWP boost
A new attribute is added to intel_pstate sysfs to enable/disable
HWP dynamic performance boost.
Reported-by: Mel Gorman <mgorman@techsingularity.net>
Tested-by: Giovanni Gherdovich <ggherdovich@suse.cz>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 5b2b6b6d1ff4..70bf63bb4e0e 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -1033,6 +1033,30 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, | |||
1033 | return count; | 1033 | return count; |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | static ssize_t show_hwp_dynamic_boost(struct kobject *kobj, | ||
1037 | struct attribute *attr, char *buf) | ||
1038 | { | ||
1039 | return sprintf(buf, "%u\n", hwp_boost); | ||
1040 | } | ||
1041 | |||
1042 | static ssize_t store_hwp_dynamic_boost(struct kobject *a, struct attribute *b, | ||
1043 | const char *buf, size_t count) | ||
1044 | { | ||
1045 | unsigned int input; | ||
1046 | int ret; | ||
1047 | |||
1048 | ret = kstrtouint(buf, 10, &input); | ||
1049 | if (ret) | ||
1050 | return ret; | ||
1051 | |||
1052 | mutex_lock(&intel_pstate_driver_lock); | ||
1053 | hwp_boost = !!input; | ||
1054 | intel_pstate_update_policies(); | ||
1055 | mutex_unlock(&intel_pstate_driver_lock); | ||
1056 | |||
1057 | return count; | ||
1058 | } | ||
1059 | |||
1036 | show_one(max_perf_pct, max_perf_pct); | 1060 | show_one(max_perf_pct, max_perf_pct); |
1037 | show_one(min_perf_pct, min_perf_pct); | 1061 | show_one(min_perf_pct, min_perf_pct); |
1038 | 1062 | ||
@@ -1042,6 +1066,7 @@ define_one_global_rw(max_perf_pct); | |||
1042 | define_one_global_rw(min_perf_pct); | 1066 | define_one_global_rw(min_perf_pct); |
1043 | define_one_global_ro(turbo_pct); | 1067 | define_one_global_ro(turbo_pct); |
1044 | define_one_global_ro(num_pstates); | 1068 | define_one_global_ro(num_pstates); |
1069 | define_one_global_rw(hwp_dynamic_boost); | ||
1045 | 1070 | ||
1046 | static struct attribute *intel_pstate_attributes[] = { | 1071 | static struct attribute *intel_pstate_attributes[] = { |
1047 | &status.attr, | 1072 | &status.attr, |
@@ -1082,6 +1107,11 @@ static void __init intel_pstate_sysfs_expose_params(void) | |||
1082 | rc = sysfs_create_file(intel_pstate_kobject, &min_perf_pct.attr); | 1107 | rc = sysfs_create_file(intel_pstate_kobject, &min_perf_pct.attr); |
1083 | WARN_ON(rc); | 1108 | WARN_ON(rc); |
1084 | 1109 | ||
1110 | if (hwp_active) { | ||
1111 | rc = sysfs_create_file(intel_pstate_kobject, | ||
1112 | &hwp_dynamic_boost.attr); | ||
1113 | WARN_ON(rc); | ||
1114 | } | ||
1085 | } | 1115 | } |
1086 | /************************** sysfs end ************************/ | 1116 | /************************** sysfs end ************************/ |
1087 | 1117 | ||