提交 e9af797d 编写于 作者: L Linus Torvalds

Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] Fix on resume, now preserves user policy min/max.
  [CPUFREQ] Add Celeron Core support to p4-clockmod.
  [CPUFREQ] add to speedstep-lib additional fsb values for core processors
  [CPUFREQ] Disable sysfs ui for p4-clockmod.
  [CPUFREQ] p4-clockmod: reduce noise
  [CPUFREQ] clean up speedstep-centrino and reduce cpumask_t usage
...@@ -160,6 +160,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) ...@@ -160,6 +160,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
switch (c->x86_model) { switch (c->x86_model) {
case 0x0E: /* Core */ case 0x0E: /* Core */
case 0x0F: /* Core Duo */ case 0x0F: /* Core Duo */
case 0x16: /* Celeron Core */
p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE); return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE);
case 0x0D: /* Pentium M (Dothan) */ case 0x0D: /* Pentium M (Dothan) */
...@@ -171,7 +172,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) ...@@ -171,7 +172,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
} }
if (c->x86 != 0xF) { if (c->x86 != 0xF) {
printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@vger.kernel.org>\n"); if (!cpu_has(c, X86_FEATURE_EST))
printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. "
"Please send an e-mail to <cpufreq@vger.kernel.org>\n");
return 0; return 0;
} }
...@@ -274,6 +277,7 @@ static struct cpufreq_driver p4clockmod_driver = { ...@@ -274,6 +277,7 @@ static struct cpufreq_driver p4clockmod_driver = {
.name = "p4-clockmod", .name = "p4-clockmod",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.attr = p4clockmod_attr, .attr = p4clockmod_attr,
.hide_interface = 1,
}; };
......
...@@ -459,9 +459,7 @@ static int centrino_verify (struct cpufreq_policy *policy) ...@@ -459,9 +459,7 @@ static int centrino_verify (struct cpufreq_policy *policy)
* Sets a new CPUFreq policy. * Sets a new CPUFreq policy.
*/ */
struct allmasks { struct allmasks {
cpumask_t online_policy_cpus;
cpumask_t saved_mask; cpumask_t saved_mask;
cpumask_t set_mask;
cpumask_t covered_cpus; cpumask_t covered_cpus;
}; };
...@@ -475,9 +473,7 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -475,9 +473,7 @@ static int centrino_target (struct cpufreq_policy *policy,
int retval = 0; int retval = 0;
unsigned int j, k, first_cpu, tmp; unsigned int j, k, first_cpu, tmp;
CPUMASK_ALLOC(allmasks); CPUMASK_ALLOC(allmasks);
CPUMASK_PTR(online_policy_cpus, allmasks);
CPUMASK_PTR(saved_mask, allmasks); CPUMASK_PTR(saved_mask, allmasks);
CPUMASK_PTR(set_mask, allmasks);
CPUMASK_PTR(covered_cpus, allmasks); CPUMASK_PTR(covered_cpus, allmasks);
if (unlikely(allmasks == NULL)) if (unlikely(allmasks == NULL))
...@@ -497,30 +493,28 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -497,30 +493,28 @@ static int centrino_target (struct cpufreq_policy *policy,
goto out; goto out;
} }
#ifdef CONFIG_HOTPLUG_CPU
/* cpufreq holds the hotplug lock, so we are safe from here on */
cpus_and(*online_policy_cpus, cpu_online_map, policy->cpus);
#else
*online_policy_cpus = policy->cpus;
#endif
*saved_mask = current->cpus_allowed; *saved_mask = current->cpus_allowed;
first_cpu = 1; first_cpu = 1;
cpus_clear(*covered_cpus); cpus_clear(*covered_cpus);
for_each_cpu_mask_nr(j, *online_policy_cpus) { for_each_cpu_mask_nr(j, policy->cpus) {
const cpumask_t *mask;
/* cpufreq holds the hotplug lock, so we are safe here */
if (!cpu_online(j))
continue;
/* /*
* Support for SMP systems. * Support for SMP systems.
* Make sure we are running on CPU that wants to change freq * Make sure we are running on CPU that wants to change freq
*/ */
cpus_clear(*set_mask);
if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
cpus_or(*set_mask, *set_mask, *online_policy_cpus); mask = &policy->cpus;
else else
cpu_set(j, *set_mask); mask = &cpumask_of_cpu(j);
set_cpus_allowed_ptr(current, set_mask); set_cpus_allowed_ptr(current, mask);
preempt_disable(); preempt_disable();
if (unlikely(!cpu_isset(smp_processor_id(), *set_mask))) { if (unlikely(!cpu_isset(smp_processor_id(), *mask))) {
dprintk("couldn't limit to CPUs in this domain\n"); dprintk("couldn't limit to CPUs in this domain\n");
retval = -EAGAIN; retval = -EAGAIN;
if (first_cpu) { if (first_cpu) {
...@@ -548,7 +542,9 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -548,7 +542,9 @@ static int centrino_target (struct cpufreq_policy *policy,
dprintk("target=%dkHz old=%d new=%d msr=%04x\n", dprintk("target=%dkHz old=%d new=%d msr=%04x\n",
target_freq, freqs.old, freqs.new, msr); target_freq, freqs.old, freqs.new, msr);
for_each_cpu_mask_nr(k, *online_policy_cpus) { for_each_cpu_mask_nr(k, policy->cpus) {
if (!cpu_online(k))
continue;
freqs.cpu = k; freqs.cpu = k;
cpufreq_notify_transition(&freqs, cpufreq_notify_transition(&freqs,
CPUFREQ_PRECHANGE); CPUFREQ_PRECHANGE);
...@@ -571,7 +567,9 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -571,7 +567,9 @@ static int centrino_target (struct cpufreq_policy *policy,
preempt_enable(); preempt_enable();
} }
for_each_cpu_mask_nr(k, *online_policy_cpus) { for_each_cpu_mask_nr(k, policy->cpus) {
if (!cpu_online(k))
continue;
freqs.cpu = k; freqs.cpu = k;
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
} }
...@@ -584,18 +582,17 @@ static int centrino_target (struct cpufreq_policy *policy, ...@@ -584,18 +582,17 @@ static int centrino_target (struct cpufreq_policy *policy,
* Best effort undo.. * Best effort undo..
*/ */
if (!cpus_empty(*covered_cpus))
for_each_cpu_mask_nr(j, *covered_cpus) { for_each_cpu_mask_nr(j, *covered_cpus) {
set_cpus_allowed_ptr(current, set_cpus_allowed_ptr(current, &cpumask_of_cpu(j));
&cpumask_of_cpu(j));
wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
} }
tmp = freqs.new; tmp = freqs.new;
freqs.new = freqs.old; freqs.new = freqs.old;
freqs.old = tmp; freqs.old = tmp;
for_each_cpu_mask_nr(j, *online_policy_cpus) { for_each_cpu_mask_nr(j, policy->cpus) {
freqs.cpu = j; if (!cpu_online(j))
continue;
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
} }
......
...@@ -139,6 +139,15 @@ static unsigned int pentium_core_get_frequency(void) ...@@ -139,6 +139,15 @@ static unsigned int pentium_core_get_frequency(void)
case 3: case 3:
fsb = 166667; fsb = 166667;
break; break;
case 2:
fsb = 200000;
break;
case 0:
fsb = 266667;
break;
case 4:
fsb = 333333;
break;
default: default:
printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value"); printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value");
} }
......
...@@ -754,6 +754,11 @@ static struct kobj_type ktype_cpufreq = { ...@@ -754,6 +754,11 @@ static struct kobj_type ktype_cpufreq = {
.release = cpufreq_sysfs_release, .release = cpufreq_sysfs_release,
}; };
static struct kobj_type ktype_empty_cpufreq = {
.sysfs_ops = &sysfs_ops,
.release = cpufreq_sysfs_release,
};
/** /**
* cpufreq_add_dev - add a CPU device * cpufreq_add_dev - add a CPU device
...@@ -822,8 +827,8 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -822,8 +827,8 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
dprintk("initialization failed\n"); dprintk("initialization failed\n");
goto err_out; goto err_out;
} }
policy->user_policy.min = policy->cpuinfo.min_freq; policy->user_policy.min = policy->min;
policy->user_policy.max = policy->cpuinfo.max_freq; policy->user_policy.max = policy->max;
blocking_notifier_call_chain(&cpufreq_policy_notifier_list, blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_START, policy); CPUFREQ_START, policy);
...@@ -876,26 +881,36 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) ...@@ -876,26 +881,36 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
/* prepare interface data */ /* prepare interface data */
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, if (!cpufreq_driver->hide_interface) {
"cpufreq"); ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
&sys_dev->kobj, "cpufreq");
if (ret) if (ret)
goto err_out_driver_exit; goto err_out_driver_exit;
/* set up files for this cpu device */ /* set up files for this cpu device */
drv_attr = cpufreq_driver->attr; drv_attr = cpufreq_driver->attr;
while ((drv_attr) && (*drv_attr)) { while ((drv_attr) && (*drv_attr)) {
ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); ret = sysfs_create_file(&policy->kobj,
&((*drv_attr)->attr));
if (ret) if (ret)
goto err_out_driver_exit; goto err_out_driver_exit;
drv_attr++; drv_attr++;
} }
if (cpufreq_driver->get) { if (cpufreq_driver->get) {
ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); ret = sysfs_create_file(&policy->kobj,
&cpuinfo_cur_freq.attr);
if (ret) if (ret)
goto err_out_driver_exit; goto err_out_driver_exit;
} }
if (cpufreq_driver->target) { if (cpufreq_driver->target) {
ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); ret = sysfs_create_file(&policy->kobj,
&scaling_cur_freq.attr);
if (ret)
goto err_out_driver_exit;
}
} else {
ret = kobject_init_and_add(&policy->kobj, &ktype_empty_cpufreq,
&sys_dev->kobj, "cpufreq");
if (ret) if (ret)
goto err_out_driver_exit; goto err_out_driver_exit;
} }
......
...@@ -234,6 +234,7 @@ struct cpufreq_driver { ...@@ -234,6 +234,7 @@ struct cpufreq_driver {
int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
int (*resume) (struct cpufreq_policy *policy); int (*resume) (struct cpufreq_policy *policy);
struct freq_attr **attr; struct freq_attr **attr;
bool hide_interface;
}; };
/* flags */ /* flags */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册