All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Mike Dunn <mikedunn@newsguy.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 12/13] mtd/docg3: add ECC correction code
Date: Mon, 31 Oct 2011 17:39:19 +0100	[thread overview]
Message-ID: <87vcr586a0.fsf@free.fr> (raw)
In-Reply-To: <4EAE9FB6.6090200@newsguy.com> (Mike Dunn's message of "Mon, 31 Oct 2011 06:16:38 -0700")

Mike Dunn <mikedunn@newsguy.com> writes:

> Hi Robert,
>
> A few comments (limited to the bch decode for now)...
> To avoid confusion with the terminology in Ivan's BCH algorithm, I wouldn't call
> it calc_ecc.  It's actually recv_ecc ^ calc_ecc, where recv_ecc is what the hw
> read from the ecc field of the oob data, and calc_ecc is what the hw calculated
> from the page data.  Maybe just hwecc or similiar.
Yep, point taken for V2, hwecc sounds good.

...zip...
>> +	numerrs = decode_bch(docg3_bch, NULL, DOC_ECC_BCH_COVERED_BYTES,
>> +			     NULL, ecc, NULL, errorpos);
> This looks right, with the redefined DOC_ECC_BCH_COVERED_BYTES (now 520).   
>
> Some commentary would be helpful (though maybe I'm too verbose)...
>
>     /*
>      * The hardware ecc unit produces oob_ecc ^ calc_ecc.  The kernel's bch
>      * algorithm is used to decode this.  However the hw operates on page
>      * data in a bit order that is the reverse of that of the bch alg,
>      * requiring that the bits be reversed on the result.  Thanks to Ivan
>      * Djelic for his analysis.
>      */
Right again. I will copy paste that explanation in the code.

> I recommend you test this.  One way would be to compile the bch algorithm in
> userspace and use it to generate the ecc for a 520  byte test vector.  Reverse
> the bits of this ecc, then flip a few bits in the test vector and write it to a
> page in flash, with your driver modified to write the calculated ecc instead of
> that served up by the hardware.  Then when you read the page, the above code
> should identify and correct the bits you flipped (assuming a genuine flash error
> did not occur while reading back the page).  I have the bch alg modified for
> userspace, if that would help.
I did test it in userspace.
And after Ivan's proposition, I tested it also with nandwrite/nanddump by
introducing some random errors. The error correction code works, a few
amendments (for V2) will be added for "bitflipped" data writes/reads.

But the conclusion is that Ivan and your work is indeed directly applicable in
the G3 case, and tested :)

>> +	if (numerrs < 0)
>> +		return numerrs;
>
> I recommend you check for the -EINVAL return value and issue a big fat error. 
> Maybe BUG_ON(numerrs == -EINVAL), at least for now.
Okay.

>
> Another explanatory comment here...
>     /* undo last step in BCH alg (modulo mirroring not needed) */
Is that the same as the function comment about bit reversing (the modulo
mirroring part) ? If so, the function comment might not be clear enough. If not,
could you explain a bit further please ?

Thanks for the review.

Cheers.

--
Robert

  reply	other threads:[~2011-10-31 16:39 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 17:51 [PATCH 00/13] DocG3 fixes and write support Robert Jarzmik
2011-10-28 17:51 ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 01/13] mtd/docg3: fix debug log verbosity Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 02/13] mtd/docg3: fix tracing of IO in writeb Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 03/13] mtd/docg3: fix protection areas reading Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 04/13] mtd/docg3: fix BCH registers Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 05/13] mtd/docg3: add multiple floor support Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-31 17:32   ` Mike Dunn
2011-10-31 19:32     ` Robert Jarzmik
2011-11-01 12:59       ` Mike Dunn
2011-10-28 17:51 ` [PATCH 06/13] mtd/docg3: add OOB layout to mtdinfo Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 07/13] mtd/docg3: add registers for erasing and writing Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 08/13] mtd/docg3: add OOB buffer to device structure Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 09/13] mtd/docg3: add write functions Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 10/13] mtd/docg3: add erase functions Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 11/13] mtd/docg3: map erase and write functions Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-28 17:51 ` [PATCH 12/13] mtd/docg3: add ECC correction code Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-29  8:52   ` Ivan Djelic
2011-10-29  8:52     ` Ivan Djelic
2011-10-29  9:09     ` Ivan Djelic
2011-10-29  9:09       ` Ivan Djelic
2011-10-29 16:37     ` Robert Jarzmik
2011-10-29 16:37       ` Robert Jarzmik
2011-10-30  0:10       ` Ivan Djelic
2011-10-30  0:10         ` Ivan Djelic
2011-10-31 13:16   ` Mike Dunn
2011-10-31 16:39     ` Robert Jarzmik [this message]
2011-10-31 17:32       ` Mike Dunn
2011-10-28 17:51 ` [PATCH 13/13] mtd/docg3: add suspend and resume Robert Jarzmik
2011-10-28 17:51   ` Robert Jarzmik
2011-10-30  0:41 ` [PATCH 00/13] DocG3 fixes and write support Marek Vasut
2011-10-30  0:41   ` Marek Vasut
2011-10-30  9:04   ` Robert Jarzmik
2011-10-30  9:04     ` Robert Jarzmik
2011-10-30 21:43     ` Mike Dunn
2011-10-30 21:43       ` Mike Dunn
2011-10-30 22:18       ` Marek Vasut
2011-10-30 22:18         ` Marek Vasut
2011-10-30 21:59 ` Mike Dunn

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=87vcr586a0.fsf@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mikedunn@newsguy.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.