From fd2e0c7338ab88fafea089fce14b29e2596726b4 Mon Sep 17 00:00:00 2001 From: Mahesh Sivasubramanian Date: Thu, 23 Apr 2015 16:20:05 -0600 Subject: [PATCH] ANDROID: GKI: arm64: psci: Support for OS initiated scheme Existing PSCI implementation supports platform coordinated means of low power modes where cluster low power modes are aggregated at the platform level. Adding support for OS initiated scheme, where the OS is responsible for selecting cluster low power modes based on last man determination. With OS initiated scheme, the OS can make better cluster decisions based on wakeup times of CPUs within a cluster. To this effect, in OS initiated schemes, the composite state ID is computed by the idle driver before calling into the cpu_suspend API. The PSCI driver is modified to use the composite ID to distinguish between retention and non-retention states. Change-Id: Iee5533676a28a8f6beb7942dcb908f2fa3518d78 Signed-off-by: Mahesh Sivasubramanian Signed-off-by: Murali Nalajala (cherry picked from commit ea2c39aefb5418869d81f96304b5cfddc76c4c11) Signed-off-by: Mark Salyzyn Bug: 154642337 --- drivers/firmware/psci.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index c80ec1d03274..0863996e38df 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -397,29 +397,26 @@ int psci_cpu_init_idle(unsigned int cpu) return ret; } -static int psci_suspend_finisher(unsigned long index) +static int psci_suspend_finisher(unsigned long state_id) { - u32 *state = __this_cpu_read(psci_power_state); - - return psci_ops.cpu_suspend(state[index - 1], + return psci_ops.cpu_suspend(state_id, __pa_symbol(cpu_resume)); } - -int psci_cpu_suspend_enter(unsigned long index) +int psci_cpu_suspend_enter(unsigned long state_id) { int ret; - u32 *state = __this_cpu_read(psci_power_state); + /* * idle state index 0 corresponds to wfi, should never be called * from the cpu_suspend operations */ - if (WARN_ON_ONCE(!index)) + if (WARN_ON_ONCE(!state_id)) return -EINVAL; - if (!psci_power_state_loses_context(state[index - 1])) - ret = psci_ops.cpu_suspend(state[index - 1], 0); + if (!psci_power_state_loses_context(state_id)) + ret = psci_ops.cpu_suspend(state_id, 0); else - ret = cpu_suspend(index, psci_suspend_finisher); + ret = cpu_suspend(state_id, psci_suspend_finisher); return ret; }