Commit 8b7ce5e4 authored by Ulf Hansson's avatar Ulf Hansson Committed by Rafael J. Wysocki

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: ce85aef5 ("cpuidle: psci: Manage runtime PM in the idle path")
Reported-by: default avatarLina Iyer <ilina@codeaurora.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent eba933ce
...@@ -58,6 +58,10 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, ...@@ -58,6 +58,10 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
u32 state; u32 state;
int ret; int ret;
ret = cpu_pm_enter();
if (ret)
return -1;
/* Do runtime PM to manage a hierarchical CPU toplogy. */ /* Do runtime PM to manage a hierarchical CPU toplogy. */
pm_runtime_put_sync_suspend(pd_dev); pm_runtime_put_sync_suspend(pd_dev);
...@@ -65,10 +69,12 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, ...@@ -65,10 +69,12 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
if (!state) if (!state)
state = states[idx]; state = states[idx];
ret = psci_enter_state(idx, state); ret = psci_cpu_suspend_enter(state) ? -1 : idx;
pm_runtime_get_sync(pd_dev); pm_runtime_get_sync(pd_dev);
cpu_pm_exit();
/* Clear the domain state to start fresh when back from idle. */ /* Clear the domain state to start fresh when back from idle. */
psci_set_domain_state(0); psci_set_domain_state(0);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment