soc: qcom: glink: smem: Add wmb between data and write index
Make sure data is flushed before updating write index by adding a wmb. Change-Id: I3d17ed56b64ac9ca399a0ef11a638027c1ba36ae Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
parent
63d54f82b9
commit
f497bfd257
1 changed files with 12 additions and 0 deletions
|
@ -539,6 +539,12 @@ static int fifo_write(struct edge_info *einfo, const void *data, int len)
|
|||
uint32_t write_index = einfo->tx_ch_desc->write_index;
|
||||
|
||||
len = fifo_write_body(einfo, data, len, &write_index);
|
||||
|
||||
/* All data writes need to be flushed to memory before the write index
|
||||
* is updated. This protects against a race condition where the remote
|
||||
* reads stale data because the write index was written before the data.
|
||||
*/
|
||||
wmb();
|
||||
einfo->tx_ch_desc->write_index = write_index;
|
||||
send_irq(einfo);
|
||||
|
||||
|
@ -574,6 +580,12 @@ static int fifo_write_complex(struct edge_info *einfo,
|
|||
len1 = fifo_write_body(einfo, data1, len1, &write_index);
|
||||
len2 = fifo_write_body(einfo, data2, len2, &write_index);
|
||||
len3 = fifo_write_body(einfo, data3, len3, &write_index);
|
||||
|
||||
/* All data writes need to be flushed to memory before the write index
|
||||
* is updated. This protects against a race condition where the remote
|
||||
* reads stale data because the write index was written before the data.
|
||||
*/
|
||||
wmb();
|
||||
einfo->tx_ch_desc->write_index = write_index;
|
||||
send_irq(einfo);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue