From 8cdd22a81ec15ab71e12cca95ecde606d830ecbd Mon Sep 17 00:00:00 2001 From: Cypherbridge Systems Date: Fri, 2 Jun 2023 16:48:23 -0700 Subject: [PATCH] cortex_a55_smp/gnu: added barrier instruction before setting tx_thread_smp_lock_ready_bit in _tx_thread_context_restore() and _tx_thread_system_return() to ensure accesses to shared resources have completed. This ensures that _tx_thread_schedule() reads correct thread data when it sees tx_thread_smp_lock_ready_bit set --- ports_smp/cortex_a55_smp/gnu/src/tx_thread_context_restore.S | 1 + ports_smp/cortex_a55_smp/gnu/src/tx_thread_system_return.S | 1 + 2 files changed, 2 insertions(+) diff --git a/ports_smp/cortex_a55_smp/gnu/src/tx_thread_context_restore.S b/ports_smp/cortex_a55_smp/gnu/src/tx_thread_context_restore.S index 21deb75d6..c142aab8c 100644 --- a/ports_smp/cortex_a55_smp/gnu/src/tx_thread_context_restore.S +++ b/ports_smp/cortex_a55_smp/gnu/src/tx_thread_context_restore.S @@ -289,6 +289,7 @@ __tx_thread_dont_save_ts: /* Set bit indicating this thread is ready for execution. */ + DMB ISH // Ensure that all accesses to shared resources have completed MOV x2, #1 // Build ready flag STR w2, [x0, #260] // Set thread's ready flag DMB ISH // Ensure that accesses to shared resource have completed diff --git a/ports_smp/cortex_a55_smp/gnu/src/tx_thread_system_return.S b/ports_smp/cortex_a55_smp/gnu/src/tx_thread_system_return.S index 68c92a336..17bad92f1 100644 --- a/ports_smp/cortex_a55_smp/gnu/src/tx_thread_system_return.S +++ b/ports_smp/cortex_a55_smp/gnu/src/tx_thread_system_return.S @@ -168,6 +168,7 @@ __tx_thread_dont_save_ts: /* Set ready bit in thread control block. */ + DMB ISH // Ensure that all accesses to shared resources have completed MOV x3, #1 // Build ready value STR w3, [x6, #260] // Make the thread ready DMB ISH //