Skip to content

Commit

Permalink
feat(armv8/psci): Handle unexpected powerdown behavior
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
DavidMCerdeira authored and josecm committed Oct 3, 2024
1 parent ce96cf2 commit a5d7602
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
11 changes: 1 addition & 10 deletions src/arch/armv8/armv8-a/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,7 @@ void cpu_arch_profile_idle()
{
int64_t err = psci_power_down(PSCI_WAKEUP_IDLE);
if (err) {
switch (err) {
case PSCI_E_NOT_SUPPORTED:
/**
* If power down is not supported let's just wait for an interrupt
*/
__asm__ volatile("wfi");
break;
default:
ERROR("PSCI cpu%d power down failed with error %ld", cpu()->id, err);
}
ERROR("PSCI cpu%d power down failed with error %ld", cpu()->id, err);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/arch/armv8/armv8-a/psci.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ int32_t psci_standby()

int32_t psci_power_down(enum wakeup_reason reason)
{
/* 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. */
if (DEFINED(PLAT_PSCI_POWERDOWN_NOT_SUPPORTED)) {
return psci_standby();
}

extern void psci_boot_entry(unsigned long x0);

uint32_t pwr_state_aux = PSCI_POWER_STATE_LVL_0 | PSCI_STATE_TYPE_POWERDOWN;
Expand Down

0 comments on commit a5d7602

Please sign in to comment.