Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9101593pxu; Mon, 28 Dec 2020 06:40:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0rxYry4QTZEWZM89rGSqsh1edW/yzTqcWOZW49ktMsAh6ml57FzPi3UaW5HK10oMQgKWv X-Received: by 2002:aa7:db01:: with SMTP id t1mr42269883eds.185.1609166444934; Mon, 28 Dec 2020 06:40:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166444; cv=none; d=google.com; s=arc-20160816; b=DSyZsnZRcRNRFHamd3SaKuhGHA9exNne2MpqqWy2ytedo4NMyiiTJ3jnpgMAvrB0BW 0BVFnL6aVOZEAfpyjn6sjrFNGUddX63hwwopK3gKZSYYNubEoTHugBgSeWfrGWn6OAx6 GaXnn9QMGZGXWkpw+b1GNzUMxZX84pwY+poSn4Z924/N2jwtoqnyCvY17aW/l37G9ZTX U5Mn/ho/GjIfFY7VVJEEmsyWCw5OnKkQudqGN625fgCH7SfXtOAyTzDJtOcjcg1G7ilq 6FAlpuBMu9ANTyB/+idujIz7SPqncHHb0O/WyOMtdF7y/S/P8+vFhO6vHAcP7iNYPNVk gGuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G1jONuFVjJc90fxnR936INfyuLbvfOPXfUtlJ1hvKx0=; b=Fh1Cdc4klLfee53UCAPhFfEHBj8Rngn6MlOn3XuiT93zaeOA39u5T1QHnh1uL1KjwF uTpyC3dEfJ7Sy2lza9Tpd5muQShrGfY04mzvBPi/Wen8IX96oHjrMxhZn8ixEcP28Zhp i7Yk3QnmRFaxkqNFoTR6XD5zSKkJRV9FwwQfpYof9WUpsSkqTAWXtBPgw0RFp8utgfga TDeA1eQIaadCGuLbCPUQZesVkzU7RJwvab9lZKP/6KUy5vv6HY5H1EkCSgH1W1fNEjqr fBKc33AXPfHAJKwjboSe5QJzbmWWrrxioeUv4kAIQkjZVRKEYF0gpD/kNPjEy1hTsQl3 xAMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lKpJqmpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n17si19089421eja.271.2020.12.28.06.40.22; Mon, 28 Dec 2020 06:40:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lKpJqmpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390392AbgL1Ob7 (ORCPT + 99 others); Mon, 28 Dec 2020 09:31:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:39282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504127AbgL1ObE (ORCPT ); Mon, 28 Dec 2020 09:31:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8CDB720731; Mon, 28 Dec 2020 14:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165824; bh=928TzreslQ5IpUfPn0ImDZSaWSiNvOAFCxBNWBX/BXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lKpJqmpNhKp15UakrjjwmC1KgQszZPjdk5QVujHp1G6O+id+bLz8F4UVvDIlQI362 eLiIfX4n7t4+RewQH+z3YkEFWdw3n+Dc9wLxUIa5d5IjZ65dRWRwGgBMcfXAY23F2i VX9eXrtFDl3xBZ6c2g7fB8IuZ0Ss35hD2hN+lG6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Praveenkumar I , Miquel Raynal Subject: [PATCH 5.10 667/717] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read Date: Mon, 28 Dec 2020 13:51:05 +0100 Message-Id: <20201228125052.936376219@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Praveenkumar I commit bc3686021122de953858a5be4cbf6e3f1d821e79 upstream. After each codeword NAND_FLASH_STATUS is read for possible operational failures. But there is no DMA sync for CPU operation before reading it and this leads to incorrect or older copy of DMA buffer in reg_read_buf. This patch adds the DMA sync on reg_read_buf for CPU before reading it. Fixes: 5bc36b2bf6e2 ("mtd: rawnand: qcom: check for operation errors in case of raw read") Cc: stable@vger.kernel.org Signed-off-by: Praveenkumar I Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/1602230872-25616-1-git-send-email-ipkumar@codeaurora.org Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/qcom_nandc.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/mtd/nand/raw/qcom_nandc.c +++ b/drivers/mtd/nand/raw/qcom_nandc.c @@ -1570,6 +1570,8 @@ static int check_flash_errors(struct qco struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); int i; + nandc_read_buffer_sync(nandc, true); + for (i = 0; i < cw_cnt; i++) { u32 flash = le32_to_cpu(nandc->reg_read_buf[i]);