Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5547795yba; Wed, 10 Apr 2019 23:55:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoW45DSOwQaTI9Ll++cDj4H7ynIfRWWBGgg5/HRqLPBdHC85zpW/S7h0fc2XwOECMARvOb X-Received: by 2002:a65:5089:: with SMTP id r9mr45312371pgp.14.1554965716157; Wed, 10 Apr 2019 23:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554965716; cv=none; d=google.com; s=arc-20160816; b=j6MYc2dawxx0XAxyUd8iSIN4q+x7JBbz8SSo1XNnQzzuInDLH/3o/JiJmAflbxR3yh ZH0Exk+sqlS03RlNK50/A9rMkoazwhMOVbKL0cojHEZvYMq3pIzx4KQyFq9u03PNbVZf q1rMNjRn3XBTGRwJeHWPH1uv8T/FRMYS/wjxB7ayt9t1Syfh2mJNgsuwVcCznZYZWTUx WTQWox185JqwG6/17NXT6+Vssonu1qvb21+drfbIeUVSlQVdu9U714js95z50V4/bR36 hfyrem9gORsQv6vSynC569vdvZi5kiS4oDHQ35733DA+SdQzoXJyKZ6AgkjNmJmatFCP 8rpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=KX8JP1Sz+hsPWfgNZb4bDKjO2GTG7w2gncNry18N2TY=; b=g6XVAlPpgHQFtrZEK2XQnnSr6yzoKq+WSsm5m69SPn6w5V7N8CD79PbbB9zWJnW4Th kdBrSZhOJn4dhfnnqo0X51Uh2pFNO3xoNuEQ5NMS6ymlJdyoOl1hrm+8JIJ2e4BZVJ6B 1q/ruYxN4sBY7S00T+onM6JBFOCH2x8q8HVQc/Dm8iPOQKvK+7qF5NsCVxxFHpuqUO1D nkzQ7tdG/EHRu3NT+DLA9CSzlq53c89YUBfgk9226Ruq7iLt+sOqZcdPeeH1PiCBVMFg Sp9wmMx+ZWdfJJ9j6J0yNqfiT71Eak44Jv6zM/Wl1uVNzqjYlDYFagbVE14trUDvxlbx iwJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc18si36329485plb.363.2019.04.10.23.54.59; Wed, 10 Apr 2019 23:55:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726709AbfDKGx7 (ORCPT + 99 others); Thu, 11 Apr 2019 02:53:59 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:57254 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725783AbfDKGx6 (ORCPT ); Thu, 11 Apr 2019 02:53:58 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 7EC282756F7; Thu, 11 Apr 2019 07:53:56 +0100 (BST) Date: Thu, 11 Apr 2019 08:53:53 +0200 From: Boris Brezillon To: masonccyang@mxic.com.tw Cc: bbrezillon@kernel.org, computersforpeace@gmail.com, dwmw2@infradead.org, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, miquel.raynal@bootlin.com, richard@nod.at, zhengxunli@mxic.com.tw Subject: Re: [PATCH] mtd: rawnand: Add Macronix NAND read retry and randomizer support Message-ID: <20190411085353.4c1af008@collabora.com> In-Reply-To: References: <1554780172-23111-1-git-send-email-masonccyang@mxic.com.tw> <20190409090427.22de9917@collabora.com> <20190409114701.744c2c8c@collabora.com> <20190410092258.332ef399@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Apr 2019 12:23:11 +0800 masonccyang@mxic.com.tw wrote: > Hi Boris, > > > > > > Subject > > > > > > > > Re: [PATCH] mtd: rawnand: Add Macronix NAND read retry and > randomizer > > > support > > > > > > > > On Tue, 9 Apr 2019 17:35:39 +0800 > > > > masonccyang@mxic.com.tw wrote: > > > > > > > > > > > + > > > > > > > +static const struct kobj_attribute sysfs_mxic_nand = > > > > > > > + __ATTR(nand_random, S_IRUGO | S_IWUSR, > > > > > > > + mxic_nand_rand_type_show, > > > > > > > + mxic_nand_rand_type_store); > > > > > > > > > > > > No, we don't want to expose that through a sysfs file, > especially > > > since > > > > > > changing the randomizer config means making the NAND unreadable > for > > > > > > those that have used it before the change. > > > > > > > > > > > > > > > > Our on-die randomizer is still readable from user after the > function > > > > > is enabled. > > > > > > > > You mean the memory is still readable no matter the randomizer > state. > > > > Not sure how that's possible, but okay. > > > > > > > > > This randomizer is just like a internal memory cell > > > > > reliability enhanced. > > > > > > > > Why don't you enable it by default then? > > > > > > The penalty of randomizer is read/write performance down. > > > i.e,. tPROG 300 us to 340 us (randomizer enable) > > > therefore, disable it by default. > > > > I'm a bit puzzled. On the NAND I've seen that required data > > randomization it's not something you'd want to disable as this implied > > poor data retention. What's the use case here? Are we talking about SLC > > or MLC NANDs? Should we enable this feature once we start seeing that > > the NAND starts being less reliable (basically when read-retry happens > > more often)? I really think this is something you should decide kernel > > side, because users have no clue when it's appropriate to switch this > > feature on/off. > > > > It's SLC NAND and seems to has nothing to do with read-retry happens. > later, I will get more information for your concerns. Well, this feature is optional, and can be enabled to improve reliability. Sounds like a good reason to enable it when your NAND device starts showing reliability issues, and the number of read_retry attempts reflects the wear level pretty well. Alternatively, you could use the number of bitflips, but, in any case, don't expect the user to take this decision, because almost nobody knows what the randomizer is needed for. > > > > > > > > > > > > > It could be enable at any time with OTP bit function and that's > why > > > > > we patch it by sys-fs. > > > > > > > > Sorry, but that's not a good reason to expose that through sysfs. > > > > > > Any good way to expose randomizer function for user ? > > > > Don't expose it :P. > > oh, okay, I will remove sys-fs randomizer. > > Is it OK to keep set/get features for randomizer ? I don't think it's a good idea to have dead code, so no. But I'm pretty sure we'll find a way to use/expose this feature. > that is : > > +static void macronix_nand_onfi_init(struct nand_chip *chip) > +{ > + struct nand_parameters *p = &chip->parameters; > + struct kobject *kobj; > + int ret; > + > + if (p->onfi) { > + struct nand_onfi_vendor_macronix *mxic = > + (void > *)p->onfi->vendor; > + > + if (mxic->reliability_func & > MACRONIX_READ_RETRY_BIT) { > + chip->read_retries = > MACRONIX_READ_RETRY_MODE + 1; > + chip->setup_read_retry = > + macronix_nand_setup_read_retry; > + if > (p->supports_set_get_features) { > + set_bit(ONFI_FEATURE_ADDR_READ_RETRY, > + p->set_feature_list); > + set_bit(ONFI_FEATURE_ADDR_READ_RETRY, > + p->get_feature_list); > + } > + } > + > + if (mxic->reliability_func & > MACRONIX_RANDOMIZER_BIT) { > + if > (p->supports_set_get_features) { > + set_bit(ONFI_FEATURE_ADDR_MXIC_RANDOMIZER, > + p->set_feature_list); > + set_bit(ONFI_FEATURE_ADDR_MXIC_RANDOMIZER, > + p->get_feature_list); > + } > + } > + } > +} > + > > thanks & best regards, > Mason > > > > CONFIDENTIALITY NOTE: > > This e-mail and any attachments may contain confidential information > and/or personal data, which is protected by applicable laws. Please be > reminded that duplication, disclosure, distribution, or use of this e-mail > (and/or its attachments) or any part thereof is prohibited. If you receive > this e-mail in error, please notify us immediately and delete this mail as > well as its attachment(s) from your system. In addition, please be > informed that collection, processing, and/or use of personal data is > prohibited unless expressly permitted by personal data protection laws. > Thank you for your attention and cooperation. > > Macronix International Co., Ltd. > > ===================================================================== > > > > ============================================================================ > > CONFIDENTIALITY NOTE: > > This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. > > Macronix International Co., Ltd. > > =====================================================================