Commit e9af797d757d358f60130de6ca59ee658d666561
Exists in
master
and in
4 other branches
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
Showing 5 changed files Side-by-side Diff
arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
... | ... | @@ -160,6 +160,7 @@ |
160 | 160 | switch (c->x86_model) { |
161 | 161 | case 0x0E: /* Core */ |
162 | 162 | case 0x0F: /* Core Duo */ |
163 | + case 0x16: /* Celeron Core */ | |
163 | 164 | p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; |
164 | 165 | return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE); |
165 | 166 | case 0x0D: /* Pentium M (Dothan) */ |
... | ... | @@ -171,7 +172,9 @@ |
171 | 172 | } |
172 | 173 | |
173 | 174 | if (c->x86 != 0xF) { |
174 | - printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@vger.kernel.org>\n"); | |
175 | + if (!cpu_has(c, X86_FEATURE_EST)) | |
176 | + printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. " | |
177 | + "Please send an e-mail to <cpufreq@vger.kernel.org>\n"); | |
175 | 178 | return 0; |
176 | 179 | } |
177 | 180 | |
... | ... | @@ -274,6 +277,7 @@ |
274 | 277 | .name = "p4-clockmod", |
275 | 278 | .owner = THIS_MODULE, |
276 | 279 | .attr = p4clockmod_attr, |
280 | + .hide_interface = 1, | |
277 | 281 | }; |
278 | 282 | |
279 | 283 |
arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
... | ... | @@ -459,9 +459,7 @@ |
459 | 459 | * Sets a new CPUFreq policy. |
460 | 460 | */ |
461 | 461 | struct allmasks { |
462 | - cpumask_t online_policy_cpus; | |
463 | 462 | cpumask_t saved_mask; |
464 | - cpumask_t set_mask; | |
465 | 463 | cpumask_t covered_cpus; |
466 | 464 | }; |
467 | 465 | |
468 | 466 | |
... | ... | @@ -475,9 +473,7 @@ |
475 | 473 | int retval = 0; |
476 | 474 | unsigned int j, k, first_cpu, tmp; |
477 | 475 | CPUMASK_ALLOC(allmasks); |
478 | - CPUMASK_PTR(online_policy_cpus, allmasks); | |
479 | 476 | CPUMASK_PTR(saved_mask, allmasks); |
480 | - CPUMASK_PTR(set_mask, allmasks); | |
481 | 477 | CPUMASK_PTR(covered_cpus, allmasks); |
482 | 478 | |
483 | 479 | if (unlikely(allmasks == NULL)) |
484 | 480 | |
485 | 481 | |
486 | 482 | |
487 | 483 | |
488 | 484 | |
489 | 485 | |
... | ... | @@ -497,30 +493,28 @@ |
497 | 493 | goto out; |
498 | 494 | } |
499 | 495 | |
500 | -#ifdef CONFIG_HOTPLUG_CPU | |
501 | - /* cpufreq holds the hotplug lock, so we are safe from here on */ | |
502 | - cpus_and(*online_policy_cpus, cpu_online_map, policy->cpus); | |
503 | -#else | |
504 | - *online_policy_cpus = policy->cpus; | |
505 | -#endif | |
506 | - | |
507 | 496 | *saved_mask = current->cpus_allowed; |
508 | 497 | first_cpu = 1; |
509 | 498 | cpus_clear(*covered_cpus); |
510 | - for_each_cpu_mask_nr(j, *online_policy_cpus) { | |
499 | + for_each_cpu_mask_nr(j, policy->cpus) { | |
500 | + const cpumask_t *mask; | |
501 | + | |
502 | + /* cpufreq holds the hotplug lock, so we are safe here */ | |
503 | + if (!cpu_online(j)) | |
504 | + continue; | |
505 | + | |
511 | 506 | /* |
512 | 507 | * Support for SMP systems. |
513 | 508 | * Make sure we are running on CPU that wants to change freq |
514 | 509 | */ |
515 | - cpus_clear(*set_mask); | |
516 | 510 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) |
517 | - cpus_or(*set_mask, *set_mask, *online_policy_cpus); | |
511 | + mask = &policy->cpus; | |
518 | 512 | else |
519 | - cpu_set(j, *set_mask); | |
513 | + mask = &cpumask_of_cpu(j); | |
520 | 514 | |
521 | - set_cpus_allowed_ptr(current, set_mask); | |
515 | + set_cpus_allowed_ptr(current, mask); | |
522 | 516 | preempt_disable(); |
523 | - if (unlikely(!cpu_isset(smp_processor_id(), *set_mask))) { | |
517 | + if (unlikely(!cpu_isset(smp_processor_id(), *mask))) { | |
524 | 518 | dprintk("couldn't limit to CPUs in this domain\n"); |
525 | 519 | retval = -EAGAIN; |
526 | 520 | if (first_cpu) { |
... | ... | @@ -548,7 +542,9 @@ |
548 | 542 | dprintk("target=%dkHz old=%d new=%d msr=%04x\n", |
549 | 543 | target_freq, freqs.old, freqs.new, msr); |
550 | 544 | |
551 | - for_each_cpu_mask_nr(k, *online_policy_cpus) { | |
545 | + for_each_cpu_mask_nr(k, policy->cpus) { | |
546 | + if (!cpu_online(k)) | |
547 | + continue; | |
552 | 548 | freqs.cpu = k; |
553 | 549 | cpufreq_notify_transition(&freqs, |
554 | 550 | CPUFREQ_PRECHANGE); |
... | ... | @@ -571,7 +567,9 @@ |
571 | 567 | preempt_enable(); |
572 | 568 | } |
573 | 569 | |
574 | - for_each_cpu_mask_nr(k, *online_policy_cpus) { | |
570 | + for_each_cpu_mask_nr(k, policy->cpus) { | |
571 | + if (!cpu_online(k)) | |
572 | + continue; | |
575 | 573 | freqs.cpu = k; |
576 | 574 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
577 | 575 | } |
578 | 576 | |
... | ... | @@ -584,18 +582,17 @@ |
584 | 582 | * Best effort undo.. |
585 | 583 | */ |
586 | 584 | |
587 | - if (!cpus_empty(*covered_cpus)) | |
588 | - for_each_cpu_mask_nr(j, *covered_cpus) { | |
589 | - set_cpus_allowed_ptr(current, | |
590 | - &cpumask_of_cpu(j)); | |
591 | - wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); | |
592 | - } | |
585 | + for_each_cpu_mask_nr(j, *covered_cpus) { | |
586 | + set_cpus_allowed_ptr(current, &cpumask_of_cpu(j)); | |
587 | + wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); | |
588 | + } | |
593 | 589 | |
594 | 590 | tmp = freqs.new; |
595 | 591 | freqs.new = freqs.old; |
596 | 592 | freqs.old = tmp; |
597 | - for_each_cpu_mask_nr(j, *online_policy_cpus) { | |
598 | - freqs.cpu = j; | |
593 | + for_each_cpu_mask_nr(j, policy->cpus) { | |
594 | + if (!cpu_online(j)) | |
595 | + continue; | |
599 | 596 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
600 | 597 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
601 | 598 | } |
arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
... | ... | @@ -139,6 +139,15 @@ |
139 | 139 | case 3: |
140 | 140 | fsb = 166667; |
141 | 141 | break; |
142 | + case 2: | |
143 | + fsb = 200000; | |
144 | + break; | |
145 | + case 0: | |
146 | + fsb = 266667; | |
147 | + break; | |
148 | + case 4: | |
149 | + fsb = 333333; | |
150 | + break; | |
142 | 151 | default: |
143 | 152 | printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value"); |
144 | 153 | } |
drivers/cpufreq/cpufreq.c
... | ... | @@ -754,7 +754,12 @@ |
754 | 754 | .release = cpufreq_sysfs_release, |
755 | 755 | }; |
756 | 756 | |
757 | +static struct kobj_type ktype_empty_cpufreq = { | |
758 | + .sysfs_ops = &sysfs_ops, | |
759 | + .release = cpufreq_sysfs_release, | |
760 | +}; | |
757 | 761 | |
762 | + | |
758 | 763 | /** |
759 | 764 | * cpufreq_add_dev - add a CPU device |
760 | 765 | * |
... | ... | @@ -822,8 +827,8 @@ |
822 | 827 | dprintk("initialization failed\n"); |
823 | 828 | goto err_out; |
824 | 829 | } |
825 | - policy->user_policy.min = policy->cpuinfo.min_freq; | |
826 | - policy->user_policy.max = policy->cpuinfo.max_freq; | |
830 | + policy->user_policy.min = policy->min; | |
831 | + policy->user_policy.max = policy->max; | |
827 | 832 | |
828 | 833 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
829 | 834 | CPUFREQ_START, policy); |
830 | 835 | |
... | ... | @@ -876,26 +881,36 @@ |
876 | 881 | memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); |
877 | 882 | |
878 | 883 | /* prepare interface data */ |
879 | - ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, | |
880 | - "cpufreq"); | |
881 | - if (ret) | |
882 | - goto err_out_driver_exit; | |
883 | - | |
884 | - /* set up files for this cpu device */ | |
885 | - drv_attr = cpufreq_driver->attr; | |
886 | - while ((drv_attr) && (*drv_attr)) { | |
887 | - ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); | |
884 | + if (!cpufreq_driver->hide_interface) { | |
885 | + ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, | |
886 | + &sys_dev->kobj, "cpufreq"); | |
888 | 887 | if (ret) |
889 | 888 | goto err_out_driver_exit; |
890 | - drv_attr++; | |
891 | - } | |
892 | - if (cpufreq_driver->get) { | |
893 | - ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); | |
894 | - if (ret) | |
895 | - goto err_out_driver_exit; | |
896 | - } | |
897 | - if (cpufreq_driver->target) { | |
898 | - ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); | |
889 | + | |
890 | + /* set up files for this cpu device */ | |
891 | + drv_attr = cpufreq_driver->attr; | |
892 | + while ((drv_attr) && (*drv_attr)) { | |
893 | + ret = sysfs_create_file(&policy->kobj, | |
894 | + &((*drv_attr)->attr)); | |
895 | + if (ret) | |
896 | + goto err_out_driver_exit; | |
897 | + drv_attr++; | |
898 | + } | |
899 | + if (cpufreq_driver->get) { | |
900 | + ret = sysfs_create_file(&policy->kobj, | |
901 | + &cpuinfo_cur_freq.attr); | |
902 | + if (ret) | |
903 | + goto err_out_driver_exit; | |
904 | + } | |
905 | + if (cpufreq_driver->target) { | |
906 | + ret = sysfs_create_file(&policy->kobj, | |
907 | + &scaling_cur_freq.attr); | |
908 | + if (ret) | |
909 | + goto err_out_driver_exit; | |
910 | + } | |
911 | + } else { | |
912 | + ret = kobject_init_and_add(&policy->kobj, &ktype_empty_cpufreq, | |
913 | + &sys_dev->kobj, "cpufreq"); | |
899 | 914 | if (ret) |
900 | 915 | goto err_out_driver_exit; |
901 | 916 | } |
include/linux/cpufreq.h