rpmsg: glink: smem: Ensure ordering during tx
authorBjorn Andersson <bjorn.andersson@linaro.org>
Thu, 14 Dec 2017 20:15:46 +0000 (12:15 -0800)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 19 Dec 2017 05:47:43 +0000 (21:47 -0800)
Ensure the ordering of the fifo write and the update of the write index,
so that the index is not updated before the data has landed in the fifo.

Acked-By: Chris Lew <clew@codeaurora.org>
Reported-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/rpmsg/qcom_glink_smem.c

index 057528e23d3ab36c024a9cd286679ca33a81cb4d..892f2b92a4d854d5122887f21591184e18973b0f 100644 (file)
@@ -183,6 +183,9 @@ static void glink_smem_tx_write(struct qcom_glink_pipe *glink_pipe,
        if (head >= pipe->native.length)
                head -= pipe->native.length;
 
+       /* Ensure ordering of fifo and head update */
+       wmb();
+
        *pipe->head = cpu_to_le32(head);
 }