Skip to content

Commit 16642a2

Browse files
committed
Merge tag 'pm-for-3.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management updates from Rafael J Wysocki: - Improved system suspend/resume and runtime PM handling for the SH TMU, CMT and MTU2 clock event devices (also used by ARM/shmobile). - Generic PM domains framework extensions related to cpuidle support and domain objects lookup using names. - ARM/shmobile power management updates including improved support for the SH7372's A4S power domain containing the CPU core. - cpufreq changes related to AMD CPUs support from Matthew Garrett, Andre Przywara and Borislav Petkov. - cpu0 cpufreq driver from Shawn Guo. - cpufreq governor fixes related to the relaxing of limit from Michal Pecio. - OMAP cpufreq updates from Axel Lin and Richard Zhao. - cpuidle ladder governor fixes related to the disabling of states from Carsten Emde and me. - Runtime PM core updates related to the interactions with the system suspend core from Alan Stern and Kevin Hilman. - Wakeup sources modification allowing more helper functions to be called from interrupt context from John Stultz and additional diagnostic code from Todd Poynor. - System suspend error code path fix from Feng Hong. Fixed up conflicts in cpufreq/powernow-k8 that stemmed from the workqueue fixes conflicting fairly badly with the removal of support for hardware P-state chips. The changes were independent but somewhat intertwined. * tag 'pm-for-3.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (76 commits) Revert "PM QoS: Use spinlock in the per-device PM QoS constraints code" PM / Runtime: let rpm_resume() succeed if RPM_ACTIVE, even when disabled, v2 cpuidle: rename function name "__cpuidle_register_driver", v2 cpufreq: OMAP: Check IS_ERR() instead of NULL for omap_device_get_by_hwmod_name cpuidle: remove some empty lines PM: Prevent runtime suspend during system resume PM QoS: Use spinlock in the per-device PM QoS constraints code PM / Sleep: use resume event when call dpm_resume_early cpuidle / ACPI : move cpuidle_device field out of the acpi_processor_power structure ACPI / processor: remove pointless variable initialization ACPI / processor: remove unused function parameter cpufreq: OMAP: remove loops_per_jiffy recalculate for smp sections: fix section conflicts in drivers/cpufreq cpufreq: conservative: update frequency when limits are relaxed cpufreq / ondemand: update frequency when limits are relaxed properly __init-annotate pm_sysrq_init() cpufreq: Add a generic cpufreq-cpu0 driver PM / OPP: Initialize OPP table from device tree ARM: add cpufreq transiton notifier to adjust loops_per_jiffy for smp cpufreq: Remove support for hardware P-state chips from powernow-k8 ...
2 parents 51562cb + b914216 commit 16642a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2061
-962
lines changed

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,14 @@ Description: Disable L3 cache indices
176176
All AMD processors with L3 caches provide this functionality.
177177
For details, see BKDGs at
178178
http://developer.amd.com/documentation/guides/Pages/default.aspx
179+
180+
181+
What: /sys/devices/system/cpu/cpufreq/boost
182+
Date: August 2012
183+
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
184+
Description: Processor frequency boosting control
185+
186+
This switch controls the boost setting for the whole system.
187+
Boosting allows the CPU and the firmware to run at a frequency
188+
beyound it's nominal limit.
189+
More details can be found in Documentation/cpu-freq/boost.txt

Documentation/cpu-freq/boost.txt

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Processor boosting control
2+
3+
- information for users -
4+
5+
Quick guide for the impatient:
6+
--------------------
7+
/sys/devices/system/cpu/cpufreq/boost
8+
controls the boost setting for the whole system. You can read and write
9+
that file with either "0" (boosting disabled) or "1" (boosting allowed).
10+
Reading or writing 1 does not mean that the system is boosting at this
11+
very moment, but only that the CPU _may_ raise the frequency at it's
12+
discretion.
13+
--------------------
14+
15+
Introduction
16+
-------------
17+
Some CPUs support a functionality to raise the operating frequency of
18+
some cores in a multi-core package if certain conditions apply, mostly
19+
if the whole chip is not fully utilized and below it's intended thermal
20+
budget. This is done without operating system control by a combination
21+
of hardware and firmware.
22+
On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core",
23+
in technical documentation "Core performance boost". In Linux we use
24+
the term "boost" for convenience.
25+
26+
Rationale for disable switch
27+
----------------------------
28+
29+
Though the idea is to just give better performance without any user
30+
intervention, sometimes the need arises to disable this functionality.
31+
Most systems offer a switch in the (BIOS) firmware to disable the
32+
functionality at all, but a more fine-grained and dynamic control would
33+
be desirable:
34+
1. While running benchmarks, reproducible results are important. Since
35+
the boosting functionality depends on the load of the whole package,
36+
single thread performance can vary. By explicitly disabling the boost
37+
functionality at least for the benchmark's run-time the system will run
38+
at a fixed frequency and results are reproducible again.
39+
2. To examine the impact of the boosting functionality it is helpful
40+
to do tests with and without boosting.
41+
3. Boosting means overclocking the processor, though under controlled
42+
conditions. By raising the frequency and the voltage the processor
43+
will consume more power than without the boosting, which may be
44+
undesirable for instance for mobile users. Disabling boosting may
45+
save power here, though this depends on the workload.
46+
47+
48+
User controlled switch
49+
----------------------
50+
51+
To allow the user to toggle the boosting functionality, the acpi-cpufreq
52+
driver exports a sysfs knob to disable it. There is a file:
53+
/sys/devices/system/cpu/cpufreq/boost
54+
which can either read "0" (boosting disabled) or "1" (boosting enabled).
55+
Reading the file is always supported, even if the processor does not
56+
support boosting. In this case the file will be read-only and always
57+
reads as "0". Explicitly changing the permissions and writing to that
58+
file anyway will return EINVAL.
59+
60+
On supported CPUs one can write either a "0" or a "1" into this file.
61+
This will either disable the boost functionality on all cores in the
62+
whole system (0) or will allow the hardware to boost at will (1).
63+
64+
Writing a "1" does not explicitly boost the system, but just allows the
65+
CPU (and the firmware) to boost at their discretion. Some implementations
66+
take external factors like the chip's temperature into account, so
67+
boosting once does not necessarily mean that it will occur every time
68+
even using the exact same software setup.
69+
70+
71+
AMD legacy cpb switch
72+
---------------------
73+
The AMD powernow-k8 driver used to support a very similar switch to
74+
disable or enable the "Core Performance Boost" feature of some AMD CPUs.
75+
This switch was instantiated in each CPU's cpufreq directory
76+
(/sys/devices/system/cpu[0-9]*/cpufreq) and was called "cpb".
77+
Though the per CPU existence hints at a more fine grained control, the
78+
actual implementation only supported a system-global switch semantics,
79+
which was simply reflected into each CPU's file. Writing a 0 or 1 into it
80+
would pull the other CPUs to the same state.
81+
For compatibility reasons this file and its behavior is still supported
82+
on AMD CPUs, though it is now protected by a config switch
83+
(X86_ACPI_CPUFREQ_CPB). On Intel CPUs this file will never be created,
84+
even with the config option set.
85+
This functionality is considered legacy and will be removed in some future
86+
kernel version.
87+
88+
More fine grained boosting control
89+
----------------------------------
90+
91+
Technically it is possible to switch the boosting functionality at least
92+
on a per package basis, for some CPUs even per core. Currently the driver
93+
does not support it, but this may be implemented in the future.

Documentation/cpuidle/sysfs.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,17 @@ total 0
7676

7777

7878
* desc : Small description about the idle state (string)
79-
* disable : Option to disable this idle state (bool)
79+
* disable : Option to disable this idle state (bool) -> see note below
8080
* latency : Latency to exit out of this idle state (in microseconds)
8181
* name : Name of the idle state (string)
8282
* power : Power consumed while in this idle state (in milliwatts)
8383
* time : Total time spent in this idle state (in microseconds)
8484
* usage : Number of times this state was entered (count)
85+
86+
Note:
87+
The behavior and the effect of the disable variable depends on the
88+
implementation of a particular governor. In the ladder governor, for
89+
example, it is not coherent, i.e. if one is disabling a light state,
90+
then all deeper states are disabled as well, but the disable variable
91+
does not reflect it. Likewise, if one enables a deep state but a lighter
92+
state still is disabled, then this has no effect.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Generic CPU0 cpufreq driver
2+
3+
It is a generic cpufreq driver for CPU0 frequency management. It
4+
supports both uniprocessor (UP) and symmetric multiprocessor (SMP)
5+
systems which share clock and voltage across all CPUs.
6+
7+
Both required and optional properties listed below must be defined
8+
under node /cpus/cpu@0.
9+
10+
Required properties:
11+
- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt
12+
for details
13+
14+
Optional properties:
15+
- clock-latency: Specify the possible maximum transition latency for clock,
16+
in unit of nanoseconds.
17+
- voltage-tolerance: Specify the CPU voltage tolerance in percentage.
18+
19+
Examples:
20+
21+
cpus {
22+
#address-cells = <1>;
23+
#size-cells = <0>;
24+
25+
cpu@0 {
26+
compatible = "arm,cortex-a9";
27+
reg = <0>;
28+
next-level-cache = <&L2>;
29+
operating-points = <
30+
/* kHz uV */
31+
792000 1100000
32+
396000 950000
33+
198000 850000
34+
>;
35+
transition-latency = <61036>; /* two CLK32 periods */
36+
};
37+
38+
cpu@1 {
39+
compatible = "arm,cortex-a9";
40+
reg = <1>;
41+
next-level-cache = <&L2>;
42+
};
43+
44+
cpu@2 {
45+
compatible = "arm,cortex-a9";
46+
reg = <2>;
47+
next-level-cache = <&L2>;
48+
};
49+
50+
cpu@3 {
51+
compatible = "arm,cortex-a9";
52+
reg = <3>;
53+
next-level-cache = <&L2>;
54+
};
55+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
* Generic OPP Interface
2+
3+
SoCs have a standard set of tuples consisting of frequency and
4+
voltage pairs that the device will support per voltage domain. These
5+
are called Operating Performance Points or OPPs.
6+
7+
Properties:
8+
- operating-points: An array of 2-tuples items, and each item consists
9+
of frequency and voltage like <freq-kHz vol-uV>.
10+
freq: clock frequency in kHz
11+
vol: voltage in microvolt
12+
13+
Examples:
14+
15+
cpu@0 {
16+
compatible = "arm,cortex-a9";
17+
reg = <0>;
18+
next-level-cache = <&L2>;
19+
operating-points = <
20+
/* kHz uV */
21+
792000 1100000
22+
396000 950000
23+
198000 850000
24+
>;
25+
};

arch/arm/kernel/smp.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/percpu.h>
2525
#include <linux/clockchips.h>
2626
#include <linux/completion.h>
27+
#include <linux/cpufreq.h>
2728

2829
#include <linux/atomic.h>
2930
#include <asm/smp.h>
@@ -650,3 +651,56 @@ int setup_profiling_timer(unsigned int multiplier)
650651
{
651652
return -EINVAL;
652653
}
654+
655+
#ifdef CONFIG_CPU_FREQ
656+
657+
static DEFINE_PER_CPU(unsigned long, l_p_j_ref);
658+
static DEFINE_PER_CPU(unsigned long, l_p_j_ref_freq);
659+
static unsigned long global_l_p_j_ref;
660+
static unsigned long global_l_p_j_ref_freq;
661+
662+
static int cpufreq_callback(struct notifier_block *nb,
663+
unsigned long val, void *data)
664+
{
665+
struct cpufreq_freqs *freq = data;
666+
int cpu = freq->cpu;
667+
668+
if (freq->flags & CPUFREQ_CONST_LOOPS)
669+
return NOTIFY_OK;
670+
671+
if (!per_cpu(l_p_j_ref, cpu)) {
672+
per_cpu(l_p_j_ref, cpu) =
673+
per_cpu(cpu_data, cpu).loops_per_jiffy;
674+
per_cpu(l_p_j_ref_freq, cpu) = freq->old;
675+
if (!global_l_p_j_ref) {
676+
global_l_p_j_ref = loops_per_jiffy;
677+
global_l_p_j_ref_freq = freq->old;
678+
}
679+
}
680+
681+
if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
682+
(val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
683+
(val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) {
684+
loops_per_jiffy = cpufreq_scale(global_l_p_j_ref,
685+
global_l_p_j_ref_freq,
686+
freq->new);
687+
per_cpu(cpu_data, cpu).loops_per_jiffy =
688+
cpufreq_scale(per_cpu(l_p_j_ref, cpu),
689+
per_cpu(l_p_j_ref_freq, cpu),
690+
freq->new);
691+
}
692+
return NOTIFY_OK;
693+
}
694+
695+
static struct notifier_block cpufreq_notifier = {
696+
.notifier_call = cpufreq_callback,
697+
};
698+
699+
static int __init register_cpufreq_notifier(void)
700+
{
701+
return cpufreq_register_notifier(&cpufreq_notifier,
702+
CPUFREQ_TRANSITION_NOTIFIER);
703+
}
704+
core_initcall(register_cpufreq_notifier);
705+
706+
#endif

arch/arm/mach-shmobile/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
# Common objects
6-
obj-y := timer.o console.o clock.o common.o
6+
obj-y := timer.o console.o clock.o
77

88
# CPU objects
99
obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o

arch/arm/mach-shmobile/board-ap4evb.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,15 @@ static struct i2c_board_info i2c1_devices[] = {
12311231
#define USCCR1 IOMEM(0xE6058144)
12321232
static void __init ap4evb_init(void)
12331233
{
1234+
struct pm_domain_device domain_devices[] = {
1235+
{ "A4LC", &lcdc1_device, },
1236+
{ "A4LC", &lcdc_device, },
1237+
{ "A4MP", &fsi_device, },
1238+
{ "A3SP", &sh_mmcif_device, },
1239+
{ "A3SP", &sdhi0_device, },
1240+
{ "A3SP", &sdhi1_device, },
1241+
{ "A4R", &ceu_device, },
1242+
};
12341243
u32 srcr4;
12351244
struct clk *clk;
12361245

@@ -1463,14 +1472,8 @@ static void __init ap4evb_init(void)
14631472

14641473
platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
14651474

1466-
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc1_device);
1467-
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device);
1468-
rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device);
1469-
1470-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device);
1471-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device);
1472-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device);
1473-
rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device);
1475+
rmobile_add_devices_to_domains(domain_devices,
1476+
ARRAY_SIZE(domain_devices));
14741477

14751478
hdmi_init_pm_clock();
14761479
fsi_init_pm_clock();
@@ -1485,6 +1488,6 @@ MACHINE_START(AP4EVB, "ap4evb")
14851488
.init_irq = sh7372_init_irq,
14861489
.handle_irq = shmobile_handle_irq_intc,
14871490
.init_machine = ap4evb_init,
1488-
.init_late = shmobile_init_late,
1491+
.init_late = sh7372_pm_init_late,
14891492
.timer = &shmobile_timer,
14901493
MACHINE_END

arch/arm/mach-shmobile/board-armadillo800eva.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,10 +1209,10 @@ static void __init eva_init(void)
12091209

12101210
eva_clock_init();
12111211

1212-
rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device);
1213-
rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device);
1212+
rmobile_add_device_to_domain("A4LC", &lcdc0_device);
1213+
rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
12141214
if (usb)
1215-
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, usb);
1215+
rmobile_add_device_to_domain("A3SP", usb);
12161216
}
12171217

12181218
static void __init eva_earlytimer_init(void)

arch/arm/mach-shmobile/board-mackerel.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,22 @@ static struct i2c_board_info i2c1_devices[] = {
14121412
#define USCCR1 IOMEM(0xE6058144)
14131413
static void __init mackerel_init(void)
14141414
{
1415+
struct pm_domain_device domain_devices[] = {
1416+
{ "A4LC", &lcdc_device, },
1417+
{ "A4LC", &hdmi_lcdc_device, },
1418+
{ "A4LC", &meram_device, },
1419+
{ "A4MP", &fsi_device, },
1420+
{ "A3SP", &usbhs0_device, },
1421+
{ "A3SP", &usbhs1_device, },
1422+
{ "A3SP", &nand_flash_device, },
1423+
{ "A3SP", &sh_mmcif_device, },
1424+
{ "A3SP", &sdhi0_device, },
1425+
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1426+
{ "A3SP", &sdhi1_device, },
1427+
#endif
1428+
{ "A3SP", &sdhi2_device, },
1429+
{ "A4R", &ceu_device, },
1430+
};
14151431
u32 srcr4;
14161432
struct clk *clk;
14171433

@@ -1626,20 +1642,8 @@ static void __init mackerel_init(void)
16261642

16271643
platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
16281644

1629-
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device);
1630-
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &hdmi_lcdc_device);
1631-
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &meram_device);
1632-
rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device);
1633-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs0_device);
1634-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs1_device);
1635-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &nand_flash_device);
1636-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device);
1637-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device);
1638-
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1639-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device);
1640-
#endif
1641-
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi2_device);
1642-
rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device);
1645+
rmobile_add_devices_to_domains(domain_devices,
1646+
ARRAY_SIZE(domain_devices));
16431647

16441648
hdmi_init_pm_clock();
16451649
sh7372_pm_init();
@@ -1653,6 +1657,6 @@ MACHINE_START(MACKEREL, "mackerel")
16531657
.init_irq = sh7372_init_irq,
16541658
.handle_irq = shmobile_handle_irq_intc,
16551659
.init_machine = mackerel_init,
1656-
.init_late = shmobile_init_late,
1660+
.init_late = sh7372_pm_init_late,
16571661
.timer = &shmobile_timer,
16581662
MACHINE_END

0 commit comments

Comments
 (0)