Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2447238rdh; Wed, 27 Sep 2023 03:01:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEYYqgMkav0apJ4cMTeGC2V3JMVaGhfOZ4xincKLeXpaqoAmxbMEKEq+mco9kOCHofqANU X-Received: by 2002:a05:6a21:99a0:b0:13e:fb5e:b460 with SMTP id ve32-20020a056a2199a000b0013efb5eb460mr7571774pzb.0.1695808876446; Wed, 27 Sep 2023 03:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695808876; cv=none; d=google.com; s=arc-20160816; b=VG6ZjXaIlFpduRo0k0l0X/xOiUQdqBwH9RuzpLoeZcMZ93t0sCanUFksqO4bukJNkJ +u4RGXvT5rTahwIVWeVp7eFzyMevtZUl1fVYYHteBY8qInvRrbQxsQo231Ps+AiDnet8 0Q/T9eEV75VxubQdz37mXCk4gzMdpqiCD3ylqzH4IgKjxqHI2jQopykafhSSnvS829kF Y+pOVFLyAYLWmf6mLPPTcEbcc3N/rPnkzE17NFQ9QlOFNdMRSeZtDk4vCCrGPtSxClAW fUMZjDmQ/j9gUb1DbOlbNmzsS/DS2ITXy2hO1V0jBM/slT7YUbepCNFYiWro4GMG5w8b twsg== 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=5LcK6dI4OVh5Gzyit6uVMZ8fakHesIzRAd0wZI3BRtU=; fh=z0SvuLAWjDjLhy2944oiqx9Br5XuclButUgaVFS0hsM=; b=uXO4K6C0zkzGKOKIam1VukuDNLSyQnDDWvPEKj5eMTOscHiNUbrIKEBrxAnFs1YDzA MlQnNwocfhsku0DMRJT40+s0FYBA+gJwy3v9txnb7OHpyRBLGuxel5vKAHVwJlZSvdQK WZSq5CQcWxl6rHH7T5jJjnN1YjHTzcijJUxUrJ7WMria0Y1kmxdbcyYaKUq4Z3TZi5Ox WLmdjjrff8mCCcr1rAGScOHaNDY60rL79QECODhA9zPz2Im9nU0QCWPN+xDOdmksk7gC FIEtQ5WyORb4GvwO5oxMQDO6kDMCIGj+cxxG3a+qxP2WW8wKUlOMdzbW2vbbGZ1kSPeY 28Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=XMbLRSjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ca16-20020a056a00419000b0069342aef90bsi24845pfb.3.2023.09.27.03.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 03:01:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=XMbLRSjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 91186805B05D; Wed, 27 Sep 2023 00:20:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbjI0HUt (ORCPT + 99 others); Wed, 27 Sep 2023 03:20:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjI0HUs (ORCPT ); Wed, 27 Sep 2023 03:20:48 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1883D12A; Wed, 27 Sep 2023 00:20:44 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 47F3440004; Wed, 27 Sep 2023 07:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1695799243; 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=5LcK6dI4OVh5Gzyit6uVMZ8fakHesIzRAd0wZI3BRtU=; b=XMbLRSjILomfFUq/MjK4Th5sCQUTetyE6HeauprCGjmQJYi8gDHM0o6OO1I7dMc6O4Dw0q P9f4uMb/v3qpgZ+hqpgBkrxqH5msSr0YScHzFG+jqkXee9ROfrOjRhrGf/do2w37bQkRb1 JQOfgxtUUHZPcNSawtYm5Vx6Vg+i8BkVURqUczGlLyE8JmMaEBhF9fFUnR2d+837UG8R52 B657LhcNRgZOUGLX4gLGUxXh6K4QaCZwx8rx16UdkvPYK8XWpPIt6O1AqAJPFrZuHBhx/L 7Y2SL4PbtnOonUyykSBaUYC4h8Z+2gakdzq3DyyGKjtn6S/EGr97PbHByfT4FA== Date: Wed, 27 Sep 2023 09:20:41 +0200 From: Miquel Raynal To: Domenico Punzo Cc: Martin =?UTF-8?B?SHVuZGViw7hsbA==?= , Rouven Czerwinski , =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= , Alexander Shiyan , Richard Weinberger , Vignesh Raghavendra , JaimeLiao , "kernel@pengutronix.de" , "stable@vger.kernel.org" , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Sean =?UTF-8?B?Tnlla2rDpnI=?= , Bean Huo Subject: Re: [EXT] Re: [PATCH v2] mtd: rawnand: Ensure the nand chip supports cached reads Message-ID: <20230927092041.1ba97701@xps-13> In-Reply-To: References: <20230922141717.35977-1-r.czerwinski@pengutronix.de> <20230926132725.5d570e1b@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-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 27 Sep 2023 00:20:57 -0700 (PDT) Hi Domenico, dpunzo@micron.com wrote on Wed, 27 Sep 2023 06:28:04 +0000: > Micron Confidential >=20 > Hello Miquel, >=20 > The MPN mt29f4g08abadawp is a single LUN device and it is supposed to sup= port cache read with the limitation reported into the datasheet. Yes, but this limitation is not covered by the ONFI specification. > Can you clarify about the IDs list you need? In the NAND core, we need to know which devices do/do not support sequential cache reads *with* ECC enabled. We can look at the parameter page and know whether sequential cache reads are supported or not, but there is no way (as far as I know) to detect whether a chip supports sequential cache reads with ECC enabled other than looking at the datasheet. Can you help by either telling how we can dynamically discover whether ECC can be enabled during cache operations on Micron NAND chips or, if that is not possible, provide a list of devices which support it? Thanks, Miqu=C3=A8l >=20 > Thanks. > Regards, > Domenico P. >=20 >=20 >=20 >=20 > Micron Confidential > -----Original Message----- > From: Miquel Raynal > Sent: Tuesday, September 26, 2023 1:27 PM > To: Martin Hundeb=C3=B8ll > Cc: Rouven Czerwinski ; M=C3=A5ns Rullg=C3= =A5rd ; Alexander Shiyan ; Ri= chard Weinberger ; Vignesh Raghavendra ; J= aimeLiao ; kernel@pengutronix.de; stable@vger.kerne= l.org; linux-mtd@lists.infradead.org; linux-kernel@vger.kernel.org; Sean Ny= ekj=C3=A6r ; Domenico Punzo ; Bean Huo = > Subject: [EXT] Re: [PATCH v2] mtd: rawnand: Ensure the nand chip supports= cached reads >=20 > CAUTION: EXTERNAL EMAIL. Do not click links or open attachments unless yo= u recognize the sender and were expecting this message. >=20 >=20 > Hi Martin, >=20 > + Bean and Domenico, there is a question for you below. >=20 > martin@geanix.com wrote on Mon, 25 Sep 2023 13:01:06 +0200: >=20 > > Hi Rouven, > > > > On Fri, 2023-09-22 at 16:17 +0200, Rouven Czerwinski wrote: =20 > > > Both the JEDEC and ONFI specification say that read cache sequential > > > support is an optional command. This means that we not only need to > > > check whether the individual controller supports the command, we > > > also need to check the parameter pages for both ONFI and JEDEC NAND > > > flashes before enabling sequential cache reads. > > > > > > This fixes support for NAND flashes which don't support enabling > > > cache reads, i.e. Samsung K9F4G08U0F or Toshiba TC58NVG0S3HTA00. > > > > > > Sequential cache reads are now only available for ONFI and JEDEC > > > devices, if individual vendors implement this, it needs to be > > > enabled per vendor. > > > > > > Tested on i.MX6Q with a Samsung NAND flash chip that doesn't support > > > sequential reads. > > > > > > Fixes: 003fe4b9545b ("mtd: rawnand: Support for sequential cache > > > reads") > > > Cc: stable@vger.kernel.org > > > Signed-off-by: Rouven Czerwinski =20 > > > > Thanks for this. It works as expected for my Toshiba chip, obviously > > because it doesn't use ONFI or JEDEC. > > > > Unfortunately, my Micron chip does use ONFI, and it sets the cached- > > read-supported bit. It then fails when reading afterwords: > > > > kernel: ONFI_OPT_CMD_READ_CACHE # debug added by me > > kernel: nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc > > kernel: nand: Micron MT29F4G08ABAFAWP > > kernel: nand: 512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB > > size: 256 > > kernel: nand: continued read supported # debug added by me > > kernel: Bad block table found at page 131008, version 0x01 > > kernel: Bad block table found at page 130944, version 0x01 > > kernel: 2 fixed-partitions partitions found on MTD device gpmi-nand > > kernel: Creating 2 MTD partitions on "gpmi-nand": > > kernel: 0x000000000000-0x000000800000 : "boot" > > kernel: 0x000000800000-0x000020000000 : "ubi" > > kernel: gpmi-nand 1806000.nand-controller: driver registered. > > > > ... > > > > kernel: ubi0: default fastmap pool size: 100 > > kernel: ubi0: default fastmap WL pool size: 50 > > kernel: ubi0: attaching mtd1 > > kernel: ubi0: scanning is finished > > kernel: ubi0: attached mtd1 (name "ubi", size 504 MiB) > > kernel: ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes > > kernel: ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096 > > kernel: ubi0: VID header offset: 4096 (aligned 4096), data offset: > > 8192 > > kernel: ubi0: good PEBs: 2012, bad PEBs: 4, corrupted PEBs: 0 > > kernel: ubi0: user volume: 9, internal volumes: 1, max. volumes count: > > 128 > > kernel: ubi0: max/mean erase counter: 4/2, WL threshold: 4096, image > > sequence number: 1431497221 > > kernel: ubi0: available PEBs: 12, total reserved PEBs: 2000, PEBs > > reserved for bad PEB handling: 36 > > kernel: block ubiblock0_4: created from ubi0:4(rootfs.a) > > kernel: ubi0: background thread "ubi_bgt0d" started, PID 36 > > kernel: block ubiblock0_6: created from ubi0:6(appfs.a) > > kernel: block ubiblock0_7: created from ubi0:7(appfs.b) > > > > ... > > > > kernel: SQUASHFS error: Unable to read directory block [4b6d15c:ed1] > > kernel: SQUASHFS error: Unable to read directory block [4b6f15e:125] > > kernel: SQUASHFS error: Unable to read directory block [4b6d15c:1dae] > > kernel: SQUASHFS error: Unable to read directory block [4b6d15c:ed1] > > (d-sysctl)[55]: systemd-sysctl.service: Failed to set up credentials: > > Protocol error > > kernel: SQUASHFS error: Unable to read directory block [4b73162:14f0] > > kernel: SQUASHFS error: Unable to read directory block [4b6f15e:838] > > systemd[1]: Starting Create Static Device Nodes in /dev... > > kernel: SQUASHFS error: Unable to read directory block [4b6d15c:ed1] > > kernel: SQUASHFS error: Unable to read directory block [4b6d15c:ed1] > > kernel: SQUASHFS error: Unable to read directory block [4b6f15e:838] > > kernel: SQUASHFS error: Unable to read directory block [4b6d15c:1dae] > > kernel: SQUASHFS error: Unable to read directory block [4b6f15e:125] > > > > I've briefly tried adding some error info the the squashfs error > > messages, but it looks like it's getting bad data. I.e. one failure a > > sanity check of `dir_count`: > > > > if (dir_count > SQUASHFS_DIR_COUNT) > > goto data_error; > > > > It fails with `dir_count` being 1952803684 ... > > > > So is this a case of wrong/bad timings? > > > > Miquel: > > I can tell from the code, that the READCACHESEQ operations are > > followed by NAND_OP_WAIT_RDY(tR_max, tRR_min). From the Micron > > datasheet[0], it should be NAND_OP_WAIT_RDY(tRCBSY_max, tRR_min), > > where tRCBSY is defined to be between 3 and 25 =C2=B5s. =20 >=20 > I found a place in the ONFI spec states taht tRCBSY_max should be between= 3 and tR_max, so indeed we should be fine on that regard. >=20 > However, I asked myself whether we could have issues when crossing bounda= ries. Block boundaries should be fine, however your device does not support= crossing plane boundaries, as bit 4 ("read cache > supported") of byte 114 ("Multi-plane operation attributes") in the memor= y organization block of the parameter page is not set (the value of the byt= e should be 0x0E if I get it right. >=20 > Anyway, our main issue here does not seem related to the boundaries. It d= oes not seem to be explicitly marked anywhere else but on the front > page: > Advanced command set > =E2=80=93 Program page cache mode (4) > =E2=80=93 Read page cache mode (4) > =E2=80=93 Two-plane commands (4) >=20 > (4) These commands supported only with ECC disabled. >=20 > Read page cache mode without ECC makes the feature pretty useless IMHO. >=20 > Bean, Domenico, how do we know which devices allow ECC correction during = sequential page reads and which don't? Is there a (vendor?) bit somewhere i= n the parameter page for that? Do we have any way to know besides a list of= devices allowing that? If so, can you provide one with a few IDs? >=20 > Thanks, > Miqu=C3=A8l