pm: Make pm_power_state_force multicore aware

Change pm_power_state_force to receive which cpu the state should be
forced. Also, it changed the API behavior to force the given state only
when the idle thread for that core is executed.

In a multicore environment force arbitrarily a core to suspend is not
safe because the kernel cannot infer what that cpu is running and how it
impacts the overall system, for example, if it is holding a lock that is
required by a thread that is running in another cpu.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-11-14 11:04:56 -08:00 committed by Carles Cufí
commit 4998c52ba8
5 changed files with 23 additions and 33 deletions

View file

@ -118,5 +118,5 @@ void main(void)
printk("Device shutdown\n");
pm_power_state_force((struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
pm_power_state_force(0u, (struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
}