lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190513115926.3e862566@xps13>
Date:   Mon, 13 May 2019 11:59:26 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     masonccyang@...c.com.tw
Cc:     bbrezillon@...nel.org, computersforpeace@...il.com,
        dwmw2@...radead.org, juliensu@...c.com.tw,
        linux-kernel@...r.kernel.org, linux-mtd@...ts.infradead.org,
        marek.vasut@...il.com, richard@....at
Subject: Re: [PATCH v1] mtd: rawnand: Add Macronix NAND read retry support

Hi Mason,

masonccyang@...c.com.tw wrote on Mon, 13 May 2019 15:47:53 +0800:

> Hi Miquel,
> 
> 
> > >   
> > > >   
> > > > > +   if (ret)
> > > > > +      pr_err("set feature failed to read retry moded:%d\n",   
> mode); 
> > > > 
> > > >                        "Failed to set read retry mode: %d\n"
> > > > 
> > > > I think you can abort the operation with a negative return code in   
> this
> > > > case.
> > > >   
> > > 
> > > After set feature operation, this NAND device need a get feature   
> command 
> > 
> > You need to add a comment for this.  
> 
> okay, will add this comment by next version.
> 
> >   
> > > or
> > > SW reset command to exit read retry mode.
> > > Therefore, set features command followed by get feature command is   
> needed.
> > 
> > In this case you must check first that both set and get are supported.
> >   
> 
> okay, thanks.
> 
> 
> > > > > +
> > > > > +      if (mxic->reliability_func & MACRONIX_READ_RETRY_BIT) {
> > > > > +         chip->read_retries = MACRONIX_READ_RETRY_MODE + 1;   
> > > > 
> > > > Why +1 here, I am missing something?   
> > > 
> > > 
> > > Without + 1, read retry mode is up to 4 rather than 5.
> > > But this NAND device support read retry mode up to 5.
> > >   
> > 
> > If there are 5 modes, you need to set 5 to chip->read_retries, not 6.
> > 
> > If only 4 modes are used, there is probably a bug in the core that
> > must be fixed, please do not workaround it in the driver!  
> 
> 
> It seems some patches is needed in nand_base.c
> -------------------------------------------------------------------------------------
> diff --git a/drivers/mtd/nand/raw/nand_base.c 
> b/drivers/mtd/nand/raw/nand_base.c
> index ddd396e..56be3a9 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -3101,7 +3101,8 @@ static int nand_setup_read_retry(struct nand_chip 
> *chip, int retry_mode)
>  {
>         pr_debug("setting READ RETRY mode %d\n", retry_mode);
> 
> -       if (retry_mode >= chip->read_retries)
> +       if (retry_mode > chip->read_retries)

If I understand correctly, chip->read_retries is the total number of
'modes' so the last valid mode is indeed chip->read_retries -1.

I thought the problem would come from the core but I was wrong, you
actually need a MACRONIX_NUM_READ_RETRY_MODES set to 6. Please have two
defines if you need both (the first one being something like
MACRONIX_MAXIMUM_READ_RETRY_MODE set to 5).


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ