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

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
[CPUFREQ][2/2] preregister support for powernow-k8
[CPUFREQ][1/2] whitespace fix for powernow-k8
[CPUFREQ] Update MAINTAINERS to reflect new mailing list.
[CPUFREQ] Fix warning in elanfreq
[CPUFREQ] Fix -Wshadow warning in conservative governor.
[CPUFREQ] Remove EXPERIMENTAL annotation from VIA C7 powersaver kconfig.

+89 -54
+1 -1
MAINTAINERS
··· 1249 1249 CPU FREQUENCY DRIVERS 1250 1250 P: Dave Jones 1251 1251 M: davej@codemonkey.org.uk 1252 - L: cpufreq@lists.linux.org.uk 1252 + L: cpufreq@vger.kernel.org 1253 1253 W: http://www.codemonkey.org.uk/projects/cpufreq/ 1254 1254 T: git kernel.org/pub/scm/linux/kernel/git/davej/cpufreq.git 1255 1255 S: Maintained
+2 -2
arch/x86/kernel/cpu/cpufreq/Kconfig
··· 235 235 If in doubt, say N. 236 236 237 237 config X86_E_POWERSAVER 238 - tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)" 238 + tristate "VIA C7 Enhanced PowerSaver" 239 239 select CPU_FREQ_TABLE 240 - depends on X86_32 && EXPERIMENTAL 240 + depends on X86_32 241 241 help 242 242 This adds the CPUFreq driver for VIA C7 processors. 243 243
+1 -1
arch/x86/kernel/cpu/cpufreq/elanfreq.c
··· 44 44 * It is important that the frequencies 45 45 * are listed in ascending order here! 46 46 */ 47 - struct s_elan_multiplier elan_multiplier[] = { 47 + static struct s_elan_multiplier elan_multiplier[] = { 48 48 {1000, 0x02, 0x18}, 49 49 {2000, 0x02, 0x10}, 50 50 {4000, 0x02, 0x08},
+73 -39
arch/x86/kernel/cpu/cpufreq/powernow-k8.c
··· 66 66 return 800 + (fid * 100); 67 67 } 68 68 69 - 70 69 /* Return a frequency in KHz, given an input fid */ 71 70 static u32 find_khz_freq_from_fid(u32 fid) 72 71 { ··· 76 77 { 77 78 return data[pstate].frequency; 78 79 } 79 - 80 80 81 81 /* Return the vco fid for an input fid 82 82 * ··· 163 165 dprintk("cpu%d, init lo 0x%x, hi 0x%x\n", smp_processor_id(), lo, hi); 164 166 wrmsr(MSR_FIDVID_CTL, lo, hi); 165 167 } 166 - 167 168 168 169 /* write the new fid value along with the other control fields to the msr */ 169 170 static int write_new_fid(struct powernow_k8_data *data, u32 fid) ··· 737 740 #ifdef CONFIG_X86_POWERNOW_K8_ACPI 738 741 static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) 739 742 { 740 - if (!data->acpi_data.state_count || (cpu_family == CPU_HW_PSTATE)) 743 + if (!data->acpi_data->state_count || (cpu_family == CPU_HW_PSTATE)) 741 744 return; 742 745 743 - data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK; 744 - data->rvo = (data->acpi_data.states[index].control >> RVO_SHIFT) & RVO_MASK; 745 - data->exttype = (data->acpi_data.states[index].control >> EXT_TYPE_SHIFT) & EXT_TYPE_MASK; 746 - data->plllock = (data->acpi_data.states[index].control >> PLL_L_SHIFT) & PLL_L_MASK; 747 - data->vidmvs = 1 << ((data->acpi_data.states[index].control >> MVS_SHIFT) & MVS_MASK); 748 - data->vstable = (data->acpi_data.states[index].control >> VST_SHIFT) & VST_MASK; 746 + data->irt = (data->acpi_data->states[index].control >> IRT_SHIFT) & IRT_MASK; 747 + data->rvo = (data->acpi_data->states[index].control >> RVO_SHIFT) & RVO_MASK; 748 + data->exttype = (data->acpi_data->states[index].control >> EXT_TYPE_SHIFT) & EXT_TYPE_MASK; 749 + data->plllock = (data->acpi_data->states[index].control >> PLL_L_SHIFT) & PLL_L_MASK; 750 + data->vidmvs = 1 << ((data->acpi_data->states[index].control >> MVS_SHIFT) & MVS_MASK); 751 + data->vstable = (data->acpi_data->states[index].control >> VST_SHIFT) & VST_MASK; 752 + } 753 + 754 + 755 + static struct acpi_processor_performance *acpi_perf_data; 756 + static int preregister_valid; 757 + 758 + static int powernow_k8_cpu_preinit_acpi(void) 759 + { 760 + acpi_perf_data = alloc_percpu(struct acpi_processor_performance); 761 + if (!acpi_perf_data) 762 + return -ENODEV; 763 + 764 + if (acpi_processor_preregister_performance(acpi_perf_data)) 765 + return -ENODEV; 766 + else 767 + preregister_valid = 1; 768 + return 0; 749 769 } 750 770 751 771 static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) 752 772 { 753 773 struct cpufreq_frequency_table *powernow_table; 754 774 int ret_val; 775 + int cpu = 0; 755 776 756 - if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) { 777 + data->acpi_data = percpu_ptr(acpi_perf_data, cpu); 778 + if (acpi_processor_register_performance(data->acpi_data, data->cpu)) { 757 779 dprintk("register performance failed: bad ACPI data\n"); 758 780 return -EIO; 759 781 } 760 782 761 783 /* verify the data contained in the ACPI structures */ 762 - if (data->acpi_data.state_count <= 1) { 784 + if (data->acpi_data->state_count <= 1) { 763 785 dprintk("No ACPI P-States\n"); 764 786 goto err_out; 765 787 } 766 788 767 - if ((data->acpi_data.control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || 768 - (data->acpi_data.status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { 789 + if ((data->acpi_data->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || 790 + (data->acpi_data->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { 769 791 dprintk("Invalid control/status registers (%x - %x)\n", 770 - data->acpi_data.control_register.space_id, 771 - data->acpi_data.status_register.space_id); 792 + data->acpi_data->control_register.space_id, 793 + data->acpi_data->status_register.space_id); 772 794 goto err_out; 773 795 } 774 796 775 797 /* fill in data->powernow_table */ 776 798 powernow_table = kmalloc((sizeof(struct cpufreq_frequency_table) 777 - * (data->acpi_data.state_count + 1)), GFP_KERNEL); 799 + * (data->acpi_data->state_count + 1)), GFP_KERNEL); 778 800 if (!powernow_table) { 779 801 dprintk("powernow_table memory alloc failure\n"); 780 802 goto err_out; ··· 806 790 if (ret_val) 807 791 goto err_out_mem; 808 792 809 - powernow_table[data->acpi_data.state_count].frequency = CPUFREQ_TABLE_END; 810 - powernow_table[data->acpi_data.state_count].index = 0; 793 + powernow_table[data->acpi_data->state_count].frequency = CPUFREQ_TABLE_END; 794 + powernow_table[data->acpi_data->state_count].index = 0; 811 795 data->powernow_table = powernow_table; 812 796 813 797 /* fill in data */ 814 - data->numps = data->acpi_data.state_count; 798 + data->numps = data->acpi_data->state_count; 815 799 if (first_cpu(per_cpu(cpu_core_map, data->cpu)) == data->cpu) 816 800 print_basics(data); 817 801 powernow_k8_acpi_pst_values(data, 0); ··· 819 803 /* notify BIOS that we exist */ 820 804 acpi_processor_notify_smm(THIS_MODULE); 821 805 806 + /* determine affinity, from ACPI if available */ 807 + if (preregister_valid) { 808 + if ((data->acpi_data->shared_type == CPUFREQ_SHARED_TYPE_ALL) || 809 + (data->acpi_data->shared_type == CPUFREQ_SHARED_TYPE_ANY)) 810 + data->starting_core_affinity = data->acpi_data->shared_cpu_map; 811 + else 812 + data->starting_core_affinity = cpumask_of_cpu(data->cpu); 813 + } else { 814 + /* best guess from family if not */ 815 + if (cpu_family == CPU_HW_PSTATE) 816 + data->starting_core_affinity = cpumask_of_cpu(data->cpu); 817 + else 818 + data->starting_core_affinity = per_cpu(cpu_core_map, data->cpu); 819 + } 820 + 822 821 return 0; 823 822 824 823 err_out_mem: 825 824 kfree(powernow_table); 826 825 827 826 err_out: 828 - acpi_processor_unregister_performance(&data->acpi_data, data->cpu); 827 + acpi_processor_unregister_performance(data->acpi_data, data->cpu); 829 828 830 829 /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */ 831 - data->acpi_data.state_count = 0; 830 + data->acpi_data->state_count = 0; 832 831 833 832 return -ENODEV; 834 833 } ··· 855 824 rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo); 856 825 data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT; 857 826 858 - for (i = 0; i < data->acpi_data.state_count; i++) { 827 + for (i = 0; i < data->acpi_data->state_count; i++) { 859 828 u32 index; 860 829 861 - index = data->acpi_data.states[i].control & HW_PSTATE_MASK; 830 + index = data->acpi_data->states[i].control & HW_PSTATE_MASK; 862 831 if (index > data->max_hw_pstate) { 863 832 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index); 864 833 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n"); ··· 874 843 875 844 powernow_table[i].index = index; 876 845 877 - powernow_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000; 846 + powernow_table[i].frequency = data->acpi_data->states[i].core_frequency * 1000; 878 847 } 879 848 return 0; 880 849 } ··· 883 852 { 884 853 int i; 885 854 int cntlofreq = 0; 886 - for (i = 0; i < data->acpi_data.state_count; i++) { 855 + for (i = 0; i < data->acpi_data->state_count; i++) { 887 856 u32 fid; 888 857 u32 vid; 889 858 890 859 if (data->exttype) { 891 - fid = data->acpi_data.states[i].status & EXT_FID_MASK; 892 - vid = (data->acpi_data.states[i].status >> VID_SHIFT) & EXT_VID_MASK; 860 + fid = data->acpi_data->states[i].status & EXT_FID_MASK; 861 + vid = (data->acpi_data->states[i].status >> VID_SHIFT) & EXT_VID_MASK; 893 862 } else { 894 - fid = data->acpi_data.states[i].control & FID_MASK; 895 - vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK; 863 + fid = data->acpi_data->states[i].control & FID_MASK; 864 + vid = (data->acpi_data->states[i].control >> VID_SHIFT) & VID_MASK; 896 865 } 897 866 898 867 dprintk(" %d : fid 0x%x, vid 0x%x\n", i, fid, vid); ··· 933 902 cntlofreq = i; 934 903 } 935 904 936 - if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) { 905 + if (powernow_table[i].frequency != (data->acpi_data->states[i].core_frequency * 1000)) { 937 906 printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n", 938 907 powernow_table[i].frequency, 939 - (unsigned int) (data->acpi_data.states[i].core_frequency * 1000)); 908 + (unsigned int) (data->acpi_data->states[i].core_frequency * 1000)); 940 909 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; 941 910 continue; 942 911 } ··· 946 915 947 916 static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) 948 917 { 949 - if (data->acpi_data.state_count) 950 - acpi_processor_unregister_performance(&data->acpi_data, data->cpu); 918 + if (data->acpi_data->state_count) 919 + acpi_processor_unregister_performance(data->acpi_data, data->cpu); 951 920 } 952 921 953 922 #else 923 + static int powernow_k8_cpu_preinit_acpi(void) { return -ENODEV; } 954 924 static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) { return -ENODEV; } 955 925 static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) { return; } 956 926 static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) { return; } ··· 1136 1104 static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) 1137 1105 { 1138 1106 struct powernow_k8_data *data; 1139 - cpumask_t oldmask; 1107 + cpumask_t oldmask = CPU_MASK_ALL; 1140 1108 int rc; 1141 1109 1142 1110 if (!cpu_online(pol->cpu)) ··· 1209 1177 /* run on any CPU again */ 1210 1178 set_cpus_allowed_ptr(current, &oldmask); 1211 1179 1212 - if (cpu_family == CPU_HW_PSTATE) 1213 - pol->cpus = cpumask_of_cpu(pol->cpu); 1214 - else 1215 - pol->cpus = per_cpu(cpu_core_map, pol->cpu); 1180 + pol->cpus = data->starting_core_affinity; 1216 1181 data->available_cores = &(pol->cpus); 1217 1182 1218 1183 /* Take a crude guess here. ··· 1332 1303 } 1333 1304 1334 1305 if (supported_cpus == num_online_cpus()) { 1306 + powernow_k8_cpu_preinit_acpi(); 1335 1307 printk(KERN_INFO PFX "Found %d %s " 1336 1308 "processors (%d cpu cores) (" VERSION ")\n", 1337 1309 num_online_nodes(), ··· 1349 1319 dprintk("exit\n"); 1350 1320 1351 1321 cpufreq_unregister_driver(&cpufreq_amd64_driver); 1322 + 1323 + #ifdef CONFIG_X86_POWERNOW_K8_ACPI 1324 + free_percpu(acpi_perf_data); 1325 + #endif 1352 1326 } 1353 1327 1354 1328 MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>");
+2 -1
arch/x86/kernel/cpu/cpufreq/powernow-k8.h
··· 33 33 #ifdef CONFIG_X86_POWERNOW_K8_ACPI 34 34 /* the acpi table needs to be kept. it's only available if ACPI was 35 35 * used to determine valid frequency/vid/fid states */ 36 - struct acpi_processor_performance acpi_data; 36 + struct acpi_processor_performance *acpi_data; 37 37 #endif 38 38 /* we need to keep track of associated cores, but let cpufreq 39 39 * handle hotplug events - so just point at cpufreq pol->cpus 40 40 * structure */ 41 41 cpumask_t *available_cores; 42 + cpumask_t starting_core_affinity; 42 43 }; 43 44 44 45
+10 -10
drivers/cpufreq/cpufreq_conservative.c
··· 333 333 { 334 334 unsigned int idle_ticks, up_idle_ticks, down_idle_ticks; 335 335 unsigned int tmp_idle_ticks, total_idle_ticks; 336 - unsigned int freq_step; 336 + unsigned int freq_target; 337 337 unsigned int freq_down_sampling_rate; 338 338 struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info, cpu); 339 339 struct cpufreq_policy *policy; ··· 383 383 if (this_dbs_info->requested_freq == policy->max) 384 384 return; 385 385 386 - freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; 386 + freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100; 387 387 388 388 /* max freq cannot be less than 100. But who knows.... */ 389 - if (unlikely(freq_step == 0)) 390 - freq_step = 5; 389 + if (unlikely(freq_target == 0)) 390 + freq_target = 5; 391 391 392 - this_dbs_info->requested_freq += freq_step; 392 + this_dbs_info->requested_freq += freq_target; 393 393 if (this_dbs_info->requested_freq > policy->max) 394 394 this_dbs_info->requested_freq = policy->max; 395 395 ··· 425 425 /* 426 426 * if we are already at the lowest speed then break out early 427 427 * or if we 'cannot' reduce the speed as the user might want 428 - * freq_step to be zero 428 + * freq_target to be zero 429 429 */ 430 430 if (this_dbs_info->requested_freq == policy->min 431 431 || dbs_tuners_ins.freq_step == 0) 432 432 return; 433 433 434 - freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; 434 + freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100; 435 435 436 436 /* max freq cannot be less than 100. But who knows.... */ 437 - if (unlikely(freq_step == 0)) 438 - freq_step = 5; 437 + if (unlikely(freq_target == 0)) 438 + freq_target = 5; 439 439 440 - this_dbs_info->requested_freq -= freq_step; 440 + this_dbs_info->requested_freq -= freq_target; 441 441 if (this_dbs_info->requested_freq < policy->min) 442 442 this_dbs_info->requested_freq = policy->min; 443 443