diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-13 19:06:30 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-13 19:06:30 -0400 |
| commit | af09f1e4b3214569de93bc9309c35014e5c8a3d0 (patch) | |
| tree | cb5dc861a5114fca5cd9e52e0d25f835bdd79c42 | |
| parent | e030dbf91a87da7e8be3be3ca781558695bea683 (diff) | |
| parent | 9a60ddbcb710ff78cd8c772681723a04e3f5aba3 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
[CPUFREQ] Fix typos in powernow-k8 printk's.
[CPUFREQ] Restore previously used governor on a hot-replugged CPU
[CPUFREQ] bugfix cpufreq in combination with performance governor
[CPUFREQ] powernow-k8 compile fix.
[CPUFREQ] the overdue removal of X86_SPEEDSTEP_CENTRINO_ACPI
[CPUFREQ] Longhaul - Option to disable ACPI C3 support
Fixed up arch/i386/kernel/cpu/cpufreq/powernow-k8.c due to revert that
got fixed differently in the cpufreq branch.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | Documentation/feature-removal-schedule.txt | 22 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/Kconfig | 18 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/longhaul.c | 7 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 29 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | 276 | ||||
| -rw-r--r-- | arch/x86_64/kernel/cpufreq/Kconfig | 6 | ||||
| -rw-r--r-- | drivers/cpufreq/cpufreq.c | 29 |
7 files changed, 67 insertions, 320 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 0599a0c7c026..092c65dd35c2 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
| @@ -196,28 +196,6 @@ Who: Adrian Bunk <bunk@stusta.de> | |||
| 196 | 196 | ||
| 197 | --------------------------- | 197 | --------------------------- |
| 198 | 198 | ||
| 199 | What: ACPI hooks (X86_SPEEDSTEP_CENTRINO_ACPI) in speedstep-centrino driver | ||
| 200 | When: December 2006 | ||
| 201 | Why: Speedstep-centrino driver with ACPI hooks and acpi-cpufreq driver are | ||
| 202 | functionally very much similar. They talk to ACPI in same way. Only | ||
| 203 | difference between them is the way they do frequency transitions. | ||
| 204 | One uses MSRs and the other one uses IO ports. Functionaliy of | ||
| 205 | speedstep_centrino with ACPI hooks is now merged into acpi-cpufreq. | ||
| 206 | That means one common driver will support all Intel Enhanced Speedstep | ||
| 207 | capable CPUs. That means less confusion over name of | ||
| 208 | speedstep-centrino driver (with that driver supposed to be used on | ||
| 209 | non-centrino platforms). That means less duplication of code and | ||
| 210 | less maintenance effort and no possibility of these two drivers | ||
| 211 | going out of sync. | ||
| 212 | Current users of speedstep_centrino with ACPI hooks are requested to | ||
| 213 | switch over to acpi-cpufreq driver. speedstep-centrino will continue | ||
| 214 | to work using older non-ACPI static table based scheme even after this | ||
| 215 | date. | ||
| 216 | |||
| 217 | Who: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
| 218 | |||
| 219 | --------------------------- | ||
| 220 | |||
| 221 | What: /sys/firmware/acpi/namespace | 199 | What: /sys/firmware/acpi/namespace |
| 222 | When: 2.6.21 | 200 | When: 2.6.21 |
| 223 | Why: The ACPI namespace is effectively the symbol list for | 201 | Why: The ACPI namespace is effectively the symbol list for |
diff --git a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig index e77754ca94b4..094118ba00da 100644 --- a/arch/i386/kernel/cpu/cpufreq/Kconfig +++ b/arch/i386/kernel/cpu/cpufreq/Kconfig | |||
| @@ -116,7 +116,7 @@ config X86_GX_SUSPMOD | |||
| 116 | config X86_SPEEDSTEP_CENTRINO | 116 | config X86_SPEEDSTEP_CENTRINO |
| 117 | tristate "Intel Enhanced SpeedStep" | 117 | tristate "Intel Enhanced SpeedStep" |
| 118 | select CPU_FREQ_TABLE | 118 | select CPU_FREQ_TABLE |
| 119 | select X86_SPEEDSTEP_CENTRINO_TABLE if (!X86_SPEEDSTEP_CENTRINO_ACPI) | 119 | select X86_SPEEDSTEP_CENTRINO_TABLE |
| 120 | help | 120 | help |
| 121 | This adds the CPUFreq driver for Enhanced SpeedStep enabled | 121 | This adds the CPUFreq driver for Enhanced SpeedStep enabled |
| 122 | mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However, | 122 | mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However, |
| @@ -128,20 +128,6 @@ config X86_SPEEDSTEP_CENTRINO | |||
| 128 | 128 | ||
| 129 | If in doubt, say N. | 129 | If in doubt, say N. |
| 130 | 130 | ||
| 131 | config X86_SPEEDSTEP_CENTRINO_ACPI | ||
| 132 | bool "Use ACPI tables to decode valid frequency/voltage (deprecated)" | ||
| 133 | depends on X86_SPEEDSTEP_CENTRINO && ACPI_PROCESSOR | ||
| 134 | depends on !(X86_SPEEDSTEP_CENTRINO = y && ACPI_PROCESSOR = m) | ||
| 135 | help | ||
| 136 | This is deprecated and this functionality is now merged into | ||
| 137 | acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of | ||
| 138 | speedstep_centrino. | ||
| 139 | Use primarily the information provided in the BIOS ACPI tables | ||
| 140 | to determine valid CPU frequency and voltage pairings. It is | ||
| 141 | required for the driver to work on non-Banias CPUs. | ||
| 142 | |||
| 143 | If in doubt, say Y. | ||
| 144 | |||
| 145 | config X86_SPEEDSTEP_CENTRINO_TABLE | 131 | config X86_SPEEDSTEP_CENTRINO_TABLE |
| 146 | bool "Built-in tables for Banias CPUs" | 132 | bool "Built-in tables for Banias CPUs" |
| 147 | depends on X86_SPEEDSTEP_CENTRINO | 133 | depends on X86_SPEEDSTEP_CENTRINO |
| @@ -237,7 +223,7 @@ comment "shared options" | |||
| 237 | config X86_ACPI_CPUFREQ_PROC_INTF | 223 | config X86_ACPI_CPUFREQ_PROC_INTF |
| 238 | bool "/proc/acpi/processor/../performance interface (deprecated)" | 224 | bool "/proc/acpi/processor/../performance interface (deprecated)" |
| 239 | depends on PROC_FS | 225 | depends on PROC_FS |
| 240 | depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K7_ACPI || X86_POWERNOW_K8_ACPI | 226 | depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K7_ACPI || X86_POWERNOW_K8_ACPI |
| 241 | help | 227 | help |
| 242 | This enables the deprecated /proc/acpi/processor/../performance | 228 | This enables the deprecated /proc/acpi/processor/../performance |
| 243 | interface. While it is helpful for debugging, the generic, | 229 | interface. While it is helpful for debugging, the generic, |
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c index 8eca59d4c8f4..ef8f0bc3fc71 100644 --- a/arch/i386/kernel/cpu/cpufreq/longhaul.c +++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c | |||
| @@ -75,6 +75,7 @@ static unsigned int longhaul_index; | |||
| 75 | 75 | ||
| 76 | /* Module parameters */ | 76 | /* Module parameters */ |
| 77 | static int scale_voltage; | 77 | static int scale_voltage; |
| 78 | static int disable_acpi_c3; | ||
| 78 | 79 | ||
| 79 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "longhaul", msg) | 80 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "longhaul", msg) |
| 80 | 81 | ||
| @@ -844,6 +845,9 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy) | |||
| 844 | if (cx->address > 0 && cx->latency <= 1000) | 845 | if (cx->address > 0 && cx->latency <= 1000) |
| 845 | longhaul_flags |= USE_ACPI_C3; | 846 | longhaul_flags |= USE_ACPI_C3; |
| 846 | } | 847 | } |
| 848 | /* Disable if it isn't working */ | ||
| 849 | if (disable_acpi_c3) | ||
| 850 | longhaul_flags &= ~USE_ACPI_C3; | ||
| 847 | /* Check if northbridge is friendly */ | 851 | /* Check if northbridge is friendly */ |
| 848 | if (enable_arbiter_disable()) | 852 | if (enable_arbiter_disable()) |
| 849 | longhaul_flags |= USE_NORTHBRIDGE; | 853 | longhaul_flags |= USE_NORTHBRIDGE; |
| @@ -952,6 +956,9 @@ static void __exit longhaul_exit(void) | |||
| 952 | kfree(longhaul_table); | 956 | kfree(longhaul_table); |
| 953 | } | 957 | } |
| 954 | 958 | ||
| 959 | module_param (disable_acpi_c3, int, 0644); | ||
| 960 | MODULE_PARM_DESC(disable_acpi_c3, "Don't use ACPI C3 support"); | ||
| 961 | |||
| 955 | module_param (scale_voltage, int, 0644); | 962 | module_param (scale_voltage, int, 0644); |
| 956 | MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor"); | 963 | MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor"); |
| 957 | 964 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 4ade55c5f333..34ed53a06730 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
| @@ -599,14 +599,17 @@ static void print_basics(struct powernow_k8_data *data) | |||
| 599 | for (j = 0; j < data->numps; j++) { | 599 | for (j = 0; j < data->numps; j++) { |
| 600 | if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) { | 600 | if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) { |
| 601 | if (cpu_family == CPU_HW_PSTATE) { | 601 | if (cpu_family == CPU_HW_PSTATE) { |
| 602 | printk(KERN_INFO PFX " %d : fid 0x%x gid 0x%x (%d MHz)\n", j, (data->powernow_table[j].index & 0xff00) >> 8, | 602 | printk(KERN_INFO PFX " %d : fid 0x%x did 0x%x (%d MHz)\n", |
| 603 | (data->powernow_table[j].index & 0xff0000) >> 16, | 603 | j, |
| 604 | data->powernow_table[j].frequency/1000); | 604 | (data->powernow_table[j].index & 0xff00) >> 8, |
| 605 | (data->powernow_table[j].index & 0xff0000) >> 16, | ||
| 606 | data->powernow_table[j].frequency/1000); | ||
| 605 | } else { | 607 | } else { |
| 606 | printk(KERN_INFO PFX " %d : fid 0x%x (%d MHz), vid 0x%x\n", j, | 608 | printk(KERN_INFO PFX " %d : fid 0x%x (%d MHz), vid 0x%x\n", |
| 607 | data->powernow_table[j].index & 0xff, | 609 | j, |
| 608 | data->powernow_table[j].frequency/1000, | 610 | data->powernow_table[j].index & 0xff, |
| 609 | data->powernow_table[j].index >> 8); | 611 | data->powernow_table[j].frequency/1000, |
| 612 | data->powernow_table[j].index >> 8); | ||
| 610 | } | 613 | } |
| 611 | } | 614 | } |
| 612 | } | 615 | } |
| @@ -1086,7 +1089,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 1086 | 1089 | ||
| 1087 | if (cpu_family == CPU_HW_PSTATE) | 1090 | if (cpu_family == CPU_HW_PSTATE) |
| 1088 | dprintk("targ: curr fid 0x%x, did 0x%x\n", | 1091 | dprintk("targ: curr fid 0x%x, did 0x%x\n", |
| 1089 | data->currfid, data->currvid); | 1092 | data->currfid, data->currdid); |
| 1090 | else { | 1093 | else { |
| 1091 | dprintk("targ: curr fid 0x%x, vid 0x%x\n", | 1094 | dprintk("targ: curr fid 0x%x, vid 0x%x\n", |
| 1092 | data->currfid, data->currvid); | 1095 | data->currfid, data->currvid); |
| @@ -1322,16 +1325,22 @@ static struct cpufreq_driver cpufreq_amd64_driver = { | |||
| 1322 | static int __cpuinit powernowk8_init(void) | 1325 | static int __cpuinit powernowk8_init(void) |
| 1323 | { | 1326 | { |
| 1324 | unsigned int i, supported_cpus = 0; | 1327 | unsigned int i, supported_cpus = 0; |
| 1328 | unsigned int booted_cores = 1; | ||
| 1325 | 1329 | ||
| 1326 | for_each_online_cpu(i) { | 1330 | for_each_online_cpu(i) { |
| 1327 | if (check_supported_cpu(i)) | 1331 | if (check_supported_cpu(i)) |
| 1328 | supported_cpus++; | 1332 | supported_cpus++; |
| 1329 | } | 1333 | } |
| 1330 | 1334 | ||
| 1335 | #ifdef CONFIG_SMP | ||
| 1336 | booted_cores = cpu_data[0].booted_cores; | ||
| 1337 | #endif | ||
| 1338 | |||
| 1331 | if (supported_cpus == num_online_cpus()) { | 1339 | if (supported_cpus == num_online_cpus()) { |
| 1332 | printk(KERN_INFO PFX "Found %d %s " | 1340 | printk(KERN_INFO PFX "Found %d %s " |
| 1333 | "processors (" VERSION ")\n", supported_cpus, | 1341 | "processors (%d cpu cores) (" VERSION ")\n", |
| 1334 | boot_cpu_data.x86_model_id); | 1342 | supported_cpus/booted_cores, |
| 1343 | boot_cpu_data.x86_model_id, supported_cpus); | ||
| 1335 | return cpufreq_register_driver(&cpufreq_amd64_driver); | 1344 | return cpufreq_register_driver(&cpufreq_amd64_driver); |
| 1336 | } | 1345 | } |
| 1337 | 1346 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index 35489fd68852..6c5dc2c85aeb 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
| @@ -21,12 +21,6 @@ | |||
| 21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
| 22 | #include <linux/compiler.h> | 22 | #include <linux/compiler.h> |
| 23 | 23 | ||
| 24 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
| 25 | #include <linux/acpi.h> | ||
| 26 | #include <linux/dmi.h> | ||
| 27 | #include <acpi/processor.h> | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #include <asm/msr.h> | 24 | #include <asm/msr.h> |
| 31 | #include <asm/processor.h> | 25 | #include <asm/processor.h> |
| 32 | #include <asm/cpufeature.h> | 26 | #include <asm/cpufeature.h> |
| @@ -257,9 +251,7 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy) | |||
| 257 | /* Matched a non-match */ | 251 | /* Matched a non-match */ |
| 258 | dprintk("no table support for CPU model \"%s\"\n", | 252 | dprintk("no table support for CPU model \"%s\"\n", |
| 259 | cpu->x86_model_id); | 253 | cpu->x86_model_id); |
| 260 | #ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | 254 | dprintk("try using the acpi-cpufreq driver\n"); |
| 261 | dprintk("try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n"); | ||
| 262 | #endif | ||
| 263 | return -ENOENT; | 255 | return -ENOENT; |
| 264 | } | 256 | } |
| 265 | 257 | ||
| @@ -346,213 +338,6 @@ static unsigned int get_cur_freq(unsigned int cpu) | |||
| 346 | } | 338 | } |
| 347 | 339 | ||
| 348 | 340 | ||
| 349 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
| 350 | |||
| 351 | static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; | ||
| 352 | |||
| 353 | /* | ||
| 354 | * centrino_cpu_early_init_acpi - Do the preregistering with ACPI P-States | ||
| 355 | * library | ||
| 356 | * | ||
| 357 | * Before doing the actual init, we need to do _PSD related setup whenever | ||
| 358 | * supported by the BIOS. These are handled by this early_init routine. | ||
| 359 | */ | ||
| 360 | static int centrino_cpu_early_init_acpi(void) | ||
| 361 | { | ||
| 362 | unsigned int i, j; | ||
| 363 | struct acpi_processor_performance *data; | ||
| 364 | |||
| 365 | for_each_possible_cpu(i) { | ||
| 366 | data = kzalloc(sizeof(struct acpi_processor_performance), | ||
| 367 | GFP_KERNEL); | ||
| 368 | if (!data) { | ||
| 369 | for_each_possible_cpu(j) { | ||
| 370 | kfree(acpi_perf_data[j]); | ||
| 371 | acpi_perf_data[j] = NULL; | ||
| 372 | } | ||
| 373 | return (-ENOMEM); | ||
| 374 | } | ||
| 375 | acpi_perf_data[i] = data; | ||
| 376 | } | ||
| 377 | |||
| 378 | acpi_processor_preregister_performance(acpi_perf_data); | ||
| 379 | return 0; | ||
| 380 | } | ||
| 381 | |||
| 382 | |||
| 383 | #ifdef CONFIG_SMP | ||
| 384 | /* | ||
| 385 | * Some BIOSes do SW_ANY coordination internally, either set it up in hw | ||
| 386 | * or do it in BIOS firmware and won't inform about it to OS. If not | ||
| 387 | * detected, this has a side effect of making CPU run at a different speed | ||
| 388 | * than OS intended it to run at. Detect it and handle it cleanly. | ||
| 389 | */ | ||
| 390 | static int bios_with_sw_any_bug; | ||
| 391 | static int sw_any_bug_found(struct dmi_system_id *d) | ||
| 392 | { | ||
| 393 | bios_with_sw_any_bug = 1; | ||
| 394 | return 0; | ||
| 395 | } | ||
| 396 | |||
| 397 | static struct dmi_system_id sw_any_bug_dmi_table[] = { | ||
| 398 | { | ||
| 399 | .callback = sw_any_bug_found, | ||
| 400 | .ident = "Supermicro Server X6DLP", | ||
| 401 | .matches = { | ||
| 402 | DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"), | ||
| 403 | DMI_MATCH(DMI_BIOS_VERSION, "080010"), | ||
| 404 | DMI_MATCH(DMI_PRODUCT_NAME, "X6DLP"), | ||
| 405 | }, | ||
| 406 | }, | ||
| 407 | { } | ||
| 408 | }; | ||
| 409 | #endif | ||
| 410 | |||
| 411 | /* | ||
| 412 | * centrino_cpu_init_acpi - register with ACPI P-States library | ||
| 413 | * | ||
| 414 | * Register with the ACPI P-States library (part of drivers/acpi/processor.c) | ||
| 415 | * in order to determine correct frequency and voltage pairings by reading | ||
| 416 | * the _PSS of the ACPI DSDT or SSDT tables. | ||
| 417 | */ | ||
| 418 | static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | ||
| 419 | { | ||
| 420 | unsigned long cur_freq; | ||
| 421 | int result = 0, i; | ||
| 422 | unsigned int cpu = policy->cpu; | ||
| 423 | struct acpi_processor_performance *p; | ||
| 424 | |||
| 425 | p = acpi_perf_data[cpu]; | ||
| 426 | |||
| 427 | /* register with ACPI core */ | ||
| 428 | if (acpi_processor_register_performance(p, cpu)) { | ||
| 429 | dprintk(PFX "obtaining ACPI data failed\n"); | ||
| 430 | return -EIO; | ||
| 431 | } | ||
| 432 | |||
| 433 | policy->shared_type = p->shared_type; | ||
| 434 | /* | ||
| 435 | * Will let policy->cpus know about dependency only when software | ||
| 436 | * coordination is required. | ||
| 437 | */ | ||
| 438 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || | ||
| 439 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { | ||
| 440 | policy->cpus = p->shared_cpu_map; | ||
| 441 | } | ||
| 442 | |||
| 443 | #ifdef CONFIG_SMP | ||
| 444 | dmi_check_system(sw_any_bug_dmi_table); | ||
| 445 | if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) { | ||
| 446 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; | ||
| 447 | policy->cpus = cpu_core_map[cpu]; | ||
| 448 | } | ||
| 449 | #endif | ||
| 450 | |||
| 451 | /* verify the acpi_data */ | ||
| 452 | if (p->state_count <= 1) { | ||
| 453 | dprintk("No P-States\n"); | ||
| 454 | result = -ENODEV; | ||
| 455 | goto err_unreg; | ||
| 456 | } | ||
| 457 | |||
| 458 | if ((p->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || | ||
| 459 | (p->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { | ||
| 460 | dprintk("Invalid control/status registers (%x - %x)\n", | ||
| 461 | p->control_register.space_id, p->status_register.space_id); | ||
| 462 | result = -EIO; | ||
| 463 | goto err_unreg; | ||
| 464 | } | ||
| 465 | |||
| 466 | for (i=0; i<p->state_count; i++) { | ||
| 467 | if ((p->states[i].control & INTEL_MSR_RANGE) != | ||
| 468 | (p->states[i].status & INTEL_MSR_RANGE)) { | ||
| 469 | dprintk("Different MSR bits in control (%llu) and status (%llu)\n", | ||
| 470 | p->states[i].control, p->states[i].status); | ||
| 471 | result = -EINVAL; | ||
| 472 | goto err_unreg; | ||
| 473 | } | ||
| 474 | |||
| 475 | if (!p->states[i].core_frequency) { | ||
| 476 | dprintk("Zero core frequency for state %u\n", i); | ||
| 477 | result = -EINVAL; | ||
| 478 | goto err_unreg; | ||
| 479 | } | ||
| 480 | |||
| 481 | if (p->states[i].core_frequency > p->states[0].core_frequency) { | ||
| 482 | dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i, | ||
| 483 | p->states[i].core_frequency, p->states[0].core_frequency); | ||
| 484 | p->states[i].core_frequency = 0; | ||
| 485 | continue; | ||
| 486 | } | ||
| 487 | } | ||
| 488 | |||
| 489 | centrino_model[cpu] = kzalloc(sizeof(struct cpu_model), GFP_KERNEL); | ||
| 490 | if (!centrino_model[cpu]) { | ||
| 491 | result = -ENOMEM; | ||
| 492 | goto err_unreg; | ||
| 493 | } | ||
| 494 | |||
| 495 | centrino_model[cpu]->model_name=NULL; | ||
| 496 | centrino_model[cpu]->max_freq = p->states[0].core_frequency * 1000; | ||
| 497 | centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) * | ||
| 498 | (p->state_count + 1), GFP_KERNEL); | ||
| 499 | if (!centrino_model[cpu]->op_points) { | ||
| 500 | result = -ENOMEM; | ||
| 501 | goto err_kfree; | ||
| 502 | } | ||
| 503 | |||
| 504 | for (i=0; i<p->state_count; i++) { | ||
| 505 | centrino_model[cpu]->op_points[i].index = p->states[i].control & INTEL_MSR_RANGE; | ||
| 506 | centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000; | ||
| 507 | dprintk("adding state %i with frequency %u and control value %04x\n", | ||
| 508 | i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); | ||
| 509 | } | ||
| 510 | centrino_model[cpu]->op_points[p->state_count].frequency = CPUFREQ_TABLE_END; | ||
| 511 | |||
| 512 | cur_freq = get_cur_freq(cpu); | ||
| 513 | |||
| 514 | for (i=0; i<p->state_count; i++) { | ||
| 515 | if (!p->states[i].core_frequency) { | ||
| 516 | dprintk("skipping state %u\n", i); | ||
| 517 | centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID; | ||
| 518 | continue; | ||
| 519 | } | ||
| 520 | |||
| 521 | if (extract_clock(centrino_model[cpu]->op_points[i].index, cpu, 0) != | ||
| 522 | (centrino_model[cpu]->op_points[i].frequency)) { | ||
| 523 | dprintk("Invalid encoded frequency (%u vs. %u)\n", | ||
| 524 | extract_clock(centrino_model[cpu]->op_points[i].index, cpu, 0), | ||
| 525 | centrino_model[cpu]->op_points[i].frequency); | ||
| 526 | result = -EINVAL; | ||
| 527 | goto err_kfree_all; | ||
| 528 | } | ||
| 529 | |||
| 530 | if (cur_freq == centrino_model[cpu]->op_points[i].frequency) | ||
| 531 | p->state = i; | ||
| 532 | } | ||
| 533 | |||
| 534 | /* notify BIOS that we exist */ | ||
| 535 | acpi_processor_notify_smm(THIS_MODULE); | ||
| 536 | printk("speedstep-centrino with X86_SPEEDSTEP_CENTRINO_ACPI " | ||
| 537 | "config is deprecated.\n " | ||
| 538 | "Use X86_ACPI_CPUFREQ (acpi-cpufreq) instead.\n" ); | ||
| 539 | |||
| 540 | return 0; | ||
| 541 | |||
| 542 | err_kfree_all: | ||
| 543 | kfree(centrino_model[cpu]->op_points); | ||
| 544 | err_kfree: | ||
| 545 | kfree(centrino_model[cpu]); | ||
| 546 | err_unreg: | ||
| 547 | acpi_processor_unregister_performance(p, cpu); | ||
| 548 | dprintk(PFX "invalid ACPI data\n"); | ||
| 549 | return (result); | ||
| 550 | } | ||
| 551 | #else | ||
| 552 | static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; } | ||
| 553 | static inline int centrino_cpu_early_init_acpi(void) { return 0; } | ||
| 554 | #endif | ||
| 555 | |||
| 556 | static int centrino_cpu_init(struct cpufreq_policy *policy) | 341 | static int centrino_cpu_init(struct cpufreq_policy *policy) |
| 557 | { | 342 | { |
| 558 | struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; | 343 | struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; |
| @@ -568,27 +353,25 @@ static int centrino_cpu_init(struct cpufreq_policy *policy) | |||
| 568 | if (cpu_has(cpu, X86_FEATURE_CONSTANT_TSC)) | 353 | if (cpu_has(cpu, X86_FEATURE_CONSTANT_TSC)) |
| 569 | centrino_driver.flags |= CPUFREQ_CONST_LOOPS; | 354 | centrino_driver.flags |= CPUFREQ_CONST_LOOPS; |
| 570 | 355 | ||
| 571 | if (centrino_cpu_init_acpi(policy)) { | 356 | if (policy->cpu != 0) |
| 572 | if (policy->cpu != 0) | 357 | return -ENODEV; |
| 573 | return -ENODEV; | ||
| 574 | 358 | ||
| 575 | for (i = 0; i < N_IDS; i++) | 359 | for (i = 0; i < N_IDS; i++) |
| 576 | if (centrino_verify_cpu_id(cpu, &cpu_ids[i])) | 360 | if (centrino_verify_cpu_id(cpu, &cpu_ids[i])) |
| 577 | break; | 361 | break; |
| 578 | 362 | ||
| 579 | if (i != N_IDS) | 363 | if (i != N_IDS) |
| 580 | centrino_cpu[policy->cpu] = &cpu_ids[i]; | 364 | centrino_cpu[policy->cpu] = &cpu_ids[i]; |
| 581 | 365 | ||
| 582 | if (!centrino_cpu[policy->cpu]) { | 366 | if (!centrino_cpu[policy->cpu]) { |
| 583 | dprintk("found unsupported CPU with " | 367 | dprintk("found unsupported CPU with " |
| 584 | "Enhanced SpeedStep: send /proc/cpuinfo to " | 368 | "Enhanced SpeedStep: send /proc/cpuinfo to " |
| 585 | MAINTAINER "\n"); | 369 | MAINTAINER "\n"); |
| 586 | return -ENODEV; | 370 | return -ENODEV; |
| 587 | } | 371 | } |
| 588 | 372 | ||
| 589 | if (centrino_cpu_init_table(policy)) { | 373 | if (centrino_cpu_init_table(policy)) { |
| 590 | return -ENODEV; | 374 | return -ENODEV; |
| 591 | } | ||
| 592 | } | 375 | } |
| 593 | 376 | ||
| 594 | /* Check to see if Enhanced SpeedStep is enabled, and try to | 377 | /* Check to see if Enhanced SpeedStep is enabled, and try to |
| @@ -634,20 +417,6 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy) | |||
| 634 | 417 | ||
| 635 | cpufreq_frequency_table_put_attr(cpu); | 418 | cpufreq_frequency_table_put_attr(cpu); |
| 636 | 419 | ||
| 637 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
| 638 | if (!centrino_model[cpu]->model_name) { | ||
| 639 | static struct acpi_processor_performance *p; | ||
| 640 | |||
| 641 | if (acpi_perf_data[cpu]) { | ||
| 642 | p = acpi_perf_data[cpu]; | ||
| 643 | dprintk("unregistering and freeing ACPI data\n"); | ||
| 644 | acpi_processor_unregister_performance(p, cpu); | ||
| 645 | kfree(centrino_model[cpu]->op_points); | ||
| 646 | kfree(centrino_model[cpu]); | ||
| 647 | } | ||
| 648 | } | ||
| 649 | #endif | ||
| 650 | |||
| 651 | centrino_model[cpu] = NULL; | 420 | centrino_model[cpu] = NULL; |
| 652 | 421 | ||
| 653 | return 0; | 422 | return 0; |
| @@ -849,25 +618,12 @@ static int __init centrino_init(void) | |||
| 849 | if (!cpu_has(cpu, X86_FEATURE_EST)) | 618 | if (!cpu_has(cpu, X86_FEATURE_EST)) |
| 850 | return -ENODEV; | 619 | return -ENODEV; |
| 851 | 620 | ||
| 852 | centrino_cpu_early_init_acpi(); | ||
| 853 | |||
| 854 | return cpufreq_register_driver(¢rino_driver); | 621 | return cpufreq_register_driver(¢rino_driver); |
| 855 | } | 622 | } |
| 856 | 623 | ||
| 857 | static void __exit centrino_exit(void) | 624 | static void __exit centrino_exit(void) |
| 858 | { | 625 | { |
| 859 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
| 860 | unsigned int j; | ||
| 861 | #endif | ||
| 862 | |||
| 863 | cpufreq_unregister_driver(¢rino_driver); | 626 | cpufreq_unregister_driver(¢rino_driver); |
| 864 | |||
| 865 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
| 866 | for_each_possible_cpu(j) { | ||
| 867 | kfree(acpi_perf_data[j]); | ||
| 868 | acpi_perf_data[j] = NULL; | ||
| 869 | } | ||
| 870 | #endif | ||
| 871 | } | 627 | } |
| 872 | 628 | ||
| 873 | MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); | 629 | MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); |
diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig index c0749d2479f5..a3fd51926cbd 100644 --- a/arch/x86_64/kernel/cpufreq/Kconfig +++ b/arch/x86_64/kernel/cpufreq/Kconfig | |||
| @@ -48,10 +48,6 @@ config X86_SPEEDSTEP_CENTRINO | |||
| 48 | 48 | ||
| 49 | If in doubt, say N. | 49 | If in doubt, say N. |
| 50 | 50 | ||
| 51 | config X86_SPEEDSTEP_CENTRINO_ACPI | ||
| 52 | bool | ||
| 53 | depends on X86_SPEEDSTEP_CENTRINO | ||
| 54 | |||
| 55 | config X86_ACPI_CPUFREQ | 51 | config X86_ACPI_CPUFREQ |
| 56 | tristate "ACPI Processor P-States driver" | 52 | tristate "ACPI Processor P-States driver" |
| 57 | select CPU_FREQ_TABLE | 53 | select CPU_FREQ_TABLE |
| @@ -73,7 +69,7 @@ comment "shared options" | |||
| 73 | config X86_ACPI_CPUFREQ_PROC_INTF | 69 | config X86_ACPI_CPUFREQ_PROC_INTF |
| 74 | bool "/proc/acpi/processor/../performance interface (deprecated)" | 70 | bool "/proc/acpi/processor/../performance interface (deprecated)" |
| 75 | depends on PROC_FS | 71 | depends on PROC_FS |
| 76 | depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K8_ACPI | 72 | depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K8_ACPI |
| 77 | help | 73 | help |
| 78 | This enables the deprecated /proc/acpi/processor/../performance | 74 | This enables the deprecated /proc/acpi/processor/../performance |
| 79 | interface. While it is helpful for debugging, the generic, | 75 | interface. While it is helpful for debugging, the generic, |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0db9e1bda322..2f6a73c01b71 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -39,6 +39,10 @@ | |||
| 39 | */ | 39 | */ |
| 40 | static struct cpufreq_driver *cpufreq_driver; | 40 | static struct cpufreq_driver *cpufreq_driver; |
| 41 | static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; | 41 | static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; |
| 42 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 43 | /* This one keeps track of the previously set governor of a removed CPU */ | ||
| 44 | static struct cpufreq_governor *cpufreq_cpu_governor[NR_CPUS]; | ||
| 45 | #endif | ||
| 42 | static DEFINE_SPINLOCK(cpufreq_driver_lock); | 46 | static DEFINE_SPINLOCK(cpufreq_driver_lock); |
| 43 | 47 | ||
| 44 | /* | 48 | /* |
| @@ -770,9 +774,17 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
| 770 | } | 774 | } |
| 771 | policy->user_policy.min = policy->cpuinfo.min_freq; | 775 | policy->user_policy.min = policy->cpuinfo.min_freq; |
| 772 | policy->user_policy.max = policy->cpuinfo.max_freq; | 776 | policy->user_policy.max = policy->cpuinfo.max_freq; |
| 773 | policy->user_policy.governor = policy->governor; | ||
| 774 | 777 | ||
| 775 | #ifdef CONFIG_SMP | 778 | #ifdef CONFIG_SMP |
| 779 | |||
| 780 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 781 | if (cpufreq_cpu_governor[cpu]){ | ||
| 782 | policy->governor = cpufreq_cpu_governor[cpu]; | ||
| 783 | dprintk("Restoring governor %s for cpu %d\n", | ||
| 784 | policy->governor->name, cpu); | ||
| 785 | } | ||
| 786 | #endif | ||
| 787 | |||
| 776 | for_each_cpu_mask(j, policy->cpus) { | 788 | for_each_cpu_mask(j, policy->cpus) { |
| 777 | if (cpu == j) | 789 | if (cpu == j) |
| 778 | continue; | 790 | continue; |
| @@ -873,6 +885,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
| 873 | /* set default policy */ | 885 | /* set default policy */ |
| 874 | ret = __cpufreq_set_policy(policy, &new_policy); | 886 | ret = __cpufreq_set_policy(policy, &new_policy); |
| 875 | policy->user_policy.policy = policy->policy; | 887 | policy->user_policy.policy = policy->policy; |
| 888 | policy->user_policy.governor = policy->governor; | ||
| 876 | 889 | ||
| 877 | unlock_policy_rwsem_write(cpu); | 890 | unlock_policy_rwsem_write(cpu); |
| 878 | 891 | ||
| @@ -969,6 +982,11 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev) | |||
| 969 | } | 982 | } |
| 970 | 983 | ||
| 971 | #ifdef CONFIG_SMP | 984 | #ifdef CONFIG_SMP |
| 985 | |||
| 986 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 987 | cpufreq_cpu_governor[cpu] = data->governor; | ||
| 988 | #endif | ||
| 989 | |||
| 972 | /* if we have other CPUs still registered, we need to unlink them, | 990 | /* if we have other CPUs still registered, we need to unlink them, |
| 973 | * or else wait_for_completion below will lock up. Clean the | 991 | * or else wait_for_completion below will lock up. Clean the |
| 974 | * cpufreq_cpu_data[] while holding the lock, and remove the sysfs | 992 | * cpufreq_cpu_data[] while holding the lock, and remove the sysfs |
| @@ -989,6 +1007,9 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev) | |||
| 989 | if (j == cpu) | 1007 | if (j == cpu) |
| 990 | continue; | 1008 | continue; |
| 991 | dprintk("removing link for cpu %u\n", j); | 1009 | dprintk("removing link for cpu %u\n", j); |
| 1010 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 1011 | cpufreq_cpu_governor[j] = data->governor; | ||
| 1012 | #endif | ||
| 992 | cpu_sys_dev = get_cpu_sysdev(j); | 1013 | cpu_sys_dev = get_cpu_sysdev(j); |
| 993 | sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); | 1014 | sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); |
| 994 | cpufreq_cpu_put(data); | 1015 | cpufreq_cpu_put(data); |
| @@ -1687,7 +1708,6 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb, | |||
| 1687 | { | 1708 | { |
| 1688 | unsigned int cpu = (unsigned long)hcpu; | 1709 | unsigned int cpu = (unsigned long)hcpu; |
| 1689 | struct sys_device *sys_dev; | 1710 | struct sys_device *sys_dev; |
| 1690 | struct cpufreq_policy *policy; | ||
| 1691 | 1711 | ||
| 1692 | sys_dev = get_cpu_sysdev(cpu); | 1712 | sys_dev = get_cpu_sysdev(cpu); |
| 1693 | if (sys_dev) { | 1713 | if (sys_dev) { |
| @@ -1701,11 +1721,6 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb, | |||
| 1701 | if (unlikely(lock_policy_rwsem_write(cpu))) | 1721 | if (unlikely(lock_policy_rwsem_write(cpu))) |
| 1702 | BUG(); | 1722 | BUG(); |
| 1703 | 1723 | ||
| 1704 | policy = cpufreq_cpu_data[cpu]; | ||
| 1705 | if (policy) { | ||
| 1706 | __cpufreq_driver_target(policy, policy->min, | ||
| 1707 | CPUFREQ_RELATION_H); | ||
| 1708 | } | ||
| 1709 | __cpufreq_remove_dev(sys_dev); | 1724 | __cpufreq_remove_dev(sys_dev); |
| 1710 | break; | 1725 | break; |
| 1711 | case CPU_DOWN_FAILED: | 1726 | case CPU_DOWN_FAILED: |
