From patchwork Thu Apr 2 19:13:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB383C43331 for ; Thu, 2 Apr 2020 19:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B202020719 for ; Thu, 2 Apr 2020 19:13:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y0SNIyxB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389424AbgDBTNY (ORCPT ); Thu, 2 Apr 2020 15:13:24 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35657 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389387AbgDBTNY (ORCPT ); Thu, 2 Apr 2020 15:13:24 -0400 Received: by mail-wm1-f67.google.com with SMTP id i19so4966779wmb.0 for ; Thu, 02 Apr 2020 12:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3E+vUdmowT/01VGwN5LYzWxwrJnBqR/xu8ape7Fl+Ag=; b=y0SNIyxBQ8OGEqWHIiyrhp5fDO073K6m7UIkI9Ad6j7yV+K2P8go4L4GJZL4y301Ax jNF3JyQM5GM5oSp8jbvoJ25vCxAzs0w/DdXhQYdjeS/fKaP3nFLDgOa78oE1JotxNQ4k hvTmc04RssKAa2oJ5K2G3gNgtOdS7m/FhXfuWRNBkVtW/rYJLjcUjXDgptFw3uoNhUUn nMVkmjCIXAA/nc1wIT5XxXUNwB3z6djLk2X8jV0JpnifWTlrmeWhInhWrPN4uvDrqpto rdnTQuoofvu7Djt2L7OXNQ9RMS5ysmyNsAwVtjOAKVT734T+WAhN670Dfx32A1PQr/7p Oi0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3E+vUdmowT/01VGwN5LYzWxwrJnBqR/xu8ape7Fl+Ag=; b=J/i6GymclyDSyawUT98Wflx1hIXrfF0HL6zUL+YAjPviD3jz9pjjWse7+e0sHwAO/l /WFyqqmdqafZPjskxJTcKw+HTuU+MRK++1Wn05lsqvnyrSeeh7sNH3okMdHVMjnSxm8p lsfan08tFO57ZlxqdrpVOwcek7T3QgdF+Mh/DrHuLj7pui2e3LPs3xDvxZAC+EDc0yog 86snVWNC57NGgCv1/v9NA7YxYW/Jq9LmgfaKty014r/1gyeQrjqVAqsVZ6g5I5oo8uzM QQSL79BBorNCkHxkpl+5v7K0pS2S7Vlp4RtdlK13SxL7nug51m4UErgBpxZBx0uV+O1n Vw0w== X-Gm-Message-State: AGi0PuY74aer2ZHYSvvyWlMzM1qTa9AALhRKwYEkbAOVD68P6sTxUzJn R9equEY/iY6S1Hc53nXanHQiWKu/84VOmw== X-Google-Smtp-Source: APiQypJEnWs4tkmzLMEQLLId3kpDGWoxUzwDMpn6GNG/++Bs8jj9GYRvBuMUS/rB4LPxPSF9+ILD3g== X-Received: by 2002:a1c:2506:: with SMTP id l6mr4665358wml.44.1585854802029; Thu, 02 Apr 2020 12:13:22 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y12sm5511514wrn.55.2020.04.02.12.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:13:21 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.14 23/33] rpmsg: glink: smem: Ensure ordering during tx Date: Thu, 2 Apr 2020 20:13:43 +0100 Message-Id: <20200402191353.787836-23-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191353.787836-1-lee.jones@linaro.org> References: <20200402191353.787836-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjorn Andersson [ Upstream commit 9d32497361ff89d2fc8306407de6f04b2bfb2836 ] 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 Reported-by: Arun Kumar Neelakantam Signed-off-by: Bjorn Andersson Signed-off-by: Lee Jones --- 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 b1c15c64cdec3..c2a4467b5fcdf 100644 --- a/drivers/rpmsg/qcom_glink_smem.c +++ b/drivers/rpmsg/qcom_glink_smem.c @@ -185,6 +185,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); }