Commit fee5ae96 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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
parents d8ad344c 61d8d2ab
...@@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, ...@@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
up_read(&policy->rwsem); up_read(&policy->rwsem);
if (cpu != policy->cpu) { if (cpu != policy->cpu) {
if (!frozen) sysfs_remove_link(&dev->kobj, "cpufreq");
sysfs_remove_link(&dev->kobj, "cpufreq");
} else if (cpus > 1) { } else if (cpus > 1) {
new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
if (new_cpu >= 0) { if (new_cpu >= 0) {
......
...@@ -34,8 +34,10 @@ ...@@ -34,8 +34,10 @@
#define SAMPLE_COUNT 3 #define SAMPLE_COUNT 3
#define BYT_RATIOS 0x66a #define BYT_RATIOS 0x66a
#define BYT_VIDS 0x66b #define BYT_VIDS 0x66b
#define BYT_TURBO_RATIOS 0x66c
#define FRAC_BITS 8 #define FRAC_BITS 8
#define int_tofp(X) ((int64_t)(X) << FRAC_BITS) #define int_tofp(X) ((int64_t)(X) << FRAC_BITS)
...@@ -357,7 +359,7 @@ static int byt_get_min_pstate(void) ...@@ -357,7 +359,7 @@ static int byt_get_min_pstate(void)
{ {
u64 value; u64 value;
rdmsrl(BYT_RATIOS, value); rdmsrl(BYT_RATIOS, value);
return value & 0xFF; return (value >> 8) & 0xFF;
} }
static int byt_get_max_pstate(void) static int byt_get_max_pstate(void)
...@@ -367,6 +369,13 @@ static int byt_get_max_pstate(void) ...@@ -367,6 +369,13 @@ static int byt_get_max_pstate(void)
return (value >> 16) & 0xFF; return (value >> 16) & 0xFF;
} }
static int byt_get_turbo_pstate(void)
{
u64 value;
rdmsrl(BYT_TURBO_RATIOS, value);
return value & 0x3F;
}
static void byt_set_pstate(struct cpudata *cpudata, int pstate) static void byt_set_pstate(struct cpudata *cpudata, int pstate)
{ {
u64 val; u64 val;
...@@ -469,7 +478,7 @@ static struct cpu_defaults byt_params = { ...@@ -469,7 +478,7 @@ static struct cpu_defaults byt_params = {
.funcs = { .funcs = {
.get_max = byt_get_max_pstate, .get_max = byt_get_max_pstate,
.get_min = byt_get_min_pstate, .get_min = byt_get_min_pstate,
.get_turbo = byt_get_max_pstate, .get_turbo = byt_get_turbo_pstate,
.set = byt_set_pstate, .set = byt_set_pstate,
.get_vid = byt_get_vid, .get_vid = byt_get_vid,
}, },
......
...@@ -1076,7 +1076,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1076,7 +1076,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
{ {
struct powernow_k8_data *data; struct powernow_k8_data *data;
struct init_on_cpu init_on_cpu; struct init_on_cpu init_on_cpu;
int rc; int rc, cpu;
smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1); smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1);
if (rc) if (rc)
...@@ -1140,7 +1140,9 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1140,7 +1140,9 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n",
data->currfid, data->currvid); data->currfid, data->currvid);
per_cpu(powernow_data, pol->cpu) = data; /* Point all the CPUs in this policy to the same data */
for_each_cpu(cpu, pol->cpus)
per_cpu(powernow_data, cpu) = data;
return 0; return 0;
...@@ -1155,6 +1157,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) ...@@ -1155,6 +1157,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
static int powernowk8_cpu_exit(struct cpufreq_policy *pol) static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
{ {
struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
int cpu;
if (!data) if (!data)
return -EINVAL; return -EINVAL;
...@@ -1165,7 +1168,8 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol) ...@@ -1165,7 +1168,8 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol)
kfree(data->powernow_table); kfree(data->powernow_table);
kfree(data); kfree(data);
per_cpu(powernow_data, pol->cpu) = NULL; for_each_cpu(cpu, pol->cpus)
per_cpu(powernow_data, cpu) = NULL;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment