From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Samuel Holland <samuel@sholland.org>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Boris Brezillon <bbrezillon@kernel.org>,
Brian Norris <computersforpeace@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 6/7] mtd: rawnand: sunxi: Update OOB layout to match hardware
Date: Mon, 2 Jan 2023 17:53:51 +0100 [thread overview]
Message-ID: <20230102175351.64690aaf@xps-13> (raw)
In-Reply-To: <e21aba9f-1afd-2615-fe00-3ee4176b9080@sholland.org>
Hi Samuel,
samuel@sholland.org wrote on Mon, 2 Jan 2023 10:26:48 -0600:
> Hi Miquèl,
>
> On 1/2/23 03:21, Miquel Raynal wrote:
> > Hi Samuel,
> >
> > samuel@sholland.org wrote on Thu, 29 Dec 2022 12:15:25 -0600:
> >
> >> When using the hardware ECC engine, the OOB data is made available in
> >> the NFC_REG_USER_DATA registers, one 32-bit word per ECC step. Any
> >> additional bytes are only accessible through raw reads and software
> >> descrambling. For efficiency, and to match the vendor driver, ignore
> >> these extra bytes.
> >>
> >> Signed-off-by: Samuel Holland <samuel@sholland.org>
> >> ---
> >>
> >> drivers/mtd/nand/raw/sunxi_nand.c | 7 +++++++
> >> 1 file changed, 7 insertions(+)
> >>
> >> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
> >> index 8e873f4fec9a..a3bc9f7f9e5a 100644
> >> --- a/drivers/mtd/nand/raw/sunxi_nand.c
> >> +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> >> @@ -1604,6 +1604,13 @@ static int sunxi_nand_ooblayout_free(struct mtd_info *mtd, int section,
> >> return 0;
> >> }
> >>
> >> + /*
> >> + * The controller does not provide access to OOB bytes
> >> + * past the end of the ECC data.
> >> + */
> >> + if (section == ecc->steps && ecc->engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST)
> >> + return -ERANGE;
> >
> > Again, I am sorry but I cannot take this change, it would typically
> > break jffs2 users (if any?) :(
>
> Considering the bug I fixed in the previous patch, and the fact that
> mtd_ooblayout_free() zeroes out the structure before calling the .free
> callback, that region was being reported with a length of zero already.
> So I don't think anyone could have been using those bytes anyway.
>
> I am looking for a solution here because the ECC/scrambling engine
> really provides no way to access these bytes. Reading them requires
> turning off the ECC engine, performing another read command, and then
> descrambling in software. So we are sort of lying when we claim those
> bytes are available with hardware ECC enabled.
>
> If this change cannot be made as-is, is there any way the user could opt
> in to the new layout, to get the improved performance?
Actually that's true, you fixed the reporting of the free area which
was set to 0 until then, which means there cannot be any upstream user.
So knowing that, preventing the accesses to the end of the area seems
acceptable when using HW ECC. Please mention it in the commit log.
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-01-02 16:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-29 18:15 [PATCH 0/7] mtd: rawnand: sunxi: Bug fixes and cleanup Samuel Holland
2022-12-29 18:15 ` [PATCH 1/7] mtd: rawnand: sunxi: Clean up chips after failed init Samuel Holland
2023-01-02 11:20 ` Miquel Raynal
2022-12-29 18:15 ` [PATCH 2/7] mtd: rawnand: sunxi: Remove an unnecessary check Samuel Holland
2023-01-02 8:59 ` Miquel Raynal
2023-01-02 11:20 ` Miquel Raynal
2022-12-29 18:15 ` [PATCH 3/7] " Samuel Holland
2023-01-02 11:20 ` Miquel Raynal
2022-12-29 18:15 ` [PATCH 4/7] mtd: rawnand: sunxi: Fix ECC strength maximization Samuel Holland
2023-01-02 9:11 ` Miquel Raynal
2023-01-02 15:59 ` Samuel Holland
2023-01-02 16:45 ` Miquel Raynal
2023-01-02 17:06 ` Samuel Holland
2023-01-03 14:41 ` Miquel Raynal
2022-12-29 18:15 ` [PATCH 5/7] mtd: rawnand: sunxi: Fix the size of the last OOB region Samuel Holland
2023-01-02 9:00 ` Gole, Dhruva
2023-01-02 11:20 ` Miquel Raynal
2022-12-29 18:15 ` [PATCH 6/7] mtd: rawnand: sunxi: Update OOB layout to match hardware Samuel Holland
2023-01-02 9:21 ` Miquel Raynal
2023-01-02 16:26 ` Samuel Holland
2023-01-02 16:53 ` Miquel Raynal [this message]
2022-12-29 18:15 ` [PATCH 7/7] mtd: rawnand: sunxi: Precompute the ECC_CTL register value Samuel Holland
2023-01-02 9:30 ` Miquel Raynal
2023-01-02 16:33 ` Samuel Holland
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=20230102175351.64690aaf@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=bbrezillon@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=richard@nod.at \
--cc=samuel@sholland.org \
--cc=vigneshr@ti.com \
--cc=wens@csie.org \
/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).