Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm+acpi-3.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management fixes from Rafael Wysocki:
"A bunch of regression fixes this time. They fix two regressions in
the PNP subsystem, one in the ACPI processor driver and one in the
ACPI EC driver, four cpufreq driver regressions and an unrelated bug
in one of the drivers. The regressions are recent or introduced in
3.14.

Specifics:

- There are two bugs in the ACPI PNP core that cause errors to be
returned if optional ACPI methods are not present. After an ACPI
core change made in 3.14 one of those errors leads to serial port
suspend failures on some systems. Fix from Rafael J Wysocki.

- A recently added PNP quirk related to Intel chipsets intorduced a
build error in unusual configurations (PNP without PCI). Fix from
Bjorn Helgaas.

- An ACPI EC workaround related to system suspend on Samsung machines
added in 3.14 introduced a race causing some valid EC events to be
discarded. Fix from Kieran Clancy.

- The acpi-cpufreq driver fails to load on some systems after a 3.14
commit related to APIC ID parsing that overlooked one corner case.
Fix from Lan Tianyu.

- Fix for a recently introduced build problem in the ppc-corenet
cpufreq driver from Tim Gardner.

- A recent cpufreq core change to ensure serialization of frequency
transitions for drivers with a ->target_index() callback overlooked
the fact that some of those drivers had been doing operations
introduced by it into the core already by themselves. That
resulted in a mess in which the core and the drivers try to do the
same thing and block each other which leads to deadlocks. Fixes
for the powernow-k7, powernow-k6, and longhaul cpufreq drivers from
Srivatsa S Bhat.

- Fix for a computational error in the powernow-k6 cpufreq driver
from Srivatsa S Bhat"

* tag 'pm+acpi-3.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI / processor: Fix failure of loading acpi-cpufreq driver
PNP / ACPI: Do not return errors if _DIS or _SRS are not present
PNP: Fix compile error in quirks.c
ACPI / EC: Process rather than discard events in acpi_ec_clear
cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error
cpufreq: powernow-k7: Fix double invocation of cpufreq_freq_transition_begin/end
cpufreq: powernow-k6: Fix double invocation of cpufreq_freq_transition_begin/end
cpufreq: powernow-k6: Fix incorrect comparison with max_multipler
cpufreq: longhaul: Fix double invocation of cpufreq_freq_transition_begin/end

+85 -59
+4 -3
drivers/acpi/acpi_processor.c
··· 170 170 acpi_status status; 171 171 int ret; 172 172 173 + if (pr->apic_id == -1) 174 + return -ENODEV; 175 + 173 176 status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta); 174 177 if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) 175 178 return -ENODEV; ··· 263 260 } 264 261 265 262 apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); 266 - if (apic_id < 0) { 263 + if (apic_id < 0) 267 264 acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); 268 - return -ENODEV; 269 - } 270 265 pr->apic_id = apic_id; 271 266 272 267 cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
+12 -9
drivers/acpi/ec.c
··· 206 206 spin_unlock_irqrestore(&ec->lock, flags); 207 207 } 208 208 209 - static int acpi_ec_sync_query(struct acpi_ec *ec); 209 + static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); 210 210 211 211 static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) 212 212 { 213 213 if (state & ACPI_EC_FLAG_SCI) { 214 214 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) 215 - return acpi_ec_sync_query(ec); 215 + return acpi_ec_sync_query(ec, NULL); 216 216 } 217 217 return 0; 218 218 } ··· 443 443 444 444 EXPORT_SYMBOL(ec_get_handle); 445 445 446 - static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data); 447 - 448 446 /* 449 - * Clears stale _Q events that might have accumulated in the EC. 447 + * Process _Q events that might have accumulated in the EC. 450 448 * Run with locked ec mutex. 451 449 */ 452 450 static void acpi_ec_clear(struct acpi_ec *ec) ··· 453 455 u8 value = 0; 454 456 455 457 for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) { 456 - status = acpi_ec_query_unlocked(ec, &value); 458 + status = acpi_ec_sync_query(ec, &value); 457 459 if (status || !value) 458 460 break; 459 461 } ··· 580 582 kfree(handler); 581 583 } 582 584 583 - static int acpi_ec_sync_query(struct acpi_ec *ec) 585 + static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data) 584 586 { 585 587 u8 value = 0; 586 588 int status; 587 589 struct acpi_ec_query_handler *handler, *copy; 588 - if ((status = acpi_ec_query_unlocked(ec, &value))) 590 + 591 + status = acpi_ec_query_unlocked(ec, &value); 592 + if (data) 593 + *data = value; 594 + if (status) 589 595 return status; 596 + 590 597 list_for_each_entry(handler, &ec->list, node) { 591 598 if (value == handler->query_bit) { 592 599 /* have custom handler for this bit */ ··· 615 612 if (!ec) 616 613 return; 617 614 mutex_lock(&ec->mutex); 618 - acpi_ec_sync_query(ec); 615 + acpi_ec_sync_query(ec, NULL); 619 616 mutex_unlock(&ec->mutex); 620 617 } 621 618
+24 -12
drivers/cpufreq/longhaul.c
··· 242 242 * Sets a new clock ratio. 243 243 */ 244 244 245 - static void longhaul_setstate(struct cpufreq_policy *policy, 245 + static int longhaul_setstate(struct cpufreq_policy *policy, 246 246 unsigned int table_index) 247 247 { 248 248 unsigned int mults_index; ··· 258 258 /* Safety precautions */ 259 259 mult = mults[mults_index & 0x1f]; 260 260 if (mult == -1) 261 - return; 261 + return -EINVAL; 262 + 262 263 speed = calc_speed(mult); 263 264 if ((speed > highest_speed) || (speed < lowest_speed)) 264 - return; 265 + return -EINVAL; 266 + 265 267 /* Voltage transition before frequency transition? */ 266 268 if (can_scale_voltage && longhaul_index < table_index) 267 269 dir = 1; 268 270 269 271 freqs.old = calc_speed(longhaul_get_cpu_mult()); 270 272 freqs.new = speed; 271 - 272 - cpufreq_freq_transition_begin(policy, &freqs); 273 273 274 274 pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", 275 275 fsb, mult/10, mult%10, print_speed(speed/1000)); ··· 385 385 goto retry_loop; 386 386 } 387 387 } 388 - /* Report true CPU frequency */ 389 - cpufreq_freq_transition_end(policy, &freqs, 0); 390 388 391 - if (!bm_timeout) 389 + if (!bm_timeout) { 392 390 printk(KERN_INFO PFX "Warning: Timeout while waiting for " 393 391 "idle PCI bus.\n"); 392 + return -EBUSY; 393 + } 394 + 395 + return 0; 394 396 } 395 397 396 398 /* ··· 633 631 unsigned int i; 634 632 unsigned int dir = 0; 635 633 u8 vid, current_vid; 634 + int retval = 0; 636 635 637 636 if (!can_scale_voltage) 638 - longhaul_setstate(policy, table_index); 637 + retval = longhaul_setstate(policy, table_index); 639 638 else { 640 639 /* On test system voltage transitions exceeding single 641 640 * step up or down were turning motherboard off. Both ··· 651 648 while (i != table_index) { 652 649 vid = (longhaul_table[i].driver_data >> 8) & 0x1f; 653 650 if (vid != current_vid) { 654 - longhaul_setstate(policy, i); 651 + retval = longhaul_setstate(policy, i); 655 652 current_vid = vid; 656 653 msleep(200); 657 654 } ··· 660 657 else 661 658 i--; 662 659 } 663 - longhaul_setstate(policy, table_index); 660 + retval = longhaul_setstate(policy, table_index); 664 661 } 662 + 665 663 longhaul_index = table_index; 666 - return 0; 664 + return retval; 667 665 } 668 666 669 667 ··· 972 968 973 969 for (i = 0; i < numscales; i++) { 974 970 if (mults[i] == maxmult) { 971 + struct cpufreq_freqs freqs; 972 + 973 + freqs.old = policy->cur; 974 + freqs.new = longhaul_table[i].frequency; 975 + freqs.flags = 0; 976 + 977 + cpufreq_freq_transition_begin(policy, &freqs); 975 978 longhaul_setstate(policy, i); 979 + cpufreq_freq_transition_end(policy, &freqs, 0); 976 980 break; 977 981 } 978 982 }
+13 -10
drivers/cpufreq/powernow-k6.c
··· 138 138 static int powernow_k6_target(struct cpufreq_policy *policy, 139 139 unsigned int best_i) 140 140 { 141 - struct cpufreq_freqs freqs; 142 141 143 142 if (clock_ratio[best_i].driver_data > max_multiplier) { 144 143 printk(KERN_ERR PFX "invalid target frequency\n"); 145 144 return -EINVAL; 146 145 } 147 146 148 - freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); 149 - freqs.new = busfreq * clock_ratio[best_i].driver_data; 150 - 151 - cpufreq_freq_transition_begin(policy, &freqs); 152 - 153 147 powernow_k6_set_cpu_multiplier(best_i); 154 - 155 - cpufreq_freq_transition_end(policy, &freqs, 0); 156 148 157 149 return 0; 158 150 } ··· 219 227 static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) 220 228 { 221 229 unsigned int i; 222 - for (i = 0; i < 8; i++) { 223 - if (i == max_multiplier) 230 + 231 + for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { 232 + if (clock_ratio[i].driver_data == max_multiplier) { 233 + struct cpufreq_freqs freqs; 234 + 235 + freqs.old = policy->cur; 236 + freqs.new = clock_ratio[i].frequency; 237 + freqs.flags = 0; 238 + 239 + cpufreq_freq_transition_begin(policy, &freqs); 224 240 powernow_k6_target(policy, i); 241 + cpufreq_freq_transition_end(policy, &freqs, 0); 242 + break; 243 + } 225 244 } 226 245 return 0; 227 246 }
-4
drivers/cpufreq/powernow-k7.c
··· 269 269 270 270 freqs.new = powernow_table[index].frequency; 271 271 272 - cpufreq_freq_transition_begin(policy, &freqs); 273 - 274 272 /* Now do the magic poking into the MSRs. */ 275 273 276 274 if (have_a0 == 1) /* A0 errata 5 */ ··· 287 289 288 290 if (have_a0 == 1) 289 291 local_irq_enable(); 290 - 291 - cpufreq_freq_transition_end(policy, &freqs, 0); 292 292 293 293 return 0; 294 294 }
+4 -1
drivers/cpufreq/ppc-corenet-cpufreq.c
··· 138 138 struct cpufreq_frequency_table *table; 139 139 struct cpu_data *data; 140 140 unsigned int cpu = policy->cpu; 141 + u64 transition_latency_hz; 141 142 142 143 np = of_get_cpu_node(cpu, NULL); 143 144 if (!np) ··· 206 205 for_each_cpu(i, per_cpu(cpu_mask, cpu)) 207 206 per_cpu(cpu_data, i) = data; 208 207 208 + transition_latency_hz = 12ULL * NSEC_PER_SEC; 209 209 policy->cpuinfo.transition_latency = 210 - (12ULL * NSEC_PER_SEC) / fsl_get_sys_freq(); 210 + do_div(transition_latency_hz, fsl_get_sys_freq()); 211 + 211 212 of_node_put(np); 212 213 213 214 return 0;
+26 -18
drivers/pnp/pnpacpi/core.c
··· 83 83 { 84 84 struct acpi_device *acpi_dev; 85 85 acpi_handle handle; 86 - struct acpi_buffer buffer; 87 - int ret; 86 + int ret = 0; 88 87 89 88 pnp_dbg(&dev->dev, "set resources\n"); 90 89 ··· 96 97 if (WARN_ON_ONCE(acpi_dev != dev->data)) 97 98 dev->data = acpi_dev; 98 99 99 - ret = pnpacpi_build_resource_template(dev, &buffer); 100 - if (ret) 101 - return ret; 102 - ret = pnpacpi_encode_resources(dev, &buffer); 103 - if (ret) { 100 + if (acpi_has_method(handle, METHOD_NAME__SRS)) { 101 + struct acpi_buffer buffer; 102 + 103 + ret = pnpacpi_build_resource_template(dev, &buffer); 104 + if (ret) 105 + return ret; 106 + 107 + ret = pnpacpi_encode_resources(dev, &buffer); 108 + if (!ret) { 109 + acpi_status status; 110 + 111 + status = acpi_set_current_resources(handle, &buffer); 112 + if (ACPI_FAILURE(status)) 113 + ret = -EIO; 114 + } 104 115 kfree(buffer.pointer); 105 - return ret; 106 116 } 107 - if (ACPI_FAILURE(acpi_set_current_resources(handle, &buffer))) 108 - ret = -EINVAL; 109 - else if (acpi_bus_power_manageable(handle)) 117 + if (!ret && acpi_bus_power_manageable(handle)) 110 118 ret = acpi_bus_set_power(handle, ACPI_STATE_D0); 111 - kfree(buffer.pointer); 119 + 112 120 return ret; 113 121 } 114 122 ··· 123 117 { 124 118 struct acpi_device *acpi_dev; 125 119 acpi_handle handle; 126 - int ret; 120 + acpi_status status; 127 121 128 122 dev_dbg(&dev->dev, "disable resources\n"); 129 123 ··· 134 128 } 135 129 136 130 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ 137 - ret = 0; 138 131 if (acpi_bus_power_manageable(handle)) 139 132 acpi_bus_set_power(handle, ACPI_STATE_D3_COLD); 140 - /* continue even if acpi_bus_set_power() fails */ 141 - if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL))) 142 - ret = -ENODEV; 143 - return ret; 133 + 134 + /* continue even if acpi_bus_set_power() fails */ 135 + status = acpi_evaluate_object(handle, "_DIS", NULL, NULL); 136 + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) 137 + return -ENODEV; 138 + 139 + return 0; 144 140 } 145 141 146 142 #ifdef CONFIG_ACPI_SLEEP
+2 -2
drivers/pnp/quirks.c
··· 335 335 } 336 336 #endif 337 337 338 - #ifdef CONFIG_X86 338 + #ifdef CONFIG_PCI 339 339 /* Device IDs of parts that have 32KB MCH space */ 340 340 static const unsigned int mch_quirk_devices[] = { 341 341 0x0154, /* Ivy Bridge */ ··· 440 440 #ifdef CONFIG_AMD_NB 441 441 {"PNP0c01", quirk_amd_mmconfig_area}, 442 442 #endif 443 - #ifdef CONFIG_X86 443 + #ifdef CONFIG_PCI 444 444 {"PNP0c02", quirk_intel_mch}, 445 445 #endif 446 446 {""}