summaryrefslogtreecommitdiff
path: root/tools/power/cpupower/utils/cpupower-set.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/power/cpupower/utils/cpupower-set.c')
-rw-r--r--tools/power/cpupower/utils/cpupower-set.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index 180d5ba877e6..a789b123dbd4 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -18,6 +18,7 @@
static struct option set_opts[] = {
{"perf-bias", required_argument, NULL, 'b'},
+ {"epp", required_argument, NULL, 'e'},
{ },
};
@@ -37,11 +38,13 @@ int cmd_set(int argc, char **argv)
union {
struct {
int perf_bias:1;
+ int epp:1;
};
int params;
} params;
int perf_bias = 0;
int ret = 0;
+ char epp[30];
ret = uname(&uts);
if (!ret && (!strcmp(uts.machine, "ppc64le") ||
@@ -55,7 +58,7 @@ int cmd_set(int argc, char **argv)
params.params = 0;
/* parameter parsing */
- while ((ret = getopt_long(argc, argv, "b:",
+ while ((ret = getopt_long(argc, argv, "b:e:",
set_opts, NULL)) != -1) {
switch (ret) {
case 'b':
@@ -69,6 +72,15 @@ int cmd_set(int argc, char **argv)
}
params.perf_bias = 1;
break;
+ case 'e':
+ if (params.epp)
+ print_wrong_arg_exit();
+ if (sscanf(optarg, "%29s", epp) != 1) {
+ print_wrong_arg_exit();
+ return -EINVAL;
+ }
+ params.epp = 1;
+ break;
default:
print_wrong_arg_exit();
}
@@ -102,6 +114,15 @@ int cmd_set(int argc, char **argv)
break;
}
}
+
+ if (params.epp) {
+ ret = cpupower_set_epp(cpu, epp);
+ if (ret) {
+ fprintf(stderr,
+ "Error setting epp value on CPU %d\n", cpu);
+ break;
+ }
+ }
}
return ret;
}