Skip to content

Commit 916a8eb

Browse files
stephanosioioannisg
authored andcommitted
arch: arm: Fix Cortex-R power management interrupt handling
The system power management handling code in the '_isr_wrapper' enables interrupts by executing the 'cpsie i' instruction, which causes a system crash on the Cortex-R devices because the Cortex-R arch port does not support nested interrupts at this time. This commit restricts the interrupt state manipulations in the system power management code to the Cortex-M arch, in order to prevent interrupt nesting on other AArch32 family archs (only Cortex-R for now). Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 23a5b49 commit 916a8eb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/arm/core/aarch32/isr_wrapper.S

+11
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,15 @@ SECTION_FUNC(TEXT, _isr_wrapper)
7777
* state is not interrupted. In each case, z_sys_power_save_idle_exit
7878
* is called with interrupts disabled.
7979
*/
80+
81+
/*
82+
* FIXME: Remove the Cortex-M conditional compilation checks for `cpsid i`
83+
* and `cpsie i` after the Cortex-R port is updated to support
84+
* interrupt nesting. For more details, refer to the issue #21758.
85+
*/
86+
#if defined(CONFIG_CPU_CORTEX_M)
8087
cpsid i /* PRIMASK = 1 */
88+
#endif
8189

8290
/* is this a wakeup from idle ? */
8391
ldr r2, =_kernel
@@ -110,9 +118,12 @@ _idle_state_cleared:
110118
#error Unknown ARM architecture
111119
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
112120

121+
#if defined(CONFIG_CPU_CORTEX_M)
113122
cpsie i /* re-enable interrupts (PRIMASK = 0) */
114123
#endif
115124

125+
#endif /* CONFIG_SYS_POWER_MANAGEMENT */
126+
116127
#if defined(CONFIG_CPU_CORTEX_M)
117128
mrs r0, IPSR /* get exception number */
118129
#endif

0 commit comments

Comments
 (0)