Skip to content

Commit a282e5e

Browse files
tmlindIngo Molnar
authored andcommitted
cpuidle, OMAP4: Push RCU-idle into omap4_enter_lowpower()
OMAP4 uses full SoC suspend modes as idle states, as such it needs the whole power-domain and clock-domain code from the idle path. All that code is not suitable to run with RCU disabled, as such push RCU-idle deeper still. Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Tested-by: Tony Lindgren <[email protected]> Tested-by: Ulf Hansson <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 8c0956a commit a282e5e

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

arch/arm/mach-omap2/common.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,13 @@ extern u32 omap4_get_cpu1_ns_pa_addr(void);
284284

285285
#if defined(CONFIG_SMP) && defined(CONFIG_PM)
286286
extern int omap4_mpuss_init(void);
287-
extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state);
287+
extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state,
288+
bool rcuidle);
288289
extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state);
289290
#else
290291
static inline int omap4_enter_lowpower(unsigned int cpu,
291-
unsigned int power_state)
292+
unsigned int power_state,
293+
bool rcuidle)
292294
{
293295
cpu_do_idle();
294296
return 0;

arch/arm/mach-omap2/cpuidle44xx.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ static int omap_enter_idle_smp(struct cpuidle_device *dev,
105105
}
106106
raw_spin_unlock_irqrestore(&mpu_lock, flag);
107107

108-
ct_cpuidle_enter();
109-
omap4_enter_lowpower(dev->cpu, cx->cpu_state);
110-
ct_cpuidle_exit();
108+
omap4_enter_lowpower(dev->cpu, cx->cpu_state, true);
111109

112110
raw_spin_lock_irqsave(&mpu_lock, flag);
113111
if (cx->mpu_state_vote == num_online_cpus())
@@ -186,10 +184,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
186184
}
187185
}
188186

189-
ct_cpuidle_enter();
190-
omap4_enter_lowpower(dev->cpu, cx->cpu_state);
187+
omap4_enter_lowpower(dev->cpu, cx->cpu_state, true);
191188
cpu_done[dev->cpu] = true;
192-
ct_cpuidle_exit();
193189

194190
/* Wakeup CPU1 only if it is not offlined */
195191
if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {

arch/arm/mach-omap2/omap-mpuss-lowpower.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* and first to wake-up when MPUSS low power states are excercised
3434
*/
3535

36+
#include <linux/cpuidle.h>
3637
#include <linux/kernel.h>
3738
#include <linux/io.h>
3839
#include <linux/errno.h>
@@ -214,6 +215,7 @@ static void __init save_l2x0_context(void)
214215
* of OMAP4 MPUSS subsystem
215216
* @cpu : CPU ID
216217
* @power_state: Low power state.
218+
* @rcuidle: RCU needs to be idled
217219
*
218220
* MPUSS states for the context save:
219221
* save_state =
@@ -222,7 +224,8 @@ static void __init save_l2x0_context(void)
222224
* 2 - CPUx L1 and logic lost + GIC lost: MPUSS OSWR
223225
* 3 - CPUx L1 and logic lost + GIC + L2 lost: DEVICE OFF
224226
*/
225-
int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
227+
int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state,
228+
bool rcuidle)
226229
{
227230
struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
228231
unsigned int save_state = 0, cpu_logic_state = PWRDM_POWER_RET;
@@ -268,6 +271,10 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
268271
cpu_clear_prev_logic_pwrst(cpu);
269272
pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
270273
pwrdm_set_logic_retst(pm_info->pwrdm, cpu_logic_state);
274+
275+
if (rcuidle)
276+
ct_cpuidle_enter();
277+
271278
set_cpu_wakeup_addr(cpu, __pa_symbol(omap_pm_ops.resume));
272279
omap_pm_ops.scu_prepare(cpu, power_state);
273280
l2x0_pwrst_prepare(cpu, save_state);
@@ -283,6 +290,9 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
283290
if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) && cpu)
284291
gic_dist_enable();
285292

293+
if (rcuidle)
294+
ct_cpuidle_exit();
295+
286296
/*
287297
* Restore the CPUx power state to ON otherwise CPUx
288298
* power domain can transitions to programmed low power

arch/arm/mach-omap2/pm44xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int omap4_pm_suspend(void)
7676
* domain CSWR is not supported by hardware.
7777
* More details can be found in OMAP4430 TRM section 4.3.4.2.
7878
*/
79-
omap4_enter_lowpower(cpu_id, cpu_suspend_state);
79+
omap4_enter_lowpower(cpu_id, cpu_suspend_state, false);
8080

8181
/* Restore next powerdomain state */
8282
list_for_each_entry(pwrst, &pwrst_list, node) {

0 commit comments

Comments
 (0)