diff options
author | Andrew Davis <afd@ti.com> | 2023-03-13 13:56:27 -0500 |
---|---|---|
committer | Andrew Davis <afd@ti.com> | 2023-03-30 10:19:21 -0500 |
commit | 312eec3ecde9837f61fc0d7b46b4197ec2257ee7 (patch) | |
tree | 7c45ac1497b2d316abb47b993e098c162a562718 /plat/ti | |
parent | 3aa8d49ada6fa6d6e36cce9c4e28489340c754bc (diff) | |
download | arm-trusted-firmware-312eec3ecde9837f61fc0d7b46b4197ec2257ee7.tar.gz |
feat(ti): synchronize access to secure proxy threads
When communicating with the system controller over secure proxy we clear
a thread, write our message, then wait for a response. This must not be
interrupted by a different transfer on the same thread. Take a lock
during this sequence to prevent contention.
Signed-off-by: Andrew Davis <afd@ti.com>
Change-Id: I7789f017fde7180ab6b4ac07458464b967c8e580
Diffstat (limited to 'plat/ti')
-rw-r--r-- | plat/ti/k3/common/drivers/ti_sci/ti_sci.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c index f0529d07a..dacef7420 100644 --- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c +++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c @@ -13,6 +13,7 @@ #include <string.h> #include <platform_def.h> +#include <lib/bakery_lock.h> #include <common/debug.h> #include <sec_proxy.h> @@ -25,6 +26,8 @@ __section(".tzfw_coherent_mem") #endif static uint8_t message_sequence; +DEFINE_BAKERY_LOCK(ti_sci_xfer_lock); + /** * struct ti_sci_xfer - Structure representing a message flow * @tx_message: Transmit message @@ -146,6 +149,8 @@ static int ti_sci_do_xfer(struct ti_sci_xfer *xfer) struct k3_sec_proxy_msg *rx_msg = &xfer->rx_message; int ret; + bakery_lock_get(&ti_sci_xfer_lock); + /* Clear any spurious messages in receive queue */ ret = k3_sec_proxy_clear_rx_thread(SP_RESPONSE); if (ret) { @@ -169,6 +174,8 @@ static int ti_sci_do_xfer(struct ti_sci_xfer *xfer) } } + bakery_lock_release(&ti_sci_xfer_lock); + return 0; } |