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
#include <string.h>
#include <platform_def.h>
+#include <lib/bakery_lock.h>
#include <common/debug.h>
#include <sec_proxy.h>
#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
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) {
}
}
+ bakery_lock_release(&ti_sci_xfer_lock);
+
return 0;
}