Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752712AbdLNUPy (ORCPT ); Thu, 14 Dec 2017 15:15:54 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:38418 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbdLNUPv (ORCPT ); Thu, 14 Dec 2017 15:15:51 -0500 X-Google-Smtp-Source: ACJfBos1IqG0ZZu6rmED9X+wOPfTMiIKTyiGy74UmF6+M6aYKnWriWPRYtqjzYSruDRMUQkntOf5JA== From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam , Chris Lew , linux-arm-msm@vger.kernel.org Subject: [PATCH] rpmsg: glink: smem: Ensure ordering during tx Date: Thu, 14 Dec 2017 12:15:46 -0800 Message-Id: <20171214201546.21942-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 808 Lines: 25 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. Reported-by: Arun Kumar Neelakantam Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_smem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c index 057528e23d3a..892f2b92a4d8 100644 --- a/drivers/rpmsg/qcom_glink_smem.c +++ b/drivers/rpmsg/qcom_glink_smem.c @@ -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); } -- 2.15.0