Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9433671pxu; Mon, 28 Dec 2020 16:23:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxImFqjXQNGkaaJRXr9nM6VnyDuUAhjwRgVHVHbK+lmbdB19HnyrM0zPwJ8jaw8hJSmYNJp X-Received: by 2002:a17:907:6e6:: with SMTP id yh6mr44429917ejb.512.1609201407633; Mon, 28 Dec 2020 16:23:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609201407; cv=none; d=google.com; s=arc-20160816; b=gEHFr57qlkn402LeJVwxJHVHdmZ2or/4o26AJEPf23lhFrBZcXXiSfUDeAQkjCPdZf 6VOBBweU31Y9tcYkMN6btBzkagvqdzkmIdtnPIt3xatjJ6GOumSxDrSeBVuAwrC4KzQy Ew9w6MBNU5GSGn8F1Z882ct3BGulZKB+NTlvUTouCCBGmqQbmCjplXkuZh2Tuzx9gvPS YlBDOihRMOJUnc8C5mUy+5xi+42WVi9Q1NBw+mcN7os0esQBrJPR730PWglOCLdeTbDE PaGJa5lbUWm5FS/sBNIdcl1UEf8iumIXUdGGgCv8SP+suMXBAMFcj3kYXEQwhU64eKlR ZgHw== 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=0D6diJo+i7k/cli3ocGimxEdJGjVBsY3t+UdIPz52RJyUG9HkwgZUfLwj3Yn7L0SC0 oBc8DbeJf57uRtUIlbZAmQpyOliu+IP2sNgUyQf9HAZj6bBF3Suf8yDQW6ZFk7O+AoU1 X1IfUIK9Jgj3kXgb4Bbcun9lyoZwm+Tkreo63R0UAbTj8SkBJZI2zMG9CMjGD0V76cVv iafcaSronS2PKLDg4rLhYV6C4tDZXrCrTe40i377LpgTgHx+KfaliaEpsXWC9y3vhOtn v2l5dx0IXXTtImV8UxpGyc8AV4RVgllTGzAVVno3A0WPCY/0nF21ijJ7v20he2eGz+4R HPWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hT6AA113; 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 ca22si18438502ejb.688.2020.12.28.16.23.05; Mon, 28 Dec 2020 16:23:27 -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=hT6AA113; 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 S2392651AbgL1P2J (ORCPT + 99 others); Mon, 28 Dec 2020 10:28:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:58638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406784AbgL1N5R (ORCPT ); Mon, 28 Dec 2020 08:57:17 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C01920715; Mon, 28 Dec 2020 13:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609163821; bh=928TzreslQ5IpUfPn0ImDZSaWSiNvOAFCxBNWBX/BXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hT6AA113hTBxOsHan/vj3Q/TCzh+xtmnCVSQOu7hnR3CMCyeP+1Hm8JIFO2JYHczo KLKonBU9hkkaZQS+s8aBkkKEdkFmt06WVsgmKTfr+QCgCZc5f74USEni6g6FkSw2y9 uoepAYv2biqDTX4jQKC7ntNaPIqTSb/plyQ4zV5E= 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.4 420/453] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read Date: Mon, 28 Dec 2020 13:50:56 +0100 Message-Id: <20201228124957.431039654@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@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]);