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

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

Pull power management fixes from Rafael Wysocki:
"These fix a potential regression introduced during the 4.3 cycle
(generic power domains framework), a nasty bug that has been present
forever (power capping RAPL driver), a build issue (Tegra cpufreq
driver) and a minor ugliness introduced recently (intel_pstate).

Specifics:

- Fix a potential regression in the generic power domains framework
introduced during the 4.3 development cycle that may lead to
spurious failures of system suspend in certain situations (Ulf
Hansson).

- Fix a problem in the power capping RAPL (Running Average Power
Limits) driver that causes it to initialize successfully on some
systems where it is not supposed to do that which is due to an
incorrect check in an initialization routine (Prarit Bhargava).

- Fix a build problem in the cpufreq Tegra driver that depends on the
regulator framework, but that dependency is not reflected in
Kconfig (Arnd Bergmann).

- Fix a recent mistake in the intel_pstate driver where a numeric
constant is used directly instead of a symbol defined specifically
for the case in question (Prarit Bhargava)"

* tag 'pm+acpi-4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
powercap / RAPL: fix BIOS lock check
cpufreq: intel_pstate: Minor cleanup for FRAC_BITS
cpufreq: tegra: add regulator dependency for T124
PM / Domains: Allow runtime PM callbacks to be re-used during system PM

+29 -15
+22 -11
drivers/base/power/domain.c
··· 390 390 struct generic_pm_domain *genpd; 391 391 bool (*stop_ok)(struct device *__dev); 392 392 struct gpd_timing_data *td = &dev_gpd_data(dev)->td; 393 + bool runtime_pm = pm_runtime_enabled(dev); 393 394 ktime_t time_start; 394 395 s64 elapsed_ns; 395 396 int ret; ··· 401 400 if (IS_ERR(genpd)) 402 401 return -EINVAL; 403 402 403 + /* 404 + * A runtime PM centric subsystem/driver may re-use the runtime PM 405 + * callbacks for other purposes than runtime PM. In those scenarios 406 + * runtime PM is disabled. Under these circumstances, we shall skip 407 + * validating/measuring the PM QoS latency. 408 + */ 404 409 stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL; 405 - if (stop_ok && !stop_ok(dev)) 410 + if (runtime_pm && stop_ok && !stop_ok(dev)) 406 411 return -EBUSY; 407 412 408 413 /* Measure suspend latency. */ 409 - time_start = ktime_get(); 414 + if (runtime_pm) 415 + time_start = ktime_get(); 410 416 411 417 ret = genpd_save_dev(genpd, dev); 412 418 if (ret) ··· 426 418 } 427 419 428 420 /* Update suspend latency value if the measured time exceeds it. */ 429 - elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); 430 - if (elapsed_ns > td->suspend_latency_ns) { 431 - td->suspend_latency_ns = elapsed_ns; 432 - dev_dbg(dev, "suspend latency exceeded, %lld ns\n", 433 - elapsed_ns); 434 - genpd->max_off_time_changed = true; 435 - td->constraint_changed = true; 421 + if (runtime_pm) { 422 + elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); 423 + if (elapsed_ns > td->suspend_latency_ns) { 424 + td->suspend_latency_ns = elapsed_ns; 425 + dev_dbg(dev, "suspend latency exceeded, %lld ns\n", 426 + elapsed_ns); 427 + genpd->max_off_time_changed = true; 428 + td->constraint_changed = true; 429 + } 436 430 } 437 431 438 432 /* ··· 463 453 { 464 454 struct generic_pm_domain *genpd; 465 455 struct gpd_timing_data *td = &dev_gpd_data(dev)->td; 456 + bool runtime_pm = pm_runtime_enabled(dev); 466 457 ktime_t time_start; 467 458 s64 elapsed_ns; 468 459 int ret; ··· 490 479 491 480 out: 492 481 /* Measure resume latency. */ 493 - if (timed) 482 + if (timed && runtime_pm) 494 483 time_start = ktime_get(); 495 484 496 485 genpd_start_dev(genpd, dev); 497 486 genpd_restore_dev(genpd, dev); 498 487 499 488 /* Update resume latency value if the measured time exceeds it. */ 500 - if (timed) { 489 + if (timed && runtime_pm) { 501 490 elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); 502 491 if (elapsed_ns > td->resume_latency_ns) { 503 492 td->resume_latency_ns = elapsed_ns;
+1 -1
drivers/cpufreq/Kconfig.arm
··· 226 226 227 227 config ARM_TEGRA124_CPUFREQ 228 228 tristate "Tegra124 CPUFreq support" 229 - depends on ARCH_TEGRA && CPUFREQ_DT 229 + depends on ARCH_TEGRA && CPUFREQ_DT && REGULATOR 230 230 default y 231 231 help 232 232 This adds the CPUFreq driver support for Tegra124 SOCs.
+1 -1
drivers/cpufreq/intel_pstate.c
··· 1123 1123 limits->max_sysfs_pct); 1124 1124 limits->max_perf_pct = max(limits->min_policy_pct, 1125 1125 limits->max_perf_pct); 1126 - limits->max_perf = round_up(limits->max_perf, 8); 1126 + limits->max_perf = round_up(limits->max_perf, FRAC_BITS); 1127 1127 1128 1128 /* Make sure min_perf_pct <= max_perf_pct */ 1129 1129 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct);
+5 -2
drivers/powercap/intel_rapl.c
··· 1341 1341 1342 1342 for (rd = rp->domains; rd < rp->domains + rp->nr_domains; rd++) { 1343 1343 /* check if the domain is locked by BIOS */ 1344 - if (rapl_read_data_raw(rd, FW_LOCK, false, &locked)) { 1344 + ret = rapl_read_data_raw(rd, FW_LOCK, false, &locked); 1345 + if (ret) 1346 + return ret; 1347 + if (locked) { 1345 1348 pr_info("RAPL package %d domain %s locked by BIOS\n", 1346 1349 rp->id, rd->name); 1347 - rd->state |= DOMAIN_STATE_BIOS_LOCKED; 1350 + rd->state |= DOMAIN_STATE_BIOS_LOCKED; 1348 1351 } 1349 1352 } 1350 1353