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

Merge branch 'pm-cpufreq'

* pm-cpufreq:
cpufreq: Makefile: fix compilation for davinci platform
intel_pstate: Set CPU number before accessing MSRs
intel_pstate: Update documentation of {max,min}_perf_pct sysfs files
intel_pstate: don't touch turbo bit if turbo disabled or unavailable.
intel_pstate: Fix setting VID

+28 -16
+5 -2
Documentation/cpu-freq/intel-pstate.txt
··· 15 15 /sys/devices/system/cpu/intel_pstate/ 16 16 17 17 max_perf_pct: limits the maximum P state that will be requested by 18 - the driver stated as a percentage of the available performance. 18 + the driver stated as a percentage of the available performance. The 19 + available (P states) performance may be reduced by the no_turbo 20 + setting described below. 19 21 20 22 min_perf_pct: limits the minimum P state that will be requested by 21 - the driver stated as a percentage of the available performance. 23 + the driver stated as a percentage of the max (non-turbo) 24 + performance level. 22 25 23 26 no_turbo: limits the driver to selecting P states below the turbo 24 27 frequency range.
+1 -1
drivers/cpufreq/Makefile
··· 49 49 # LITTLE drivers, so that it is probed last. 50 50 obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o 51 51 52 - obj-$(CONFIG_ARCH_DAVINCI_DA850) += davinci-cpufreq.o 52 + obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o 53 53 obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o 54 54 obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o 55 55 obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o
+22 -13
drivers/cpufreq/intel_pstate.c
··· 128 128 129 129 struct perf_limits { 130 130 int no_turbo; 131 + int turbo_disabled; 131 132 int max_perf_pct; 132 133 int min_perf_pct; 133 134 int32_t max_perf; ··· 288 287 if (ret != 1) 289 288 return -EINVAL; 290 289 limits.no_turbo = clamp_t(int, input, 0 , 1); 291 - 290 + if (limits.turbo_disabled) { 291 + pr_warn("Turbo disabled by BIOS or unavailable on processor\n"); 292 + limits.no_turbo = limits.turbo_disabled; 293 + } 292 294 return count; 293 295 } 294 296 ··· 361 357 { 362 358 u64 value; 363 359 rdmsrl(BYT_RATIOS, value); 364 - return (value >> 8) & 0x3F; 360 + return (value >> 8) & 0x7F; 365 361 } 366 362 367 363 static int byt_get_max_pstate(void) 368 364 { 369 365 u64 value; 370 366 rdmsrl(BYT_RATIOS, value); 371 - return (value >> 16) & 0x3F; 367 + return (value >> 16) & 0x7F; 372 368 } 373 369 374 370 static int byt_get_turbo_pstate(void) 375 371 { 376 372 u64 value; 377 373 rdmsrl(BYT_TURBO_RATIOS, value); 378 - return value & 0x3F; 374 + return value & 0x7F; 379 375 } 380 376 381 377 static void byt_set_pstate(struct cpudata *cpudata, int pstate) ··· 385 381 u32 vid; 386 382 387 383 val = pstate << 8; 388 - if (limits.no_turbo) 384 + if (limits.no_turbo && !limits.turbo_disabled) 389 385 val |= (u64)1 << 32; 390 386 391 387 vid_fp = cpudata->vid.min + mul_fp( ··· 409 405 410 406 411 407 rdmsrl(BYT_VIDS, value); 412 - cpudata->vid.min = int_tofp((value >> 8) & 0x3f); 413 - cpudata->vid.max = int_tofp((value >> 16) & 0x3f); 408 + cpudata->vid.min = int_tofp((value >> 8) & 0x7f); 409 + cpudata->vid.max = int_tofp((value >> 16) & 0x7f); 414 410 cpudata->vid.ratio = div_fp( 415 411 cpudata->vid.max - cpudata->vid.min, 416 412 int_tofp(cpudata->pstate.max_pstate - ··· 452 448 u64 val; 453 449 454 450 val = pstate << 8; 455 - if (limits.no_turbo) 451 + if (limits.no_turbo && !limits.turbo_disabled) 456 452 val |= (u64)1 << 32; 457 453 458 454 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); ··· 700 696 701 697 cpu = all_cpu_data[cpunum]; 702 698 703 - intel_pstate_get_cpu_pstates(cpu); 704 - 705 699 cpu->cpu = cpunum; 700 + intel_pstate_get_cpu_pstates(cpu); 706 701 707 702 init_timer_deferrable(&cpu->timer); 708 703 cpu->timer.function = intel_pstate_timer_func; ··· 744 741 limits.min_perf = int_tofp(1); 745 742 limits.max_perf_pct = 100; 746 743 limits.max_perf = int_tofp(1); 747 - limits.no_turbo = 0; 744 + limits.no_turbo = limits.turbo_disabled; 748 745 return 0; 749 746 } 750 747 limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; ··· 787 784 { 788 785 struct cpudata *cpu; 789 786 int rc; 787 + u64 misc_en; 790 788 791 789 rc = intel_pstate_init_cpu(policy->cpu); 792 790 if (rc) ··· 795 791 796 792 cpu = all_cpu_data[policy->cpu]; 797 793 798 - if (!limits.no_turbo && 799 - limits.min_perf_pct == 100 && limits.max_perf_pct == 100) 794 + rdmsrl(MSR_IA32_MISC_ENABLE, misc_en); 795 + if (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE || 796 + cpu->pstate.max_pstate == cpu->pstate.turbo_pstate) { 797 + limits.turbo_disabled = 1; 798 + limits.no_turbo = 1; 799 + } 800 + if (limits.min_perf_pct == 100 && limits.max_perf_pct == 100) 800 801 policy->policy = CPUFREQ_POLICY_PERFORMANCE; 801 802 else 802 803 policy->policy = CPUFREQ_POLICY_POWERSAVE;