Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kristen Carlson Accardi and committed by
Rafael J. Wysocki
0522424e d01b1f48

+17
+4
Documentation/cpu-freq/intel-pstate.txt
··· 41 41 is supported by hardware that is in the turbo range. This number 42 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 + 44 48 For contemporary Intel processors, the frequency is controlled by the 45 49 processor itself and the P-states exposed to software are related to 46 50 performance levels. The idea that frequency can be set to a single
+13
drivers/cpufreq/intel_pstate.c
··· 354 354 return sprintf(buf, "%u\n", turbo_pct); 355 355 } 356 356 357 + static 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 + 357 368 static ssize_t show_no_turbo(struct kobject *kobj, 358 369 struct attribute *attr, char *buf) 359 370 { ··· 446 435 define_one_global_rw(max_perf_pct); 447 436 define_one_global_rw(min_perf_pct); 448 437 define_one_global_ro(turbo_pct); 438 + define_one_global_ro(num_pstates); 449 439 450 440 static struct attribute *intel_pstate_attributes[] = { 451 441 &no_turbo.attr, 452 442 &max_perf_pct.attr, 453 443 &min_perf_pct.attr, 454 444 &turbo_pct.attr, 445 + &num_pstates.attr, 455 446 NULL 456 447 }; 457 448