diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-04-27 19:54:49 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-04-27 19:54:49 -0400 |
commit | e4f5a3adc454745fea35f1c312e14cbeba6e0ea4 (patch) | |
tree | 7dae08f7d3466fcf158808784ec3b706e6cafec6 /arch/powerpc/platforms | |
parent | ae6208301e1e37a203fab817b59279a0f5d774c6 (diff) | |
parent | a8e39c35b5d09598e129aa9b5e6f35aa3a1915d9 (diff) |
Merge branch 'pm-cpuidle'
* pm-cpuidle: (51 commits)
cpuidle: add maintainer entry
ARM: s3c64xx: cpuidle: use init/exit common routine
SH: cpuidle: use init/exit common routine
cpuidle: fix comment format
ARM: imx: cpuidle: use init/exit common routine
ARM: davinci: cpuidle: use init/exit common routine
ARM: kirkwood: cpuidle: use init/exit common routine
ARM: calxeda: cpuidle: use init/exit common routine
ARM: tegra: cpuidle: use init/exit common routine for tegra3
ARM: tegra: cpuidle: use init/exit common routine for tegra2
ARM: OMAP4: cpuidle: use init/exit common routine
ARM: shmobile: cpuidle: use init/exit common routine
ARM: tegra: cpuidle: use init/exit common routine
ARM: OMAP3: cpuidle: use init/exit common routine
ARM: at91: cpuidle: use init/exit common routine
ARM: ux500: cpuidle: use init/exit common routine
cpuidle: make a single register function for all
ARM: ux500: cpuidle: replace for_each_online_cpu by for_each_possible_cpu
cpuidle: remove en_core_tk_irqen flag
ARM: OMAP3: remove cpuidle_wrap_enter
...
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/processor_idle.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c index 4d806b419606..4644efa06941 100644 --- a/arch/powerpc/platforms/pseries/processor_idle.c +++ b/arch/powerpc/platforms/pseries/processor_idle.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include "pseries.h" | 23 | #include "pseries.h" |
24 | 24 | ||
25 | struct cpuidle_driver pseries_idle_driver = { | 25 | struct cpuidle_driver pseries_idle_driver = { |
26 | .name = "pseries_idle", | 26 | .name = "pseries_idle", |
27 | .owner = THIS_MODULE, | 27 | .owner = THIS_MODULE, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #define MAX_IDLE_STATE_COUNT 2 | 30 | #define MAX_IDLE_STATE_COUNT 2 |
@@ -33,10 +33,8 @@ static int max_idle_state = MAX_IDLE_STATE_COUNT - 1; | |||
33 | static struct cpuidle_device __percpu *pseries_cpuidle_devices; | 33 | static struct cpuidle_device __percpu *pseries_cpuidle_devices; |
34 | static struct cpuidle_state *cpuidle_state_table; | 34 | static struct cpuidle_state *cpuidle_state_table; |
35 | 35 | ||
36 | static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) | 36 | static inline void idle_loop_prolog(unsigned long *in_purr) |
37 | { | 37 | { |
38 | |||
39 | *kt_before = ktime_get(); | ||
40 | *in_purr = mfspr(SPRN_PURR); | 38 | *in_purr = mfspr(SPRN_PURR); |
41 | /* | 39 | /* |
42 | * Indicate to the HV that we are idle. Now would be | 40 | * Indicate to the HV that we are idle. Now would be |
@@ -45,12 +43,10 @@ static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) | |||
45 | get_lppaca()->idle = 1; | 43 | get_lppaca()->idle = 1; |
46 | } | 44 | } |
47 | 45 | ||
48 | static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before) | 46 | static inline void idle_loop_epilog(unsigned long in_purr) |
49 | { | 47 | { |
50 | get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr; | 48 | get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr; |
51 | get_lppaca()->idle = 0; | 49 | get_lppaca()->idle = 0; |
52 | |||
53 | return ktime_to_us(ktime_sub(ktime_get(), kt_before)); | ||
54 | } | 50 | } |
55 | 51 | ||
56 | static int snooze_loop(struct cpuidle_device *dev, | 52 | static int snooze_loop(struct cpuidle_device *dev, |
@@ -58,10 +54,9 @@ static int snooze_loop(struct cpuidle_device *dev, | |||
58 | int index) | 54 | int index) |
59 | { | 55 | { |
60 | unsigned long in_purr; | 56 | unsigned long in_purr; |
61 | ktime_t kt_before; | ||
62 | int cpu = dev->cpu; | 57 | int cpu = dev->cpu; |
63 | 58 | ||
64 | idle_loop_prolog(&in_purr, &kt_before); | 59 | idle_loop_prolog(&in_purr); |
65 | local_irq_enable(); | 60 | local_irq_enable(); |
66 | set_thread_flag(TIF_POLLING_NRFLAG); | 61 | set_thread_flag(TIF_POLLING_NRFLAG); |
67 | 62 | ||
@@ -75,8 +70,8 @@ static int snooze_loop(struct cpuidle_device *dev, | |||
75 | clear_thread_flag(TIF_POLLING_NRFLAG); | 70 | clear_thread_flag(TIF_POLLING_NRFLAG); |
76 | smp_mb(); | 71 | smp_mb(); |
77 | 72 | ||
78 | dev->last_residency = | 73 | idle_loop_epilog(in_purr); |
79 | (int)idle_loop_epilog(in_purr, kt_before); | 74 | |
80 | return index; | 75 | return index; |
81 | } | 76 | } |
82 | 77 | ||
@@ -102,9 +97,8 @@ static int dedicated_cede_loop(struct cpuidle_device *dev, | |||
102 | int index) | 97 | int index) |
103 | { | 98 | { |
104 | unsigned long in_purr; | 99 | unsigned long in_purr; |
105 | ktime_t kt_before; | ||
106 | 100 | ||
107 | idle_loop_prolog(&in_purr, &kt_before); | 101 | idle_loop_prolog(&in_purr); |
108 | get_lppaca()->donate_dedicated_cpu = 1; | 102 | get_lppaca()->donate_dedicated_cpu = 1; |
109 | 103 | ||
110 | ppc64_runlatch_off(); | 104 | ppc64_runlatch_off(); |
@@ -112,8 +106,9 @@ static int dedicated_cede_loop(struct cpuidle_device *dev, | |||
112 | check_and_cede_processor(); | 106 | check_and_cede_processor(); |
113 | 107 | ||
114 | get_lppaca()->donate_dedicated_cpu = 0; | 108 | get_lppaca()->donate_dedicated_cpu = 0; |
115 | dev->last_residency = | 109 | |
116 | (int)idle_loop_epilog(in_purr, kt_before); | 110 | idle_loop_epilog(in_purr); |
111 | |||
117 | return index; | 112 | return index; |
118 | } | 113 | } |
119 | 114 | ||
@@ -122,9 +117,8 @@ static int shared_cede_loop(struct cpuidle_device *dev, | |||
122 | int index) | 117 | int index) |
123 | { | 118 | { |
124 | unsigned long in_purr; | 119 | unsigned long in_purr; |
125 | ktime_t kt_before; | ||
126 | 120 | ||
127 | idle_loop_prolog(&in_purr, &kt_before); | 121 | idle_loop_prolog(&in_purr); |
128 | 122 | ||
129 | /* | 123 | /* |
130 | * Yield the processor to the hypervisor. We return if | 124 | * Yield the processor to the hypervisor. We return if |
@@ -135,8 +129,8 @@ static int shared_cede_loop(struct cpuidle_device *dev, | |||
135 | */ | 129 | */ |
136 | check_and_cede_processor(); | 130 | check_and_cede_processor(); |
137 | 131 | ||
138 | dev->last_residency = | 132 | idle_loop_epilog(in_purr); |
139 | (int)idle_loop_epilog(in_purr, kt_before); | 133 | |
140 | return index; | 134 | return index; |
141 | } | 135 | } |
142 | 136 | ||