2021-04-22 20:32:40

by Sowjanya Komatineni

[permalink] [raw]
Subject: [RFC PATCH 3/4] cpuidle: psci: pass state idle time before state enter callback

Some platforms use separate CPU firmware to handle all state transition
decisions and may need runtime state idle time of the target state it is
going to enter.

This patch calls set_state_idle_time psci operation callback to pass the
state idle time to TF-A through PSCI before calling psci_enter_state.

Signed-off-by: Sowjanya Komatineni <[email protected]>
---
drivers/cpuidle/cpuidle-psci.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index b51b5df..22a5003 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -151,6 +151,17 @@ static int psci_enter_idle_state(struct cpuidle_device *dev,
{
u32 *state = __this_cpu_read(psci_cpuidle_data.psci_states);

+ /*
+ * Some platforms use separate CPU firmware running in background to
+ * handle state transition which may need runtime idle time of the
+ * corresponding state from kernel.
+ * So, pass the state idle time from kernel to TF-A firmware through
+ * PSCI. Platform specific TF-A firmware may update this to CPU
+ * firmware.
+ */
+ if (idx)
+ psci_ops.set_state_idle_time(drv->states[idx].idle_time);
+
return psci_enter_state(idx, state[idx]);
}

--
2.7.4