diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-20 19:28:23 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-20 19:28:23 -0500 |
| commit | fee5ae96e0bc48b13f97512aef91d5aea60240a5 (patch) | |
| tree | e12df466579cfb1b212854b294e1b1e9456ac79a | |
| parent | d8ad344cb445627687fb44769e2ed89f93d3f06b (diff) | |
| parent | 61d8d2abc15e9232c3914c55502b73e559366583 (diff) | |
Merge branch 'pm-cpufreq'
* pm-cpufreq:
intel_pstate: Add support for Baytrail turbo P states
intel_pstate: Use LFM bus ratio as min ratio/P state
cpufreq: powernow-k8: Initialize per-cpu data-structures properly
cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
| -rw-r--r-- | drivers/cpufreq/cpufreq.c | 3 | ||||
| -rw-r--r-- | drivers/cpufreq/intel_pstate.c | 17 | ||||
| -rw-r--r-- | drivers/cpufreq/powernow-k8.c | 10 |
3 files changed, 21 insertions, 9 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 08ca8c9f41cd..cb003a6b72c8 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, | |||
| 1323 | up_read(&policy->rwsem); | 1323 | up_read(&policy->rwsem); |
| 1324 | 1324 | ||
| 1325 | if (cpu != policy->cpu) { | 1325 | if (cpu != policy->cpu) { |
| 1326 | if (!frozen) | 1326 | sysfs_remove_link(&dev->kobj, "cpufreq"); |
| 1327 | sysfs_remove_link(&dev->kobj, "cpufreq"); | ||
| 1328 | } else if (cpus > 1) { | 1327 | } else if (cpus > 1) { |
| 1329 | new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); | 1328 | new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); |
| 1330 | if (new_cpu >= 0) { | 1329 | if (new_cpu >= 0) { |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index c788abf1c457..e90816105921 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -34,8 +34,10 @@ | |||
| 34 | 34 | ||
| 35 | #define SAMPLE_COUNT 3 | 35 | #define SAMPLE_COUNT 3 |
| 36 | 36 | ||
| 37 | #define BYT_RATIOS 0x66a | 37 | #define BYT_RATIOS 0x66a |
| 38 | #define BYT_VIDS 0x66b | 38 | #define BYT_VIDS 0x66b |
| 39 | #define BYT_TURBO_RATIOS 0x66c | ||
| 40 | |||
| 39 | 41 | ||
| 40 | #define FRAC_BITS 8 | 42 | #define FRAC_BITS 8 |
| 41 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) | 43 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) |
| @@ -357,7 +359,7 @@ static int byt_get_min_pstate(void) | |||
| 357 | { | 359 | { |
| 358 | u64 value; | 360 | u64 value; |
| 359 | rdmsrl(BYT_RATIOS, value); | 361 | rdmsrl(BYT_RATIOS, value); |
| 360 | return value & 0xFF; | 362 | return (value >> 8) & 0xFF; |
| 361 | } | 363 | } |
| 362 | 364 | ||
| 363 | static int byt_get_max_pstate(void) | 365 | static int byt_get_max_pstate(void) |
| @@ -367,6 +369,13 @@ static int byt_get_max_pstate(void) | |||
| 367 | return (value >> 16) & 0xFF; | 369 | return (value >> 16) & 0xFF; |
| 368 | } | 370 | } |
| 369 | 371 | ||
| 372 | static int byt_get_turbo_pstate(void) | ||
| 373 | { | ||
| 374 | u64 value; | ||
| 375 | rdmsrl(BYT_TURBO_RATIOS, value); | ||
| 376 | return value & 0x3F; | ||
| 377 | } | ||
| 378 | |||
| 370 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) | 379 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) |
| 371 | { | 380 | { |
| 372 | u64 val; | 381 | u64 val; |
| @@ -469,7 +478,7 @@ static struct cpu_defaults byt_params = { | |||
| 469 | .funcs = { | 478 | .funcs = { |
| 470 | .get_max = byt_get_max_pstate, | 479 | .get_max = byt_get_max_pstate, |
| 471 | .get_min = byt_get_min_pstate, | 480 | .get_min = byt_get_min_pstate, |
| 472 | .get_turbo = byt_get_max_pstate, | 481 | .get_turbo = byt_get_turbo_pstate, |
| 473 | .set = byt_set_pstate, | 482 | .set = byt_set_pstate, |
| 474 | .get_vid = byt_get_vid, | 483 | .get_vid = byt_get_vid, |
| 475 | }, | 484 | }, |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index e10b646634d7..6684e0342792 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
| @@ -1076,7 +1076,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1076 | { | 1076 | { |
| 1077 | struct powernow_k8_data *data; | 1077 | struct powernow_k8_data *data; |
| 1078 | struct init_on_cpu init_on_cpu; | 1078 | struct init_on_cpu init_on_cpu; |
| 1079 | int rc; | 1079 | int rc, cpu; |
| 1080 | 1080 | ||
| 1081 | smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1); | 1081 | smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1); |
| 1082 | if (rc) | 1082 | if (rc) |
| @@ -1140,7 +1140,9 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1140 | pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", | 1140 | pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", |
| 1141 | data->currfid, data->currvid); | 1141 | data->currfid, data->currvid); |
| 1142 | 1142 | ||
| 1143 | per_cpu(powernow_data, pol->cpu) = data; | 1143 | /* Point all the CPUs in this policy to the same data */ |
| 1144 | for_each_cpu(cpu, pol->cpus) | ||
| 1145 | per_cpu(powernow_data, cpu) = data; | ||
| 1144 | 1146 | ||
| 1145 | return 0; | 1147 | return 0; |
| 1146 | 1148 | ||
| @@ -1155,6 +1157,7 @@ err_out: | |||
| 1155 | static int powernowk8_cpu_exit(struct cpufreq_policy *pol) | 1157 | static int powernowk8_cpu_exit(struct cpufreq_policy *pol) |
| 1156 | { | 1158 | { |
| 1157 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); | 1159 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); |
| 1160 | int cpu; | ||
| 1158 | 1161 | ||
| 1159 | if (!data) | 1162 | if (!data) |
| 1160 | return -EINVAL; | 1163 | return -EINVAL; |
| @@ -1165,7 +1168,8 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol) | |||
| 1165 | 1168 | ||
| 1166 | kfree(data->powernow_table); | 1169 | kfree(data->powernow_table); |
| 1167 | kfree(data); | 1170 | kfree(data); |
| 1168 | per_cpu(powernow_data, pol->cpu) = NULL; | 1171 | for_each_cpu(cpu, pol->cpus) |
| 1172 | per_cpu(powernow_data, cpu) = NULL; | ||
| 1169 | 1173 | ||
| 1170 | return 0; | 1174 | return 0; |
| 1171 | } | 1175 | } |
