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

intel_pstate: expose turbo range to sysfs

This patch adds "turbo_pct" to the intel_pstate sysfs interface.
turbo_pct will display the percentage of the total supported
pstates that are in the turbo range. This value is independent
of whether turbo has been disabled or not.

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
d01b1f48 7ab0256e

+22
+4
Documentation/cpu-freq/intel-pstate.txt
··· 37 37 no_turbo: limits the driver to selecting P states below the turbo 38 38 frequency range. 39 39 40 + turbo_pct: displays the percentage of the total performance that 41 + is supported by hardware that is in the turbo range. This number 42 + is independent of whether turbo has been disabled or not. 43 + 40 44 For contemporary Intel processors, the frequency is controlled by the 41 45 processor itself and the P-states exposed to software are related to 42 46 performance levels. The idea that frequency can be set to a single
+18
drivers/cpufreq/intel_pstate.c
··· 338 338 return sprintf(buf, "%u\n", limits.object); \ 339 339 } 340 340 341 + static ssize_t show_turbo_pct(struct kobject *kobj, 342 + struct attribute *attr, char *buf) 343 + { 344 + struct cpudata *cpu; 345 + int total, no_turbo, turbo_pct; 346 + uint32_t turbo_fp; 347 + 348 + cpu = all_cpu_data[0]; 349 + 350 + total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1; 351 + no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1; 352 + turbo_fp = div_fp(int_tofp(no_turbo), int_tofp(total)); 353 + turbo_pct = 100 - fp_toint(mul_fp(turbo_fp, int_tofp(100))); 354 + return sprintf(buf, "%u\n", turbo_pct); 355 + } 356 + 341 357 static ssize_t show_no_turbo(struct kobject *kobj, 342 358 struct attribute *attr, char *buf) 343 359 { ··· 434 418 define_one_global_rw(no_turbo); 435 419 define_one_global_rw(max_perf_pct); 436 420 define_one_global_rw(min_perf_pct); 421 + define_one_global_ro(turbo_pct); 437 422 438 423 static struct attribute *intel_pstate_attributes[] = { 439 424 &no_turbo.attr, 440 425 &max_perf_pct.attr, 441 426 &min_perf_pct.attr, 427 + &turbo_pct.attr, 442 428 NULL 443 429 }; 444 430