aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:38:48 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:38:48 -0400
commitded1504dfa0083661fdd1a0a5f021cb7313ffe04 (patch)
tree5af71c440627225138518669653c427e901d8e33 /arch
parent98b96173c777c67daaa7d163a35e591e1928a164 (diff)
parent2e4976206396274cf66590328c6913811c271495 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq: [CPUFREQ] Report the number of processors in PowerNow-k8 correctly [CPUFREQ] do not declare undefined functions [CPUFREQ] cleanup kconfig options [CPUFREQ] Longhaul - Revert Longhaul ver. 2 [CPUFREQ] Remove deprecated /proc/acpi/processor/performance write support [CPUFREQ] Fix limited cpufreq when booted on battery Fix preemption warnings in speedstep-centrino.c [CPUFREQ] Longhaul - Correct PCI code [CPUFREQ] p4-clockmod: switch to rdmsr_on_cpu/wrmsr_on_cpu
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c21
-rw-r--r--arch/i386/kernel/cpu/cpufreq/p4-clockmod.c31
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c6
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c10
-rw-r--r--arch/x86_64/kernel/cpufreq/Kconfig19
6 files changed, 49 insertions, 40 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 2b030d6ccbf7..a3df9c039bd4 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -590,20 +590,23 @@ static acpi_status longhaul_walk_callback(acpi_handle obj_handle,
590static int enable_arbiter_disable(void) 590static int enable_arbiter_disable(void)
591{ 591{
592 struct pci_dev *dev; 592 struct pci_dev *dev;
593 int status;
593 int reg; 594 int reg;
594 u8 pci_cmd; 595 u8 pci_cmd;
595 596
597 status = 1;
596 /* Find PLE133 host bridge */ 598 /* Find PLE133 host bridge */
597 reg = 0x78; 599 reg = 0x78;
598 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, NULL); 600 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0,
601 NULL);
599 /* Find CLE266 host bridge */ 602 /* Find CLE266 host bridge */
600 if (dev == NULL) { 603 if (dev == NULL) {
601 reg = 0x76; 604 reg = 0x76;
602 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL); 605 dev = pci_get_device(PCI_VENDOR_ID_VIA,
606 PCI_DEVICE_ID_VIA_862X_0, NULL);
603 /* Find CN400 V-Link host bridge */ 607 /* Find CN400 V-Link host bridge */
604 if (dev == NULL) 608 if (dev == NULL)
605 dev = pci_find_device(PCI_VENDOR_ID_VIA, 0x7259, NULL); 609 dev = pci_get_device(PCI_VENDOR_ID_VIA, 0x7259, NULL);
606
607 } 610 }
608 if (dev != NULL) { 611 if (dev != NULL) {
609 /* Enable access to port 0x22 */ 612 /* Enable access to port 0x22 */
@@ -615,10 +618,11 @@ static int enable_arbiter_disable(void)
615 if (!(pci_cmd & 1<<7)) { 618 if (!(pci_cmd & 1<<7)) {
616 printk(KERN_ERR PFX 619 printk(KERN_ERR PFX
617 "Can't enable access to port 0x22.\n"); 620 "Can't enable access to port 0x22.\n");
618 return 0; 621 status = 0;
619 } 622 }
620 } 623 }
621 return 1; 624 pci_dev_put(dev);
625 return status;
622 } 626 }
623 return 0; 627 return 0;
624} 628}
@@ -629,7 +633,7 @@ static int longhaul_setup_vt8235(void)
629 u8 pci_cmd; 633 u8 pci_cmd;
630 634
631 /* Find VT8235 southbridge */ 635 /* Find VT8235 southbridge */
632 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL); 636 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL);
633 if (dev != NULL) { 637 if (dev != NULL) {
634 /* Set transition time to max */ 638 /* Set transition time to max */
635 pci_read_config_byte(dev, 0xec, &pci_cmd); 639 pci_read_config_byte(dev, 0xec, &pci_cmd);
@@ -641,6 +645,7 @@ static int longhaul_setup_vt8235(void)
641 pci_read_config_byte(dev, 0xe5, &pci_cmd); 645 pci_read_config_byte(dev, 0xe5, &pci_cmd);
642 pci_cmd |= 1 << 7; 646 pci_cmd |= 1 << 7;
643 pci_write_config_byte(dev, 0xe5, pci_cmd); 647 pci_write_config_byte(dev, 0xe5, pci_cmd);
648 pci_dev_put(dev);
644 return 1; 649 return 1;
645 } 650 }
646 return 0; 651 return 0;
@@ -678,7 +683,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
678 sizeof(samuel2_eblcr)); 683 sizeof(samuel2_eblcr));
679 break; 684 break;
680 case 1 ... 15: 685 case 1 ... 15:
681 longhaul_version = TYPE_LONGHAUL_V2; 686 longhaul_version = TYPE_LONGHAUL_V1;
682 if (c->x86_mask < 8) { 687 if (c->x86_mask < 8) {
683 cpu_model = CPU_SAMUEL2; 688 cpu_model = CPU_SAMUEL2;
684 cpuname = "C3 'Samuel 2' [C5B]"; 689 cpuname = "C3 'Samuel 2' [C5B]";
diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
index 4786fedca6eb..4c76b511e194 100644
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -27,7 +27,6 @@
27#include <linux/cpufreq.h> 27#include <linux/cpufreq.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/cpumask.h> 29#include <linux/cpumask.h>
30#include <linux/sched.h> /* current / set_cpus_allowed() */
31 30
32#include <asm/processor.h> 31#include <asm/processor.h>
33#include <asm/msr.h> 32#include <asm/msr.h>
@@ -62,7 +61,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
62 if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV)) 61 if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV))
63 return -EINVAL; 62 return -EINVAL;
64 63
65 rdmsr(MSR_IA32_THERM_STATUS, l, h); 64 rdmsr_on_cpu(cpu, MSR_IA32_THERM_STATUS, &l, &h);
66 65
67 if (l & 0x01) 66 if (l & 0x01)
68 dprintk("CPU#%d currently thermal throttled\n", cpu); 67 dprintk("CPU#%d currently thermal throttled\n", cpu);
@@ -70,10 +69,10 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
70 if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT)) 69 if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT))
71 newstate = DC_38PT; 70 newstate = DC_38PT;
72 71
73 rdmsr(MSR_IA32_THERM_CONTROL, l, h); 72 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h);
74 if (newstate == DC_DISABLE) { 73 if (newstate == DC_DISABLE) {
75 dprintk("CPU#%d disabling modulation\n", cpu); 74 dprintk("CPU#%d disabling modulation\n", cpu);
76 wrmsr(MSR_IA32_THERM_CONTROL, l & ~(1<<4), h); 75 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l & ~(1<<4), h);
77 } else { 76 } else {
78 dprintk("CPU#%d setting duty cycle to %d%%\n", 77 dprintk("CPU#%d setting duty cycle to %d%%\n",
79 cpu, ((125 * newstate) / 10)); 78 cpu, ((125 * newstate) / 10));
@@ -84,7 +83,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
84 */ 83 */
85 l = (l & ~14); 84 l = (l & ~14);
86 l = l | (1<<4) | ((newstate & 0x7)<<1); 85 l = l | (1<<4) | ((newstate & 0x7)<<1);
87 wrmsr(MSR_IA32_THERM_CONTROL, l, h); 86 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l, h);
88 } 87 }
89 88
90 return 0; 89 return 0;
@@ -111,7 +110,6 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
111{ 110{
112 unsigned int newstate = DC_RESV; 111 unsigned int newstate = DC_RESV;
113 struct cpufreq_freqs freqs; 112 struct cpufreq_freqs freqs;
114 cpumask_t cpus_allowed;
115 int i; 113 int i;
116 114
117 if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate)) 115 if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate))
@@ -132,17 +130,8 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
132 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software 130 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
133 * Developer's Manual, Volume 3 131 * Developer's Manual, Volume 3
134 */ 132 */
135 cpus_allowed = current->cpus_allowed; 133 for_each_cpu_mask(i, policy->cpus)
136
137 for_each_cpu_mask(i, policy->cpus) {
138 cpumask_t this_cpu = cpumask_of_cpu(i);
139
140 set_cpus_allowed(current, this_cpu);
141 BUG_ON(smp_processor_id() != i);
142
143 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); 134 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
144 }
145 set_cpus_allowed(current, cpus_allowed);
146 135
147 /* notifiers */ 136 /* notifiers */
148 for_each_cpu_mask(i, policy->cpus) { 137 for_each_cpu_mask(i, policy->cpus) {
@@ -256,17 +245,9 @@ static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
256 245
257static unsigned int cpufreq_p4_get(unsigned int cpu) 246static unsigned int cpufreq_p4_get(unsigned int cpu)
258{ 247{
259 cpumask_t cpus_allowed;
260 u32 l, h; 248 u32 l, h;
261 249
262 cpus_allowed = current->cpus_allowed; 250 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h);
263
264 set_cpus_allowed(current, cpumask_of_cpu(cpu));
265 BUG_ON(smp_processor_id() != cpu);
266
267 rdmsr(MSR_IA32_THERM_CONTROL, l, h);
268
269 set_cpus_allowed(current, cpus_allowed);
270 251
271 if (l & 0x10) { 252 if (l & 0x10) {
272 l = l >> 1; 253 l = l >> 1;
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index fe3b67005ebb..7cf3d207b6b3 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -661,7 +661,8 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,
661 661
662 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid); 662 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
663 data->powernow_table = powernow_table; 663 data->powernow_table = powernow_table;
664 print_basics(data); 664 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu)
665 print_basics(data);
665 666
666 for (j = 0; j < data->numps; j++) 667 for (j = 0; j < data->numps; j++)
667 if ((pst[j].fid==data->currfid) && (pst[j].vid==data->currvid)) 668 if ((pst[j].fid==data->currfid) && (pst[j].vid==data->currvid))
@@ -814,7 +815,8 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
814 815
815 /* fill in data */ 816 /* fill in data */
816 data->numps = data->acpi_data.state_count; 817 data->numps = data->acpi_data.state_count;
817 print_basics(data); 818 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu)
819 print_basics(data);
818 powernow_k8_acpi_pst_values(data, 0); 820 powernow_k8_acpi_pst_values(data, 0);
819 821
820 /* notify BIOS that we exist */ 822 /* notify BIOS that we exist */
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index 0fb2a3001ba5..95be5013c984 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -215,8 +215,10 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
215 215
216static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); 216static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
217 217
218#ifdef CONFIG_X86_POWERNOW_K8_ACPI
218static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); 219static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
219static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); 220static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
221#endif
220 222
221#ifdef CONFIG_SMP 223#ifdef CONFIG_SMP
222static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) 224static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index f43b987f952b..35489fd68852 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -720,6 +720,7 @@ static int centrino_target (struct cpufreq_policy *policy,
720 cpu_set(j, set_mask); 720 cpu_set(j, set_mask);
721 721
722 set_cpus_allowed(current, set_mask); 722 set_cpus_allowed(current, set_mask);
723 preempt_disable();
723 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { 724 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
724 dprintk("couldn't limit to CPUs in this domain\n"); 725 dprintk("couldn't limit to CPUs in this domain\n");
725 retval = -EAGAIN; 726 retval = -EAGAIN;
@@ -727,6 +728,7 @@ static int centrino_target (struct cpufreq_policy *policy,
727 /* We haven't started the transition yet. */ 728 /* We haven't started the transition yet. */
728 goto migrate_end; 729 goto migrate_end;
729 } 730 }
731 preempt_enable();
730 break; 732 break;
731 } 733 }
732 734
@@ -761,10 +763,13 @@ static int centrino_target (struct cpufreq_policy *policy,
761 } 763 }
762 764
763 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); 765 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
764 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 766 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
767 preempt_enable();
765 break; 768 break;
769 }
766 770
767 cpu_set(j, covered_cpus); 771 cpu_set(j, covered_cpus);
772 preempt_enable();
768 } 773 }
769 774
770 for_each_cpu_mask(k, online_policy_cpus) { 775 for_each_cpu_mask(k, online_policy_cpus) {
@@ -796,8 +801,11 @@ static int centrino_target (struct cpufreq_policy *policy,
796 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 801 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
797 } 802 }
798 } 803 }
804 set_cpus_allowed(current, saved_mask);
805 return 0;
799 806
800migrate_end: 807migrate_end:
808 preempt_enable();
801 set_cpus_allowed(current, saved_mask); 809 set_cpus_allowed(current, saved_mask);
802 return 0; 810 return 0;
803} 811}
diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig
index 40acb67fb882..c0749d2479f5 100644
--- a/arch/x86_64/kernel/cpufreq/Kconfig
+++ b/arch/x86_64/kernel/cpufreq/Kconfig
@@ -16,6 +16,9 @@ config X86_POWERNOW_K8
16 help 16 help
17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. 17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
18 18
19 To compile this driver as a module, choose M here: the
20 module will be called powernow-k8.
21
19 For details, take a look at <file:Documentation/cpu-freq/>. 22 For details, take a look at <file:Documentation/cpu-freq/>.
20 23
21 If in doubt, say N. 24 If in doubt, say N.
@@ -38,6 +41,9 @@ config X86_SPEEDSTEP_CENTRINO
38 mobile CPUs. This means Intel Pentium M (Centrino) CPUs 41 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
39 or 64bit enabled Intel Xeons. 42 or 64bit enabled Intel Xeons.
40 43
44 To compile this driver as a module, choose M here: the
45 module will be called speedstep-centrino.
46
41 For details, take a look at <file:Documentation/cpu-freq/>. 47 For details, take a look at <file:Documentation/cpu-freq/>.
42 48
43 If in doubt, say N. 49 If in doubt, say N.
@@ -55,6 +61,9 @@ config X86_ACPI_CPUFREQ
55 Processor Performance States. 61 Processor Performance States.
56 This driver also supports Intel Enhanced Speedstep. 62 This driver also supports Intel Enhanced Speedstep.
57 63
64 To compile this driver as a module, choose M here: the
65 module will be called acpi-cpufreq.
66
58 For details, take a look at <file:Documentation/cpu-freq/>. 67 For details, take a look at <file:Documentation/cpu-freq/>.
59 68
60 If in doubt, say N. 69 If in doubt, say N.
@@ -62,7 +71,7 @@ config X86_ACPI_CPUFREQ
62comment "shared options" 71comment "shared options"
63 72
64config X86_ACPI_CPUFREQ_PROC_INTF 73config X86_ACPI_CPUFREQ_PROC_INTF
65 bool "/proc/acpi/processor/../performance interface (deprecated)" 74 bool "/proc/acpi/processor/../performance interface (deprecated)"
66 depends on PROC_FS 75 depends on PROC_FS
67 depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K8_ACPI 76 depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K8_ACPI
68 help 77 help
@@ -86,16 +95,18 @@ config X86_P4_CLOCKMOD
86 slowdowns and noticeable latencies. Normally Speedstep should be used 95 slowdowns and noticeable latencies. Normally Speedstep should be used
87 instead. 96 instead.
88 97
98 To compile this driver as a module, choose M here: the
99 module will be called p4-clockmod.
100
89 For details, take a look at <file:Documentation/cpu-freq/>. 101 For details, take a look at <file:Documentation/cpu-freq/>.
90 102
91 Unless you are absolutely sure say N. 103 Unless you are absolutely sure say N.
92 104
93 105
94config X86_SPEEDSTEP_LIB 106config X86_SPEEDSTEP_LIB
95 tristate 107 tristate
96 default X86_P4_CLOCKMOD 108 default X86_P4_CLOCKMOD
97 109
98endif 110endif
99 111
100endmenu 112endmenu
101