Skip to content

Commit 8b7ce5e

Browse files
storulfrafaeljw
authored andcommitted
cpuidle: psci: Fixup execution order when entering a domain idle state
Moving forward, platforms are going to need to execute specific "last-man" operations before a domain idle state can be entered. In one way or the other, these operations needs to be triggered while walking the hierarchical topology via runtime PM and genpd, as it's at that point the last-man becomes known. Moreover, executing last-man operations needs to be done after the CPU PM notifications are sent through cpu_pm_enter(), as otherwise it's likely that some notifications would fail. Therefore, let's re-order the sequence in psci_enter_domain_idle_state(), so cpu_pm_enter() gets called prior pm_runtime_put_sync(). Fixes: ce85aef ("cpuidle: psci: Manage runtime PM in the idle path") Reported-by: Lina Iyer <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Acked-by: Sudeep Holla <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent eba933c commit 8b7ce5e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/cpuidle/cpuidle-psci.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,23 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
5858
u32 state;
5959
int ret;
6060

61+
ret = cpu_pm_enter();
62+
if (ret)
63+
return -1;
64+
6165
/* Do runtime PM to manage a hierarchical CPU toplogy. */
6266
pm_runtime_put_sync_suspend(pd_dev);
6367

6468
state = psci_get_domain_state();
6569
if (!state)
6670
state = states[idx];
6771

68-
ret = psci_enter_state(idx, state);
72+
ret = psci_cpu_suspend_enter(state) ? -1 : idx;
6973

7074
pm_runtime_get_sync(pd_dev);
7175

76+
cpu_pm_exit();
77+
7278
/* Clear the domain state to start fresh when back from idle. */
7379
psci_set_domain_state(0);
7480
return ret;

0 commit comments

Comments
 (0)