Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp584147rwl; Wed, 12 Apr 2023 00:48:14 -0700 (PDT) X-Google-Smtp-Source: AKy350Z7ggcDVtHK337t+35Q5+kpDrSjScThCGn/F1+ciHmgKOxFs5Z/yRYNQ02is1d4vlu+lNDK X-Received: by 2002:a17:906:3608:b0:94d:8b66:46c6 with SMTP id q8-20020a170906360800b0094d8b6646c6mr5006631ejb.2.1681285694014; Wed, 12 Apr 2023 00:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681285693; cv=none; d=google.com; s=arc-20160816; b=eWwVWVmQ8jhneRtFByz3yeczVmsJSOAo2eN0hi9vL30lt+hy1g8J+kZBjTz1D+Yz4L krckbC8IBNZGr8F1Z4DkuDkw/NtdQ9LcBbmL4cye9EGkEtzxb7X9851QWat2ezIGZFpM VcRB+agjauDH4pkQqKKMsuDztAilDzG8A7dnFXcSSzu9BQ0uEiQ6pvpkqZod0Cytk09b IQcBJDx9bQ5mM2eN9fW6po1NTG9y7F8tvWBtDeoXW6nzGRqGrAV1FEoPqFo/KWj99Ukf Mq6GjkXddA2iBBHKCb2K0JnP+aEeCI4qvIbXE5B4Yah8qhWmL9f0twSTgRC36uqMymZs ilgA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Tl8qiw+0w9MXIDlH7WD7qEaE1rT27aC7+yddYMTRrAw=; b=FybhPLTF1ZGBAtKUSGd/any5j+6qa8ugVcY+qEBg4MJGwNnP01PQq0KFQq75BGJzbz XtRo2gtziLNITNMHqdIt9M8UA8l5oxg8pGp5nfx2ok3msMj2wwD2RKRpiPHL/YIl7XC6 b+cSSB7AZFhCbi9lv4msr7TNT/bb8n7EHDjKXZXX6eIg5O3uXlE0ge4h9RghQPTEWVQn 77Wik5BNZA0Lc5QTAwKWPkYB9qXTf9kzc2z2sNtgg8BpN+tLnhut2OxL8AsJLNBdGI8W M8v7/m1RCnHGZm7FUG4JFgYef9ZbXmUP81Oe3P6IYnuMrypdszVWG1EsME2qd0AWQKQu 75Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=lJFRUAVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x13-20020a170906710d00b0094aa6845719si859376ejj.758.2023.04.12.00.47.49; Wed, 12 Apr 2023 00:48:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=lJFRUAVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjDLHrL (ORCPT + 99 others); Wed, 12 Apr 2023 03:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjDLHrI (ORCPT ); Wed, 12 Apr 2023 03:47:08 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B80F41705 for ; Wed, 12 Apr 2023 00:47:06 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3D6624000D; Wed, 12 Apr 2023 07:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1681285625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tl8qiw+0w9MXIDlH7WD7qEaE1rT27aC7+yddYMTRrAw=; b=lJFRUAVhi7QhjUM8KhE+bGlOqqK83Y/4D+qAyp5DwQQOZZI5l1bx4mxWQp8wABN4tq5s+E QBNuVdRF4QssaRpZ28GzbgW/xfL3D243aKGL9REjBJIuoogtrxz6VSWsWkBIBVqwa1U4Ng fqGRSjomysmXiRzUrMD67xfDO5il0YYbmpYM9Rtp+okcjoXkDgJvsX0r7lh7esFYhqgy4g Ra/urhTpfr3E/UGeLNwoJJqdxV+8QrjKnDEBNRAc1kHq7rRdAGYDLzpx2vR9Ucqz2Pnwav gZDnLUv7NEJWL4amjDFonyAXW3j9iH/i/h+mxmyS8+dVUlA2xcoripRiMxbT6A== Date: Wed, 12 Apr 2023 09:47:02 +0200 From: Miquel Raynal To: Arseniy Krasnov Cc: Liang Yang , Richard Weinberger , Vignesh Raghavendra , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jianxin Pan , Yixun Lan , , , , , , Subject: Re: [PATCH v1 4/5] mtd: rawnand: meson: clear OOB buffer before read Message-ID: <20230412094651.39f4dbf6@xps-13> In-Reply-To: <20230412094400.3c82f631@xps-13> References: <20230412061700.1492474-1-AVKrasnov@sberdevices.ru> <20230412061700.1492474-5-AVKrasnov@sberdevices.ru> <20230412094400.3c82f631@xps-13> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi again, miquel.raynal@bootlin.com wrote on Wed, 12 Apr 2023 09:44:00 +0200: > Hi Arseniy, >=20 > AVKrasnov@sberdevices.ru wrote on Wed, 12 Apr 2023 09:16:58 +0300: >=20 > > This NAND reads only few user's bytes in ECC mode (not full OOB), so =20 >=20 > "This NAND reads" does not look right, do you mean "Subpage reads do > not retrieve all the OOB bytes,"? >=20 > > fill OOB buffer with zeroes to not return garbage from previous reads > > to user. > > Otherwise 'nanddump' utility prints something like this for just erased > > page: > >=20 > > ... > > 0x000007f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > > OOB Data: ff ff ff ff 00 00 ff ff 80 cf 22 99 cb ad d3 be > > OOB Data: 63 27 ae 06 16 0a 2f eb bb dd 46 74 41 8e 88 6e > > OOB Data: 38 a1 2d e6 77 d4 05 06 f2 a5 7e 25 eb 34 7c ff > > OOB Data: 38 ea de 14 10 de 9b 40 33 16 6a cc 9d aa 2f 5e > >=20 > > Signed-off-by: Arseniy Krasnov > > --- > > drivers/mtd/nand/raw/meson_nand.c | 5 +++++ > > 1 file changed, 5 insertions(+) > >=20 > > diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/m= eson_nand.c > > index f84a10238e4d..f2f2472cb511 100644 > > --- a/drivers/mtd/nand/raw/meson_nand.c > > +++ b/drivers/mtd/nand/raw/meson_nand.c > > @@ -858,9 +858,12 @@ static int meson_nfc_read_page_sub(struct nand_chi= p *nand, > > static int meson_nfc_read_page_raw(struct nand_chip *nand, u8 *buf, > > int oob_required, int page) > > { > > + struct mtd_info *mtd =3D nand_to_mtd(nand); > > u8 *oob_buf =3D nand->oob_poi; > > int ret; > > =20 > > + memset(oob_buf, 0, mtd->oobsize); =20 Should use 0xff instead of 0x00, that's the default state of a NAND cell. And also this memset should be conditioned to 'oob_required' I guess? >=20 > I'm surprised raw reads do not read the entire OOB? >=20 > > + > > ret =3D meson_nfc_read_page_sub(nand, page, 1); > > if (ret) > > return ret; > > @@ -881,6 +884,8 @@ static int meson_nfc_read_page_hwecc(struct nand_ch= ip *nand, u8 *buf, > > u8 *oob_buf =3D nand->oob_poi; > > int ret, i; > > =20 > > + memset(oob_buf, 0, mtd->oobsize); > > + > > ret =3D meson_nfc_read_page_sub(nand, page, 0); > > if (ret) > > return ret; =20 >=20 >=20 > Thanks, > Miqu=C3=A8l Thanks, Miqu=C3=A8l