diff options
author | Len Brown <len.brown@intel.com> | 2009-01-09 03:39:43 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-01-09 03:39:43 -0500 |
commit | b2576e1d4408e134e2188c967b1f28af39cd79d4 (patch) | |
tree | 004f3c82faab760f304ce031d6d2f572e7746a50 /drivers/acpi | |
parent | 3cc8a5f4ba91f67bbdb81a43a99281a26aab8d77 (diff) | |
parent | 2150edc6c5cf00f7adb54538b9ea2a3e9cedca3f (diff) |
Merge branch 'linus' into release
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/exprep.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/exresolv.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/exstore.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/rscreate.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/utobject.c | 4 | ||||
-rw-r--r-- | drivers/acpi/pci_irq.c | 56 | ||||
-rw-r--r-- | drivers/acpi/pci_root.c | 20 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 14 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 7 | ||||
-rw-r--r-- | drivers/acpi/processor_perflib.c | 28 | ||||
-rw-r--r-- | drivers/acpi/processor_throttling.c | 80 |
13 files changed, 167 insertions, 56 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 63a17b55b39b..7a0f4aa4fa1e 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * | 20 | * |
21 | * | 21 | * |
22 | * ACPI based HotPlug driver that supports Memory Hotplug | 22 | * ACPI based HotPlug driver that supports Memory Hotplug |
23 | * This driver fields notifications from firmare for memory add | 23 | * This driver fields notifications from firmware for memory add |
24 | * and remove operations and alerts the VM of the affected memory | 24 | * and remove operations and alerts the VM of the affected memory |
25 | * ranges. | 25 | * ranges. |
26 | */ | 26 | */ |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index c57286a3aceb..9c127e8e2d6d 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -283,8 +283,8 @@ | |||
283 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) | 283 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) |
284 | 284 | ||
285 | /* | 285 | /* |
286 | * An struct acpi_namespace_node can appear in some contexts | 286 | * A struct acpi_namespace_node can appear in some contexts |
287 | * where a pointer to an union acpi_operand_object can also | 287 | * where a pointer to a union acpi_operand_object can also |
288 | * appear. This macro is used to distinguish them. | 288 | * appear. This macro is used to distinguish them. |
289 | * | 289 | * |
290 | * The "Descriptor" field is the first field in both structures. | 290 | * The "Descriptor" field is the first field in both structures. |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 33c66eb3ae39..a226f74d4a5c 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -405,7 +405,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
405 | * | 405 | * |
406 | * RETURN: Status | 406 | * RETURN: Status |
407 | * | 407 | * |
408 | * DESCRIPTION: Construct an union acpi_operand_object of type def_field and | 408 | * DESCRIPTION: Construct a union acpi_operand_object of type def_field and |
409 | * connect it to the parent Node. | 409 | * connect it to the parent Node. |
410 | * | 410 | * |
411 | ******************************************************************************/ | 411 | ******************************************************************************/ |
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index 3673d2b2c4ac..f6105a6d6126 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c | |||
@@ -147,7 +147,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
147 | 147 | ||
148 | stack_desc = *stack_ptr; | 148 | stack_desc = *stack_ptr; |
149 | 149 | ||
150 | /* This is an union acpi_operand_object */ | 150 | /* This is a union acpi_operand_object */ |
151 | 151 | ||
152 | switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { | 152 | switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { |
153 | case ACPI_TYPE_LOCAL_REFERENCE: | 153 | case ACPI_TYPE_LOCAL_REFERENCE: |
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index 7c6d7e53e41e..e35e9b4f6a4e 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
@@ -275,7 +275,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
275 | * | 275 | * |
276 | * PARAMETERS: *source_desc - Value to be stored | 276 | * PARAMETERS: *source_desc - Value to be stored |
277 | * *dest_desc - Where to store it. Must be an NS node | 277 | * *dest_desc - Where to store it. Must be an NS node |
278 | * or an union acpi_operand_object of type | 278 | * or a union acpi_operand_object of type |
279 | * Reference; | 279 | * Reference; |
280 | * walk_state - Current walk state | 280 | * walk_state - Current walk state |
281 | * | 281 | * |
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 9eb3a2a68408..61566b1a0616 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -125,7 +125,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
125 | * | 125 | * |
126 | * FUNCTION: acpi_rs_create_pci_routing_table | 126 | * FUNCTION: acpi_rs_create_pci_routing_table |
127 | * | 127 | * |
128 | * PARAMETERS: package_object - Pointer to an union acpi_operand_object | 128 | * PARAMETERS: package_object - Pointer to a union acpi_operand_object |
129 | * package | 129 | * package |
130 | * output_buffer - Pointer to the user's buffer | 130 | * output_buffer - Pointer to the user's buffer |
131 | * | 131 | * |
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 4279ed3a8782..fd5ea7543e5b 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c | |||
@@ -298,7 +298,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
298 | * | 298 | * |
299 | * RETURN: TRUE if object is valid, FALSE otherwise | 299 | * RETURN: TRUE if object is valid, FALSE otherwise |
300 | * | 300 | * |
301 | * DESCRIPTION: Validate a pointer to be an union acpi_operand_object | 301 | * DESCRIPTION: Validate a pointer to be a union acpi_operand_object |
302 | * | 302 | * |
303 | ******************************************************************************/ | 303 | ******************************************************************************/ |
304 | 304 | ||
@@ -390,7 +390,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object) | |||
390 | { | 390 | { |
391 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); | 391 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); |
392 | 392 | ||
393 | /* Object must be an union acpi_operand_object */ | 393 | /* Object must be a union acpi_operand_object */ |
394 | 394 | ||
395 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { | 395 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { |
396 | ACPI_ERROR((AE_INFO, | 396 | ACPI_ERROR((AE_INFO, |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 11acaee14d66..bf79d83bdfbb 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -384,6 +384,27 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry, | |||
384 | return irq; | 384 | return irq; |
385 | } | 385 | } |
386 | 386 | ||
387 | #ifdef CONFIG_X86_IO_APIC | ||
388 | extern int noioapicquirk; | ||
389 | |||
390 | static int bridge_has_boot_interrupt_variant(struct pci_bus *bus) | ||
391 | { | ||
392 | struct pci_bus *bus_it; | ||
393 | |||
394 | for (bus_it = bus ; bus_it ; bus_it = bus_it->parent) { | ||
395 | if (!bus_it->self) | ||
396 | return 0; | ||
397 | |||
398 | printk(KERN_INFO "vendor=%04x device=%04x\n", bus_it->self->vendor, | ||
399 | bus_it->self->device); | ||
400 | |||
401 | if (bus_it->self->irq_reroute_variant) | ||
402 | return bus_it->self->irq_reroute_variant; | ||
403 | } | ||
404 | return 0; | ||
405 | } | ||
406 | #endif /* CONFIG_X86_IO_APIC */ | ||
407 | |||
387 | /* | 408 | /* |
388 | * acpi_pci_irq_lookup | 409 | * acpi_pci_irq_lookup |
389 | * success: return IRQ >= 0 | 410 | * success: return IRQ >= 0 |
@@ -413,6 +434,41 @@ acpi_pci_irq_lookup(struct pci_bus *bus, | |||
413 | } | 434 | } |
414 | 435 | ||
415 | ret = func(entry, triggering, polarity, link); | 436 | ret = func(entry, triggering, polarity, link); |
437 | |||
438 | #ifdef CONFIG_X86_IO_APIC | ||
439 | /* | ||
440 | * Some chipsets (e.g. intel 6700PXH) generate a legacy INTx when the | ||
441 | * IRQ entry in the chipset's IO-APIC is masked (as, e.g. the RT kernel | ||
442 | * does during interrupt handling). When this INTx generation cannot be | ||
443 | * disabled, we reroute these interrupts to their legacy equivalent to | ||
444 | * get rid of spurious interrupts. | ||
445 | */ | ||
446 | if (!noioapicquirk) { | ||
447 | switch (bridge_has_boot_interrupt_variant(bus)) { | ||
448 | case 0: | ||
449 | /* no rerouting necessary */ | ||
450 | break; | ||
451 | |||
452 | case INTEL_IRQ_REROUTE_VARIANT: | ||
453 | /* | ||
454 | * Remap according to INTx routing table in 6700PXH | ||
455 | * specs, intel order number 302628-002, section | ||
456 | * 2.15.2. Other chipsets (80332, ...) have the same | ||
457 | * mapping and are handled here as well. | ||
458 | */ | ||
459 | printk(KERN_INFO "pci irq %d -> rerouted to legacy " | ||
460 | "irq %d\n", ret, (ret % 4) + 16); | ||
461 | ret = (ret % 4) + 16; | ||
462 | break; | ||
463 | |||
464 | default: | ||
465 | printk(KERN_INFO "not rerouting irq %d to legacy irq: " | ||
466 | "unknown mapping\n", ret); | ||
467 | break; | ||
468 | } | ||
469 | } | ||
470 | #endif /* CONFIG_X86_IO_APIC */ | ||
471 | |||
416 | return ret; | 472 | return ret; |
417 | } | 473 | } |
418 | 474 | ||
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 642554b1b60c..5b38a026d122 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <linux/pm.h> | 32 | #include <linux/pm.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/pci-acpi.h> | ||
34 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
35 | #include <acpi/acpi_bus.h> | 36 | #include <acpi/acpi_bus.h> |
36 | #include <acpi/acpi_drivers.h> | 37 | #include <acpi/acpi_drivers.h> |
@@ -193,6 +194,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
193 | unsigned long long value = 0; | 194 | unsigned long long value = 0; |
194 | acpi_handle handle = NULL; | 195 | acpi_handle handle = NULL; |
195 | struct acpi_device *child; | 196 | struct acpi_device *child; |
197 | u32 flags, base_flags; | ||
196 | 198 | ||
197 | 199 | ||
198 | if (!device) | 200 | if (!device) |
@@ -210,6 +212,13 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
210 | 212 | ||
211 | device->ops.bind = acpi_pci_bind; | 213 | device->ops.bind = acpi_pci_bind; |
212 | 214 | ||
215 | /* | ||
216 | * All supported architectures that use ACPI have support for | ||
217 | * PCI domains, so we indicate this in _OSC support capabilities. | ||
218 | */ | ||
219 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; | ||
220 | pci_acpi_osc_support(device->handle, flags); | ||
221 | |||
213 | /* | 222 | /* |
214 | * Segment | 223 | * Segment |
215 | * ------- | 224 | * ------- |
@@ -335,6 +344,17 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
335 | list_for_each_entry(child, &device->children, node) | 344 | list_for_each_entry(child, &device->children, node) |
336 | acpi_pci_bridge_scan(child); | 345 | acpi_pci_bridge_scan(child); |
337 | 346 | ||
347 | /* Indicate support for various _OSC capabilities. */ | ||
348 | if (pci_ext_cfg_avail(root->bus->self)) | ||
349 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; | ||
350 | if (pcie_aspm_enabled()) | ||
351 | flags |= OSC_ACTIVE_STATE_PWR_SUPPORT | | ||
352 | OSC_CLOCK_PWR_CAPABILITY_SUPPORT; | ||
353 | if (pci_msi_enabled()) | ||
354 | flags |= OSC_MSI_SUPPORT; | ||
355 | if (flags != base_flags) | ||
356 | pci_acpi_osc_support(device->handle, flags); | ||
357 | |||
338 | end: | 358 | end: |
339 | if (result) { | 359 | if (result) { |
340 | if (!list_empty(&root->node)) | 360 | if (!list_empty(&root->node)) |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 34948362f41d..0cc2fd31e376 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -826,6 +826,11 @@ static int acpi_processor_add(struct acpi_device *device) | |||
826 | if (!pr) | 826 | if (!pr) |
827 | return -ENOMEM; | 827 | return -ENOMEM; |
828 | 828 | ||
829 | if (!alloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) { | ||
830 | kfree(pr); | ||
831 | return -ENOMEM; | ||
832 | } | ||
833 | |||
829 | pr->handle = device->handle; | 834 | pr->handle = device->handle; |
830 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); | 835 | strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME); |
831 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); | 836 | strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); |
@@ -845,10 +850,8 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
845 | 850 | ||
846 | pr = acpi_driver_data(device); | 851 | pr = acpi_driver_data(device); |
847 | 852 | ||
848 | if (pr->id >= nr_cpu_ids) { | 853 | if (pr->id >= nr_cpu_ids) |
849 | kfree(pr); | 854 | goto free; |
850 | return 0; | ||
851 | } | ||
852 | 855 | ||
853 | if (type == ACPI_BUS_REMOVAL_EJECT) { | 856 | if (type == ACPI_BUS_REMOVAL_EJECT) { |
854 | if (acpi_processor_handle_eject(pr)) | 857 | if (acpi_processor_handle_eject(pr)) |
@@ -873,6 +876,9 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
873 | 876 | ||
874 | per_cpu(processors, pr->id) = NULL; | 877 | per_cpu(processors, pr->id) = NULL; |
875 | per_cpu(processor_device_array, pr->id) = NULL; | 878 | per_cpu(processor_device_array, pr->id) = NULL; |
879 | |||
880 | free: | ||
881 | free_cpumask_var(pr->throttling.shared_cpu_map); | ||
876 | kfree(pr); | 882 | kfree(pr); |
877 | 883 | ||
878 | return 0; | 884 | return 0; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 5f8d746a9b81..66a9d8145562 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/pm_qos_params.h> | 41 | #include <linux/pm_qos_params.h> |
42 | #include <linux/clockchips.h> | 42 | #include <linux/clockchips.h> |
43 | #include <linux/cpuidle.h> | 43 | #include <linux/cpuidle.h> |
44 | #include <linux/irqflags.h> | ||
44 | 45 | ||
45 | /* | 46 | /* |
46 | * Include the apic definitions for x86 to have the APIC timer related defines | 47 | * Include the apic definitions for x86 to have the APIC timer related defines |
@@ -374,15 +375,15 @@ static int tsc_halts_in_c(int state) | |||
374 | { | 375 | { |
375 | switch (boot_cpu_data.x86_vendor) { | 376 | switch (boot_cpu_data.x86_vendor) { |
376 | case X86_VENDOR_AMD: | 377 | case X86_VENDOR_AMD: |
378 | case X86_VENDOR_INTEL: | ||
377 | /* | 379 | /* |
378 | * AMD Fam10h TSC will tick in all | 380 | * AMD Fam10h TSC will tick in all |
379 | * C/P/S0/S1 states when this bit is set. | 381 | * C/P/S0/S1 states when this bit is set. |
380 | */ | 382 | */ |
381 | if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) | 383 | if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
382 | return 0; | 384 | return 0; |
385 | |||
383 | /*FALL THROUGH*/ | 386 | /*FALL THROUGH*/ |
384 | case X86_VENDOR_INTEL: | ||
385 | /* Several cases known where TSC halts in C2 too */ | ||
386 | default: | 387 | default: |
387 | return state > ACPI_STATE_C1; | 388 | return state > ACPI_STATE_C1; |
388 | } | 389 | } |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 0d7b772bef50..846e227592d4 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -588,12 +588,15 @@ int acpi_processor_preregister_performance( | |||
588 | int count, count_target; | 588 | int count, count_target; |
589 | int retval = 0; | 589 | int retval = 0; |
590 | unsigned int i, j; | 590 | unsigned int i, j; |
591 | cpumask_t covered_cpus; | 591 | cpumask_var_t covered_cpus; |
592 | struct acpi_processor *pr; | 592 | struct acpi_processor *pr; |
593 | struct acpi_psd_package *pdomain; | 593 | struct acpi_psd_package *pdomain; |
594 | struct acpi_processor *match_pr; | 594 | struct acpi_processor *match_pr; |
595 | struct acpi_psd_package *match_pdomain; | 595 | struct acpi_psd_package *match_pdomain; |
596 | 596 | ||
597 | if (!alloc_cpumask_var(&covered_cpus, GFP_KERNEL)) | ||
598 | return -ENOMEM; | ||
599 | |||
597 | mutex_lock(&performance_mutex); | 600 | mutex_lock(&performance_mutex); |
598 | 601 | ||
599 | retval = 0; | 602 | retval = 0; |
@@ -617,7 +620,7 @@ int acpi_processor_preregister_performance( | |||
617 | } | 620 | } |
618 | 621 | ||
619 | pr->performance = percpu_ptr(performance, i); | 622 | pr->performance = percpu_ptr(performance, i); |
620 | cpu_set(i, pr->performance->shared_cpu_map); | 623 | cpumask_set_cpu(i, pr->performance->shared_cpu_map); |
621 | if (acpi_processor_get_psd(pr)) { | 624 | if (acpi_processor_get_psd(pr)) { |
622 | retval = -EINVAL; | 625 | retval = -EINVAL; |
623 | continue; | 626 | continue; |
@@ -650,18 +653,18 @@ int acpi_processor_preregister_performance( | |||
650 | } | 653 | } |
651 | } | 654 | } |
652 | 655 | ||
653 | cpus_clear(covered_cpus); | 656 | cpumask_clear(covered_cpus); |
654 | for_each_possible_cpu(i) { | 657 | for_each_possible_cpu(i) { |
655 | pr = per_cpu(processors, i); | 658 | pr = per_cpu(processors, i); |
656 | if (!pr) | 659 | if (!pr) |
657 | continue; | 660 | continue; |
658 | 661 | ||
659 | if (cpu_isset(i, covered_cpus)) | 662 | if (cpumask_test_cpu(i, covered_cpus)) |
660 | continue; | 663 | continue; |
661 | 664 | ||
662 | pdomain = &(pr->performance->domain_info); | 665 | pdomain = &(pr->performance->domain_info); |
663 | cpu_set(i, pr->performance->shared_cpu_map); | 666 | cpumask_set_cpu(i, pr->performance->shared_cpu_map); |
664 | cpu_set(i, covered_cpus); | 667 | cpumask_set_cpu(i, covered_cpus); |
665 | if (pdomain->num_processors <= 1) | 668 | if (pdomain->num_processors <= 1) |
666 | continue; | 669 | continue; |
667 | 670 | ||
@@ -699,8 +702,8 @@ int acpi_processor_preregister_performance( | |||
699 | goto err_ret; | 702 | goto err_ret; |
700 | } | 703 | } |
701 | 704 | ||
702 | cpu_set(j, covered_cpus); | 705 | cpumask_set_cpu(j, covered_cpus); |
703 | cpu_set(j, pr->performance->shared_cpu_map); | 706 | cpumask_set_cpu(j, pr->performance->shared_cpu_map); |
704 | count++; | 707 | count++; |
705 | } | 708 | } |
706 | 709 | ||
@@ -718,8 +721,8 @@ int acpi_processor_preregister_performance( | |||
718 | 721 | ||
719 | match_pr->performance->shared_type = | 722 | match_pr->performance->shared_type = |
720 | pr->performance->shared_type; | 723 | pr->performance->shared_type; |
721 | match_pr->performance->shared_cpu_map = | 724 | cpumask_copy(match_pr->performance->shared_cpu_map, |
722 | pr->performance->shared_cpu_map; | 725 | pr->performance->shared_cpu_map); |
723 | } | 726 | } |
724 | } | 727 | } |
725 | 728 | ||
@@ -731,14 +734,15 @@ err_ret: | |||
731 | 734 | ||
732 | /* Assume no coordination on any error parsing domain info */ | 735 | /* Assume no coordination on any error parsing domain info */ |
733 | if (retval) { | 736 | if (retval) { |
734 | cpus_clear(pr->performance->shared_cpu_map); | 737 | cpumask_clear(pr->performance->shared_cpu_map); |
735 | cpu_set(i, pr->performance->shared_cpu_map); | 738 | cpumask_set_cpu(i, pr->performance->shared_cpu_map); |
736 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; | 739 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; |
737 | } | 740 | } |
738 | pr->performance = NULL; /* Will be set for real in register */ | 741 | pr->performance = NULL; /* Will be set for real in register */ |
739 | } | 742 | } |
740 | 743 | ||
741 | mutex_unlock(&performance_mutex); | 744 | mutex_unlock(&performance_mutex); |
745 | free_cpumask_var(covered_cpus); | ||
742 | return retval; | 746 | return retval; |
743 | } | 747 | } |
744 | EXPORT_SYMBOL(acpi_processor_preregister_performance); | 748 | EXPORT_SYMBOL(acpi_processor_preregister_performance); |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index a0c38c94a8a0..d27838171f4a 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -61,11 +61,14 @@ static int acpi_processor_update_tsd_coord(void) | |||
61 | int count, count_target; | 61 | int count, count_target; |
62 | int retval = 0; | 62 | int retval = 0; |
63 | unsigned int i, j; | 63 | unsigned int i, j; |
64 | cpumask_t covered_cpus; | 64 | cpumask_var_t covered_cpus; |
65 | struct acpi_processor *pr, *match_pr; | 65 | struct acpi_processor *pr, *match_pr; |
66 | struct acpi_tsd_package *pdomain, *match_pdomain; | 66 | struct acpi_tsd_package *pdomain, *match_pdomain; |
67 | struct acpi_processor_throttling *pthrottling, *match_pthrottling; | 67 | struct acpi_processor_throttling *pthrottling, *match_pthrottling; |
68 | 68 | ||
69 | if (!alloc_cpumask_var(&covered_cpus, GFP_KERNEL)) | ||
70 | return -ENOMEM; | ||
71 | |||
69 | /* | 72 | /* |
70 | * Now that we have _TSD data from all CPUs, lets setup T-state | 73 | * Now that we have _TSD data from all CPUs, lets setup T-state |
71 | * coordination between all CPUs. | 74 | * coordination between all CPUs. |
@@ -91,19 +94,19 @@ static int acpi_processor_update_tsd_coord(void) | |||
91 | if (retval) | 94 | if (retval) |
92 | goto err_ret; | 95 | goto err_ret; |
93 | 96 | ||
94 | cpus_clear(covered_cpus); | 97 | cpumask_clear(covered_cpus); |
95 | for_each_possible_cpu(i) { | 98 | for_each_possible_cpu(i) { |
96 | pr = per_cpu(processors, i); | 99 | pr = per_cpu(processors, i); |
97 | if (!pr) | 100 | if (!pr) |
98 | continue; | 101 | continue; |
99 | 102 | ||
100 | if (cpu_isset(i, covered_cpus)) | 103 | if (cpumask_test_cpu(i, covered_cpus)) |
101 | continue; | 104 | continue; |
102 | pthrottling = &pr->throttling; | 105 | pthrottling = &pr->throttling; |
103 | 106 | ||
104 | pdomain = &(pthrottling->domain_info); | 107 | pdomain = &(pthrottling->domain_info); |
105 | cpu_set(i, pthrottling->shared_cpu_map); | 108 | cpumask_set_cpu(i, pthrottling->shared_cpu_map); |
106 | cpu_set(i, covered_cpus); | 109 | cpumask_set_cpu(i, covered_cpus); |
107 | /* | 110 | /* |
108 | * If the number of processor in the TSD domain is 1, it is | 111 | * If the number of processor in the TSD domain is 1, it is |
109 | * unnecessary to parse the coordination for this CPU. | 112 | * unnecessary to parse the coordination for this CPU. |
@@ -144,8 +147,8 @@ static int acpi_processor_update_tsd_coord(void) | |||
144 | goto err_ret; | 147 | goto err_ret; |
145 | } | 148 | } |
146 | 149 | ||
147 | cpu_set(j, covered_cpus); | 150 | cpumask_set_cpu(j, covered_cpus); |
148 | cpu_set(j, pthrottling->shared_cpu_map); | 151 | cpumask_set_cpu(j, pthrottling->shared_cpu_map); |
149 | count++; | 152 | count++; |
150 | } | 153 | } |
151 | for_each_possible_cpu(j) { | 154 | for_each_possible_cpu(j) { |
@@ -165,12 +168,14 @@ static int acpi_processor_update_tsd_coord(void) | |||
165 | * If some CPUS have the same domain, they | 168 | * If some CPUS have the same domain, they |
166 | * will have the same shared_cpu_map. | 169 | * will have the same shared_cpu_map. |
167 | */ | 170 | */ |
168 | match_pthrottling->shared_cpu_map = | 171 | cpumask_copy(match_pthrottling->shared_cpu_map, |
169 | pthrottling->shared_cpu_map; | 172 | pthrottling->shared_cpu_map); |
170 | } | 173 | } |
171 | } | 174 | } |
172 | 175 | ||
173 | err_ret: | 176 | err_ret: |
177 | free_cpumask_var(covered_cpus); | ||
178 | |||
174 | for_each_possible_cpu(i) { | 179 | for_each_possible_cpu(i) { |
175 | pr = per_cpu(processors, i); | 180 | pr = per_cpu(processors, i); |
176 | if (!pr) | 181 | if (!pr) |
@@ -182,8 +187,8 @@ err_ret: | |||
182 | */ | 187 | */ |
183 | if (retval) { | 188 | if (retval) { |
184 | pthrottling = &(pr->throttling); | 189 | pthrottling = &(pr->throttling); |
185 | cpus_clear(pthrottling->shared_cpu_map); | 190 | cpumask_clear(pthrottling->shared_cpu_map); |
186 | cpu_set(i, pthrottling->shared_cpu_map); | 191 | cpumask_set_cpu(i, pthrottling->shared_cpu_map); |
187 | pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL; | 192 | pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL; |
188 | } | 193 | } |
189 | } | 194 | } |
@@ -567,7 +572,7 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr) | |||
567 | pthrottling = &pr->throttling; | 572 | pthrottling = &pr->throttling; |
568 | pthrottling->tsd_valid_flag = 1; | 573 | pthrottling->tsd_valid_flag = 1; |
569 | pthrottling->shared_type = pdomain->coord_type; | 574 | pthrottling->shared_type = pdomain->coord_type; |
570 | cpu_set(pr->id, pthrottling->shared_cpu_map); | 575 | cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map); |
571 | /* | 576 | /* |
572 | * If the coordination type is not defined in ACPI spec, | 577 | * If the coordination type is not defined in ACPI spec, |
573 | * the tsd_valid_flag will be clear and coordination type | 578 | * the tsd_valid_flag will be clear and coordination type |
@@ -826,7 +831,7 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
826 | 831 | ||
827 | static int acpi_processor_get_throttling(struct acpi_processor *pr) | 832 | static int acpi_processor_get_throttling(struct acpi_processor *pr) |
828 | { | 833 | { |
829 | cpumask_t saved_mask; | 834 | cpumask_var_t saved_mask; |
830 | int ret; | 835 | int ret; |
831 | 836 | ||
832 | if (!pr) | 837 | if (!pr) |
@@ -834,14 +839,20 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) | |||
834 | 839 | ||
835 | if (!pr->flags.throttling) | 840 | if (!pr->flags.throttling) |
836 | return -ENODEV; | 841 | return -ENODEV; |
842 | |||
843 | if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL)) | ||
844 | return -ENOMEM; | ||
845 | |||
837 | /* | 846 | /* |
838 | * Migrate task to the cpu pointed by pr. | 847 | * Migrate task to the cpu pointed by pr. |
839 | */ | 848 | */ |
840 | saved_mask = current->cpus_allowed; | 849 | cpumask_copy(saved_mask, ¤t->cpus_allowed); |
841 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id)); | 850 | /* FIXME: use work_on_cpu() */ |
851 | set_cpus_allowed_ptr(current, cpumask_of(pr->id)); | ||
842 | ret = pr->throttling.acpi_processor_get_throttling(pr); | 852 | ret = pr->throttling.acpi_processor_get_throttling(pr); |
843 | /* restore the previous state */ | 853 | /* restore the previous state */ |
844 | set_cpus_allowed_ptr(current, &saved_mask); | 854 | set_cpus_allowed_ptr(current, saved_mask); |
855 | free_cpumask_var(saved_mask); | ||
845 | 856 | ||
846 | return ret; | 857 | return ret; |
847 | } | 858 | } |
@@ -986,13 +997,13 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
986 | 997 | ||
987 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | 998 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) |
988 | { | 999 | { |
989 | cpumask_t saved_mask; | 1000 | cpumask_var_t saved_mask; |
990 | int ret = 0; | 1001 | int ret = 0; |
991 | unsigned int i; | 1002 | unsigned int i; |
992 | struct acpi_processor *match_pr; | 1003 | struct acpi_processor *match_pr; |
993 | struct acpi_processor_throttling *p_throttling; | 1004 | struct acpi_processor_throttling *p_throttling; |
994 | struct throttling_tstate t_state; | 1005 | struct throttling_tstate t_state; |
995 | cpumask_t online_throttling_cpus; | 1006 | cpumask_var_t online_throttling_cpus; |
996 | 1007 | ||
997 | if (!pr) | 1008 | if (!pr) |
998 | return -EINVAL; | 1009 | return -EINVAL; |
@@ -1003,17 +1014,25 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1003 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) | 1014 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) |
1004 | return -EINVAL; | 1015 | return -EINVAL; |
1005 | 1016 | ||
1006 | saved_mask = current->cpus_allowed; | 1017 | if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL)) |
1018 | return -ENOMEM; | ||
1019 | |||
1020 | if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) { | ||
1021 | free_cpumask_var(saved_mask); | ||
1022 | return -ENOMEM; | ||
1023 | } | ||
1024 | |||
1025 | cpumask_copy(saved_mask, ¤t->cpus_allowed); | ||
1007 | t_state.target_state = state; | 1026 | t_state.target_state = state; |
1008 | p_throttling = &(pr->throttling); | 1027 | p_throttling = &(pr->throttling); |
1009 | cpus_and(online_throttling_cpus, cpu_online_map, | 1028 | cpumask_and(online_throttling_cpus, cpu_online_mask, |
1010 | p_throttling->shared_cpu_map); | 1029 | p_throttling->shared_cpu_map); |
1011 | /* | 1030 | /* |
1012 | * The throttling notifier will be called for every | 1031 | * The throttling notifier will be called for every |
1013 | * affected cpu in order to get one proper T-state. | 1032 | * affected cpu in order to get one proper T-state. |
1014 | * The notifier event is THROTTLING_PRECHANGE. | 1033 | * The notifier event is THROTTLING_PRECHANGE. |
1015 | */ | 1034 | */ |
1016 | for_each_cpu_mask_nr(i, online_throttling_cpus) { | 1035 | for_each_cpu(i, online_throttling_cpus) { |
1017 | t_state.cpu = i; | 1036 | t_state.cpu = i; |
1018 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, | 1037 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, |
1019 | &t_state); | 1038 | &t_state); |
@@ -1025,7 +1044,8 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1025 | * it can be called only for the cpu pointed by pr. | 1044 | * it can be called only for the cpu pointed by pr. |
1026 | */ | 1045 | */ |
1027 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { | 1046 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { |
1028 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id)); | 1047 | /* FIXME: use work_on_cpu() */ |
1048 | set_cpus_allowed_ptr(current, cpumask_of(pr->id)); | ||
1029 | ret = p_throttling->acpi_processor_set_throttling(pr, | 1049 | ret = p_throttling->acpi_processor_set_throttling(pr, |
1030 | t_state.target_state); | 1050 | t_state.target_state); |
1031 | } else { | 1051 | } else { |
@@ -1034,7 +1054,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1034 | * it is necessary to set T-state for every affected | 1054 | * it is necessary to set T-state for every affected |
1035 | * cpus. | 1055 | * cpus. |
1036 | */ | 1056 | */ |
1037 | for_each_cpu_mask_nr(i, online_throttling_cpus) { | 1057 | for_each_cpu(i, online_throttling_cpus) { |
1038 | match_pr = per_cpu(processors, i); | 1058 | match_pr = per_cpu(processors, i); |
1039 | /* | 1059 | /* |
1040 | * If the pointer is invalid, we will report the | 1060 | * If the pointer is invalid, we will report the |
@@ -1056,7 +1076,8 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1056 | continue; | 1076 | continue; |
1057 | } | 1077 | } |
1058 | t_state.cpu = i; | 1078 | t_state.cpu = i; |
1059 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(i)); | 1079 | /* FIXME: use work_on_cpu() */ |
1080 | set_cpus_allowed_ptr(current, cpumask_of(i)); | ||
1060 | ret = match_pr->throttling. | 1081 | ret = match_pr->throttling. |
1061 | acpi_processor_set_throttling( | 1082 | acpi_processor_set_throttling( |
1062 | match_pr, t_state.target_state); | 1083 | match_pr, t_state.target_state); |
@@ -1068,13 +1089,16 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1068 | * affected cpu to update the T-states. | 1089 | * affected cpu to update the T-states. |
1069 | * The notifier event is THROTTLING_POSTCHANGE | 1090 | * The notifier event is THROTTLING_POSTCHANGE |
1070 | */ | 1091 | */ |
1071 | for_each_cpu_mask_nr(i, online_throttling_cpus) { | 1092 | for_each_cpu(i, online_throttling_cpus) { |
1072 | t_state.cpu = i; | 1093 | t_state.cpu = i; |
1073 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, | 1094 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, |
1074 | &t_state); | 1095 | &t_state); |
1075 | } | 1096 | } |
1076 | /* restore the previous state */ | 1097 | /* restore the previous state */ |
1077 | set_cpus_allowed_ptr(current, &saved_mask); | 1098 | /* FIXME: use work_on_cpu() */ |
1099 | set_cpus_allowed_ptr(current, saved_mask); | ||
1100 | free_cpumask_var(online_throttling_cpus); | ||
1101 | free_cpumask_var(saved_mask); | ||
1078 | return ret; | 1102 | return ret; |
1079 | } | 1103 | } |
1080 | 1104 | ||
@@ -1120,7 +1144,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
1120 | if (acpi_processor_get_tsd(pr)) { | 1144 | if (acpi_processor_get_tsd(pr)) { |
1121 | pthrottling = &pr->throttling; | 1145 | pthrottling = &pr->throttling; |
1122 | pthrottling->tsd_valid_flag = 0; | 1146 | pthrottling->tsd_valid_flag = 0; |
1123 | cpu_set(pr->id, pthrottling->shared_cpu_map); | 1147 | cpumask_set_cpu(pr->id, pthrottling->shared_cpu_map); |
1124 | pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL; | 1148 | pthrottling->shared_type = DOMAIN_COORD_TYPE_SW_ALL; |
1125 | } | 1149 | } |
1126 | 1150 | ||