Browse Source

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
pull/1997/head
Andrew Davis 2 years ago
parent
commit
312eec3ecd
  1. 7
      plat/ti/k3/common/drivers/ti_sci/ti_sci.c

7
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;
}

Loading…
Cancel
Save