Skip to content

Commit

Permalink
pm: Deprecate z_pm_save_idle_exit
Browse files Browse the repository at this point in the history
Deprecate z_pm_save_idle_exit and promote pm_system_resume.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
  • Loading branch information
Flavio Ceolin authored and carlescufi committed May 27, 2024
1 parent e1685bb commit 4d85f3d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion arch/arm/core/cortex_a_r/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void _arch_isr_direct_pm(void)

if (_kernel.idle) {
_kernel.idle = 0;
z_pm_save_idle_exit();
pm_system_resume();
}

irq_unlock(key);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/cortex_m/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void _arch_isr_direct_pm(void)

if (_kernel.idle) {
_kernel.idle = 0;
z_pm_save_idle_exit();
pm_system_resume();
}

#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/core/cortex_m/isr_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void _isr_wrapper(void)
* idle, this ensures that the calculation and programming of the
* device for the next timer deadline is not interrupted. For
* non-tickless idle, this ensures that the clearing of the kernel idle
* state is not interrupted. In each case, z_pm_save_idle_exit
* state is not interrupted. In each case, pm_system_resume
* is called with interrupts disabled.
*/

Expand All @@ -59,7 +59,7 @@ void _isr_wrapper(void)
if (_kernel.idle != 0) {
/* clear kernel idle state */
_kernel.idle = 0;
z_pm_save_idle_exit();
pm_system_resume();
}
/* re-enable interrupts */
__enable_irq();
Expand Down
2 changes: 1 addition & 1 deletion arch/posix/core/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void posix_irq_check_idle_exit(void)
{
if (_kernel.idle) {
_kernel.idle = 0;
z_pm_save_idle_exit();
pm_system_resume();
}
}
#endif
2 changes: 1 addition & 1 deletion include/zephyr/arch/x86/ia32/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static inline void arch_irq_direct_pm(void)
{
if (_kernel.idle) {
_kernel.idle = 0;
z_pm_save_idle_exit();
pm_system_resume();
}
}

Expand Down
27 changes: 26 additions & 1 deletion include/zephyr/pm/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,28 @@ int pm_notifier_unregister(struct pm_notifier *notifier);
*/
const struct pm_state_info *pm_state_next_get(uint8_t cpu);

/**
* @brief Notify exit from kernel sleep.
*
* This function would notify exit from kernel idling if a corresponding
* pm_system_suspend() notification was handled and did not return
* PM_STATE_ACTIVE.
*
* This function should be called from the ISR context of the event
* that caused the exit from kernel idling.
*
* This is required for cpu power states that would require
* interrupts to be enabled while entering low power states. e.g. C1 in x86. In
* those cases, the ISR would be invoked immediately after the event wakes up
* the CPU, before code following the CPU wait, gets a chance to execute. This
* can be ignored if no operation needs to be done at the wake event
* notification.
*/
void pm_system_resume(void);


/** @cond INTERNAL_HIDDEN */
void z_pm_save_idle_exit(void);
__deprecated void z_pm_save_idle_exit(void);
/** @endcond */

/**
Expand Down Expand Up @@ -182,6 +202,11 @@ static inline const struct pm_state_info *pm_state_next_get(uint8_t cpu)
static inline void z_pm_save_idle_exit(void)
{
}

static inline void pm_system_resume(void)
{
}

#endif /* CONFIG_PM */

#ifdef __cplusplus
Expand Down
20 changes: 0 additions & 20 deletions kernel/include/kernel_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,26 +243,6 @@ void z_handle_obj_poll_events(sys_dlist_t *events, uint32_t state);
*/
bool pm_system_suspend(int32_t ticks);

/**
* Notify exit from kernel idling after PM operations
*
* This function would notify exit from kernel idling if a corresponding
* pm_system_suspend() notification was handled and did not return
* PM_STATE_ACTIVE.
*
* This function would be called from the ISR context of the event
* that caused the exit from kernel idling. This will be called immediately
* after interrupts are enabled. This is called to give a chance to do
* any operations before the kernel would switch tasks or processes nested
* interrupts. This is required for cpu low power states that would require
* interrupts to be enabled while entering low power states. e.g. C1 in x86. In
* those cases, the ISR would be invoked immediately after the event wakes up
* the CPU, before code following the CPU wait, gets a chance to execute. This
* can be ignored if no operation needs to be done at the wake event
* notification.
*/
void pm_system_resume(void);

#endif /* CONFIG_PM */

#ifdef CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM
Expand Down

0 comments on commit 4d85f3d

Please sign in to comment.