diff --git a/src/arch/armv8/armv8-a/psci.c b/src/arch/armv8/armv8-a/psci.c index 0a18e87d9..963506a6a 100644 --- a/src/arch/armv8/armv8-a/psci.c +++ b/src/arch/armv8/armv8-a/psci.c @@ -82,6 +82,12 @@ void psci_wake(uint32_t handler_id) int32_t psci_standby() { + /* We've observed that some platforms behave unexpectedly when performing + * standby. In these cases, after standby, the CPU cores are not awaken + * by interrupts. */ + if (!DEFINED(PLAT_PSCI_STANDBY_NOT_SUPPORTED)) { + return PSCI_E_NOT_SUPPORTED; + } /* only apply request to core level */ uint32_t pwr_state_aux = PSCI_POWER_STATE_LVL_0 | PSCI_STATE_TYPE_STANDBY; diff --git a/src/arch/armv8/psci.c b/src/arch/armv8/psci.c index 7479bc68a..d6404243f 100644 --- a/src/arch/armv8/psci.c +++ b/src/arch/armv8/psci.c @@ -69,14 +69,11 @@ static int32_t psci_cpu_suspend_handler(uint32_t power_state, unsigned long entr ret = psci_power_down(PSCI_WAKEUP_POWERDOWN); } else { // PSCI_STATE_TYPE_STANDBY: - /** - * TODO: ideally we would emmit a standby request to PSCI (currently, ATF), but when we - * do, we do not wake up on interrupts on the current development target zcu104. We should - * understand why. To circunvent this, we directly emmit a wfi - */ - // ret = psci_standby(); - __asm__ volatile("wfi\n\r"); - ret = PSCI_E_SUCCESS; + ret = psci_standby(); + if (ret == PSCI_E_NOT_SUPPORTED) { + __asm__ volatile("wfi\n\r"); + ret = PSCI_E_SUCCESS; + } } return ret; diff --git a/src/platform/zcu102/inc/plat/psci.h b/src/platform/zcu102/inc/plat/psci.h index 372a7390e..3e18bb6dc 100644 --- a/src/platform/zcu102/inc/plat/psci.h +++ b/src/platform/zcu102/inc/plat/psci.h @@ -13,4 +13,6 @@ #define PSCI_STATE_TYPE_POWERDOWN (1UL << 30) #define PSCI_STATE_TYPE_BIT (1UL << 30) +#define PLAT_PSCI_STANDBY_NOT_SUPPORTED + #endif // __PLAT_PSCI_H__