aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen@linux.intel.com>2015-01-28 18:03:28 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-01-29 19:52:17 -0500
commit0522424ecb333c0874c4e74bc053dd662bed40df (patch)
tree2d04b3435d5b078c906a52272723546a8bc45545
parentd01b1f48c5fd95901203bd830458eaf619ed6c47 (diff)
intel_pstate: Add num_pstates to sysfs
Add a sysfs interface to display the total number of supported pstates. This value is independent of whether turbo has been enabled or disabled. Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--Documentation/cpu-freq/intel-pstate.txt4
-rw-r--r--drivers/cpufreq/intel_pstate.c13
2 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt
index 7767ce6756be..655750743fb0 100644
--- a/Documentation/cpu-freq/intel-pstate.txt
+++ b/Documentation/cpu-freq/intel-pstate.txt
@@ -41,6 +41,10 @@ controlling P state selection. These files have been added to
41 is supported by hardware that is in the turbo range. This number 41 is supported by hardware that is in the turbo range. This number
42 is independent of whether turbo has been disabled or not. 42 is independent of whether turbo has been disabled or not.
43 43
44 num_pstates: displays the number of pstates that are supported
45 by hardware. This number is independent of whether turbo has
46 been disabled or not.
47
44For contemporary Intel processors, the frequency is controlled by the 48For contemporary Intel processors, the frequency is controlled by the
45processor itself and the P-states exposed to software are related to 49processor itself and the P-states exposed to software are related to
46performance levels. The idea that frequency can be set to a single 50performance levels. The idea that frequency can be set to a single
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index ed6dd7dac094..80ecc351d613 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -354,6 +354,17 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
354 return sprintf(buf, "%u\n", turbo_pct); 354 return sprintf(buf, "%u\n", turbo_pct);
355} 355}
356 356
357static ssize_t show_num_pstates(struct kobject *kobj,
358 struct attribute *attr, char *buf)
359{
360 struct cpudata *cpu;
361 int total;
362
363 cpu = all_cpu_data[0];
364 total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
365 return sprintf(buf, "%u\n", total);
366}
367
357static ssize_t show_no_turbo(struct kobject *kobj, 368static ssize_t show_no_turbo(struct kobject *kobj,
358 struct attribute *attr, char *buf) 369 struct attribute *attr, char *buf)
359{ 370{
@@ -435,12 +446,14 @@ define_one_global_rw(no_turbo);
435define_one_global_rw(max_perf_pct); 446define_one_global_rw(max_perf_pct);
436define_one_global_rw(min_perf_pct); 447define_one_global_rw(min_perf_pct);
437define_one_global_ro(turbo_pct); 448define_one_global_ro(turbo_pct);
449define_one_global_ro(num_pstates);
438 450
439static struct attribute *intel_pstate_attributes[] = { 451static struct attribute *intel_pstate_attributes[] = {
440 &no_turbo.attr, 452 &no_turbo.attr,
441 &max_perf_pct.attr, 453 &max_perf_pct.attr,
442 &min_perf_pct.attr, 454 &min_perf_pct.attr,
443 &turbo_pct.attr, 455 &turbo_pct.attr,
456 &num_pstates.attr,
444 NULL 457 NULL
445}; 458};
446 459