linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Mason Yang <masonccyang@mxic.com.tw>, Vignesh R <vigneshr@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	Julien Su <juliensu@mxic.com.tw>,
	Richard Weinberger <richard@nod.at>,
	Schrempf Frieder <frieder.schrempf@kontron.de>,
	Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 20/27] mtd: nand: Let software ECC engines be retrieved from the NAND core
Date: Mon, 25 Feb 2019 17:13:30 +0100	[thread overview]
Message-ID: <20190225171322.654189c8@kernel.org> (raw)
In-Reply-To: <20190225164933.4b0e1489@xps13>

On Mon, 25 Feb 2019 16:49:33 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hi Boris,
> 
> Boris Brezillon <bbrezillon@kernel.org> wrote on Fri, 22 Feb 2019
> 15:29:57 +0100:
> 
> > On Thu, 21 Feb 2019 13:57:59 +0100
> > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >   
> > > Before making use of the ECC engines, we must retrieve them. Add the
> > > boilerplate for the ones already available: software engines (Hamming
> > > and BCH).
> > > 
> > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > ---
> > >  drivers/mtd/nand/ecc/engine.c              | 14 ++++++++++++++
> > >  include/linux/mtd/nand-sw-bch-engine.h     |  3 +++
> > >  include/linux/mtd/nand-sw-hamming-engine.h |  3 +++
> > >  include/linux/mtd/nand.h                   |  3 +++
> > >  4 files changed, 23 insertions(+)
> > > 
> > > diff --git a/drivers/mtd/nand/ecc/engine.c b/drivers/mtd/nand/ecc/engine.c
> > > index 7dd3f9772698..318dbb2d56a2 100644
> > > --- a/drivers/mtd/nand/ecc/engine.c
> > > +++ b/drivers/mtd/nand/ecc/engine.c
> > > @@ -286,6 +286,20 @@ bool nand_ecc_correction_is_enough(struct nand_device *nand)
> > >  	return corr >= ds_corr && conf->strength >= reqs->strength;
> > >  }
> > >  
> > > +struct nand_ecc_engine *nand_ecc_sw_get_engine(struct nand_device *nand)    
> > 
> > What if you want to instantiate SW ECC with a custom layout? Can't we
> > instead have a function that create a new engine dynamically?
> > 
> > struct nand_ecc_engine *
> > nand_ecc_create_sw_engine(struct nand_device* nand,
> > 			  enum nand_ecc_algo algo,
> > 			  struct mtd_ooblayout *layout);
> > 
> >   
> 
> Right now, for both sw engines, a default layout is applied if there is
> none at engine initialization time.
> 
> Also, do we really need a "create" helper? I don't see what's created
> there. Maybe you had something else in mind, and the
> ecc_sw_xxx_get_engine() approach do not match what you expected, so
> please tell me more about your idea, otherwise I don't see what a
> nand_ecc_create_sw_engine() would bring.

The layout is part of the ECC engine properties, which I why I suggest
to create one engine instance per user and specify the layout to use
at instance creation time.

> 
> >   
> > > +{
> > > +	switch (nand->ecc.user_conf.algo) {    
> > 
> > Note that the conf is supposed to be passed afterwards, when the ctx is
> > created, so you should check nand->ecc.user_conf directly here.  
> 
> I think this is what I do so I suspect the above sentence is not what
> you actually meant?

Sorry, I meant "should not". My point is, the user_conf should only be
passed at context creation time, and should not be modified in-place by
the caller, unless proven necessary.

There's really 2 different steps that I think need to be isolated:

1/ retrieve/create an ECC engine instance (SW, HW-controller-side,
   on-die)
2/ ask this ECC engine instance to create a context out of a user conf

Your user_conf seems 2 mix the 2 concepts: the engine to use, the
strength/step-size you expect.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-25 16:13 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 12:57 [RFC PATCH 13/27] mtd: nand: ecc: Clarify the software Hamming introductory line Miquel Raynal
2019-02-21 12:57 ` [RFC PATCH 14/27] mtd: nand: ecc: Turn the software Hamming implementation generic Miquel Raynal
2019-02-21 13:22   ` Boris Brezillon
2019-02-21 12:57 ` [RFC PATCH 15/27] mtd: nand: Remove useless include about software Hamming ECC Miquel Raynal
2019-02-21 12:57 ` [RFC PATCH 16/27] mtd: nand: ecc: Let the software BCH ECC engine be a module Miquel Raynal
2019-02-21 13:48   ` Adam Ford
2019-02-21 14:02     ` Miquel Raynal
2019-02-22 14:24       ` Boris Brezillon
2019-02-21 12:57 ` [RFC PATCH 17/27] mtd: nand: ecc: Let the software Hamming ECC engine be unselected Miquel Raynal
2019-02-21 13:20   ` Boris Brezillon
2019-02-21 13:35     ` Miquel Raynal
2019-02-21 13:41       ` Boris Brezillon
2019-02-21 13:46         ` Miquel Raynal
2019-02-21 12:57 ` [RFC PATCH 18/27] mtd: nand: ecc: Create the software BCH engine instance Miquel Raynal
2019-02-21 12:57 ` [RFC PATCH 19/27] mtd: nand: ecc: Create the software Hamming " Miquel Raynal
2019-02-21 12:57 ` [RFC PATCH 20/27] mtd: nand: Let software ECC engines be retrieved from the NAND core Miquel Raynal
2019-02-22 14:29   ` Boris Brezillon
2019-02-25 15:49     ` Miquel Raynal
2019-02-25 16:13       ` Boris Brezillon [this message]
2019-02-26 15:54         ` Miquel Raynal
2019-02-21 12:58 ` [RFC PATCH 21/27] mtd: spinand: Fix typo in comment Miquel Raynal
2019-02-22 14:31   ` Boris Brezillon
2019-02-21 12:58 ` [RFC PATCH 22/27] mtd: spinand: Let the SPI-NAND core flag a SPI-NAND chip Miquel Raynal
2019-02-22 14:33   ` Boris Brezillon
2019-02-21 12:58 ` [RFC PATCH 23/27] mtd: spinand: Move the ECC helper functions into a separate file Miquel Raynal
2019-02-21 12:58 ` [RFC PATCH 24/27] mtd: spinand: Instantiate a SPI-NAND on-die ECC engine Miquel Raynal
2019-02-22 14:38   ` Boris Brezillon
2019-02-21 12:58 ` [RFC PATCH 25/27] mtd: nand: Add helpers to manage ECC engines and configurations Miquel Raynal
2019-02-22 14:44   ` Boris Brezillon
2019-02-25 16:01     ` Miquel Raynal
2019-02-25 16:34       ` Boris Brezillon
2019-02-25 18:48         ` Boris Brezillon
2019-02-26 15:59           ` [RFC PATCH 25/27] mtd: nand: Add helpers to manage ECC engines and configurationsND Miquel Raynal
2019-02-26 16:04             ` Boris Brezillon
2019-02-27 14:07     ` [RFC PATCH 25/27] mtd: nand: Add helpers to manage ECC engines and configurations Miquel Raynal
2019-02-27 14:30       ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190225171322.654189c8@kernel.org \
    --to=boris.brezillon@collabora.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=juliensu@mxic.com.tw \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=masonccyang@mxic.com.tw \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).