aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/intel_pstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/intel_pstate.c')
-rw-r--r--drivers/cpufreq/intel_pstate.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 872c5772c5d3..c5b81beccc8e 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -614,6 +614,19 @@ static void core_set_pstate(struct cpudata *cpudata, int pstate)
614 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); 614 wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val);
615} 615}
616 616
617static int knl_get_turbo_pstate(void)
618{
619 u64 value;
620 int nont, ret;
621
622 rdmsrl(MSR_NHM_TURBO_RATIO_LIMIT, value);
623 nont = core_get_max_pstate();
624 ret = (((value) >> 8) & 0xFF);
625 if (ret <= nont)
626 ret = nont;
627 return ret;
628}
629
617static struct cpu_defaults core_params = { 630static struct cpu_defaults core_params = {
618 .pid_policy = { 631 .pid_policy = {
619 .sample_rate_ms = 10, 632 .sample_rate_ms = 10,
@@ -651,6 +664,23 @@ static struct cpu_defaults byt_params = {
651 }, 664 },
652}; 665};
653 666
667static struct cpu_defaults knl_params = {
668 .pid_policy = {
669 .sample_rate_ms = 10,
670 .deadband = 0,
671 .setpoint = 97,
672 .p_gain_pct = 20,
673 .d_gain_pct = 0,
674 .i_gain_pct = 0,
675 },
676 .funcs = {
677 .get_max = core_get_max_pstate,
678 .get_min = core_get_min_pstate,
679 .get_turbo = knl_get_turbo_pstate,
680 .set = core_set_pstate,
681 },
682};
683
654static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) 684static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max)
655{ 685{
656 int max_perf = cpu->pstate.turbo_pstate; 686 int max_perf = cpu->pstate.turbo_pstate;
@@ -865,6 +895,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
865 ICPU(0x4e, core_params), 895 ICPU(0x4e, core_params),
866 ICPU(0x4f, core_params), 896 ICPU(0x4f, core_params),
867 ICPU(0x56, core_params), 897 ICPU(0x56, core_params),
898 ICPU(0x57, knl_params),
868 {} 899 {}
869}; 900};
870MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); 901MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
@@ -1024,25 +1055,11 @@ static unsigned int force_load;
1024 1055
1025static int intel_pstate_msrs_not_valid(void) 1056static int intel_pstate_msrs_not_valid(void)
1026{ 1057{
1027 /* Check that all the msr's we are using are valid. */
1028 u64 aperf, mperf, tmp;
1029
1030 rdmsrl(MSR_IA32_APERF, aperf);
1031 rdmsrl(MSR_IA32_MPERF, mperf);
1032
1033 if (!pstate_funcs.get_max() || 1058 if (!pstate_funcs.get_max() ||
1034 !pstate_funcs.get_min() || 1059 !pstate_funcs.get_min() ||
1035 !pstate_funcs.get_turbo()) 1060 !pstate_funcs.get_turbo())
1036 return -ENODEV; 1061 return -ENODEV;
1037 1062
1038 rdmsrl(MSR_IA32_APERF, tmp);
1039 if (!(tmp - aperf))
1040 return -ENODEV;
1041
1042 rdmsrl(MSR_IA32_MPERF, tmp);
1043 if (!(tmp - mperf))
1044 return -ENODEV;
1045
1046 return 0; 1063 return 0;
1047} 1064}
1048 1065