Skip to content

Commit a5d7602

Browse files
DavidMCerdeirajosecm
authored andcommitted
feat(armv8/psci): Handle unexpected powerdown behavior
We've observed that some platforms behave unexpectedly when performing power down. In these cases, after powerdown, the CPU cores are not awaken by interrupts as expected by Bao. This commit solve this, by adding the ability to skip the powerdown firmware call, instead relying on the fallback mechanism of using standby. Signed-off-by: David Cerdeira <[email protected]>
1 parent ce96cf2 commit a5d7602

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/arch/armv8/armv8-a/cpu.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,7 @@ void cpu_arch_profile_idle()
3131
{
3232
int64_t err = psci_power_down(PSCI_WAKEUP_IDLE);
3333
if (err) {
34-
switch (err) {
35-
case PSCI_E_NOT_SUPPORTED:
36-
/**
37-
* If power down is not supported let's just wait for an interrupt
38-
*/
39-
__asm__ volatile("wfi");
40-
break;
41-
default:
42-
ERROR("PSCI cpu%d power down failed with error %ld", cpu()->id, err);
43-
}
34+
ERROR("PSCI cpu%d power down failed with error %ld", cpu()->id, err);
4435
}
4536

4637
/**

src/arch/armv8/armv8-a/psci.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ int32_t psci_standby()
9090

9191
int32_t psci_power_down(enum wakeup_reason reason)
9292
{
93+
/* We've observed that some platforms behave unexpectedly when performing
94+
* power down. In these cases, after powerdown, the CPU cores are not awaken
95+
* by interrupts as expected by Bao. */
96+
if (DEFINED(PLAT_PSCI_POWERDOWN_NOT_SUPPORTED)) {
97+
return psci_standby();
98+
}
99+
93100
extern void psci_boot_entry(unsigned long x0);
94101

95102
uint32_t pwr_state_aux = PSCI_POWER_STATE_LVL_0 | PSCI_STATE_TYPE_POWERDOWN;

0 commit comments

Comments
 (0)