forked from espressif/esp-idf
Merge branch 'feature/esp_ipc_isr_fix_v4.4' into 'release/v4.4'
esp_system: Fix a race-condition in esp_ipc_isr (in QEMU env) (v4.4) See merge request espressif/esp-idf!23993
This commit is contained in:
@@ -130,6 +130,8 @@ void IRAM_ATTR esp_ipc_isr_release_other_cpu(void)
|
|||||||
const uint32_t cpu_id = xPortGetCoreID();
|
const uint32_t cpu_id = xPortGetCoreID();
|
||||||
if (--s_count_of_nested_calls[cpu_id] == 0) {
|
if (--s_count_of_nested_calls[cpu_id] == 0) {
|
||||||
esp_ipc_isr_finish_cmd = 1;
|
esp_ipc_isr_finish_cmd = 1;
|
||||||
|
// Make sure end flag is cleared and esp_ipc_isr_waiting_for_finish_cmd is done.
|
||||||
|
while (!esp_ipc_isr_end_fl) {};
|
||||||
IPC_ISR_EXIT_CRITICAL();
|
IPC_ISR_EXIT_CRITICAL();
|
||||||
portCLEAR_INTERRUPT_MASK_FROM_ISR(s_stored_interrupt_level);
|
portCLEAR_INTERRUPT_MASK_FROM_ISR(s_stored_interrupt_level);
|
||||||
} else if (s_count_of_nested_calls[cpu_id] < 0) {
|
} else if (s_count_of_nested_calls[cpu_id] < 0) {
|
||||||
|
@@ -96,6 +96,7 @@ esp_ipc_isr_handler:
|
|||||||
|
|
||||||
/* set the start flag */
|
/* set the start flag */
|
||||||
movi a0, esp_ipc_isr_start_fl
|
movi a0, esp_ipc_isr_start_fl
|
||||||
|
memw
|
||||||
s32i a0, a0, 0
|
s32i a0, a0, 0
|
||||||
|
|
||||||
/* Call the esp_ipc_function(void* arg) */
|
/* Call the esp_ipc_function(void* arg) */
|
||||||
@@ -113,6 +114,7 @@ esp_ipc_isr_handler:
|
|||||||
|
|
||||||
/* set the end flag */
|
/* set the end flag */
|
||||||
movi a0, esp_ipc_isr_end_fl
|
movi a0, esp_ipc_isr_end_fl
|
||||||
|
memw
|
||||||
s32i a0, a0, 0
|
s32i a0, a0, 0
|
||||||
|
|
||||||
/* restore a0 */
|
/* restore a0 */
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
esp_ipc_isr_waiting_for_finish_cmd:
|
esp_ipc_isr_waiting_for_finish_cmd:
|
||||||
/* waiting for the finish command */
|
/* waiting for the finish command */
|
||||||
.check_finish_cmd:
|
.check_finish_cmd:
|
||||||
|
memw
|
||||||
l32i a3, a2, 0
|
l32i a3, a2, 0
|
||||||
beqz a3, .check_finish_cmd
|
beqz a3, .check_finish_cmd
|
||||||
ret
|
ret
|
||||||
|
Reference in New Issue
Block a user