From 850bf5abc352c34f5fe535c8253adefeee441de1 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Thu, 24 Sep 2020 18:03:12 +0800 Subject: [PATCH] Revert "ANDROID: GKI: arm64: psci: Support for OS initiated scheme" This reverts commit fd2e0c7338ab88fafea089fce14b29e2596726b4. This patch is incomplete and halt system booting because of calling trust with wrong idle paramter. Signed-off-by: Tao Huang Change-Id: I8361bd1d585433dfbd41816c71f6de4b63d6cb49 --- drivers/firmware/psci.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 0863996e38df..c80ec1d03274 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -397,26 +397,29 @@ int psci_cpu_init_idle(unsigned int cpu) return ret; } -static int psci_suspend_finisher(unsigned long state_id) +static int psci_suspend_finisher(unsigned long index) { - return psci_ops.cpu_suspend(state_id, + u32 *state = __this_cpu_read(psci_power_state); + + return psci_ops.cpu_suspend(state[index - 1], __pa_symbol(cpu_resume)); } -int psci_cpu_suspend_enter(unsigned long state_id) + +int psci_cpu_suspend_enter(unsigned long index) { 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(!state_id)) + if (WARN_ON_ONCE(!index)) return -EINVAL; - if (!psci_power_state_loses_context(state_id)) - ret = psci_ops.cpu_suspend(state_id, 0); + if (!psci_power_state_loses_context(state[index - 1])) + ret = psci_ops.cpu_suspend(state[index - 1], 0); else - ret = cpu_suspend(state_id, psci_suspend_finisher); + ret = cpu_suspend(index, psci_suspend_finisher); return ret; }