All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Milton Miller II" <miltonm@us.ibm.com>,
	"Cédric Le Goater" <clg@kaod.org>
Cc: openbmc@lists.ozlabs.org
Subject: Re: [PATCH dev-5.0 3/4] mtd: spi-nor: aspeed: use memcpy_fromio() to capture the optimization buffer
Date: Thu, 18 Apr 2019 21:03:20 -0400	[thread overview]
Message-ID: <a8ab1055-64c6-4763-b244-2a17e70a10a1@www.fastmail.com> (raw)
In-Reply-To: <OF33F9274D.5DFDAC84-ON002583E0.00758962-002583E0.0075896A@notes.na.collabserv.com>



On Fri, 19 Apr 2019, at 06:53, Milton Miller II wrote:
> About 04/17/2019 09:20AM in some timezone, Cédric Le Goater wrote:
> 
> 
> >aspeed_smc_read_from_ahb() only reads the first word which is not
> >what
> >we want. We want to capture a CALIBRATE_BUF_SIZE size window of the
> >flash contents to optimize the read.
> >
> 
> NACK
> 
> This justifcation is false.  The routine reads the whole buffer
> because it calls the _rep routine and takes the size.
> 
> In addition, the comment just before aspeed_smc_read_from_ahb
> tells why memcpy_fromio and memcpy_toio are broken on 32 bit
> arm, and this is still the case judging from the recent bug
> reportfrom a Nuvaton user [1].
> 
> [1] https://github.com/openbmc/openbmc/issues/3521
> 
> Andrew, Please revert this patch.

Yeah, I had a briefly nagging thought about this when I applied it. I
should have gone with that gut instinct and inspected it in more
depth.

Thanks for calling it out.

Reverting for dev-5.0, this is an isolated issue (arguably should have
been separated from the current series).

Andrew

> 
> >Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >---
> > drivers/mtd/spi-nor/aspeed-smc.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> >diff --git a/drivers/mtd/spi-nor/aspeed-smc.c
> >b/drivers/mtd/spi-nor/aspeed-smc.c
> >index 1437732fdea1..7e289ecb1c99 100644
> >--- a/drivers/mtd/spi-nor/aspeed-smc.c
> >+++ b/drivers/mtd/spi-nor/aspeed-smc.c
> >@@ -796,8 +796,7 @@ static bool aspeed_smc_check_reads(struct
> >aspeed_smc_chip *chip,
> > 	int i;
> > 
> > 	for (i = 0; i < 10; i++) {
> >-		aspeed_smc_read_from_ahb(test_buf, chip->ahb_base,
> >-					 CALIBRATE_BUF_SIZE);
> >+		memcpy_fromio(test_buf, chip->ahb_base, CALIBRATE_BUF_SIZE);
> > 		if (memcmp(test_buf, golden_buf, CALIBRATE_BUF_SIZE) != 0)
> > 			return false;
> > 	}
> >@@ -921,8 +920,7 @@ static int aspeed_smc_optimize_read(struct
> >aspeed_smc_chip *chip,
> > 
> > 	writel(chip->ctl_val[smc_read], chip->ctl);
> > 
> >-	aspeed_smc_read_from_ahb(golden_buf, chip->ahb_base,
> >-				 CALIBRATE_BUF_SIZE);
> >+	memcpy_fromio(golden_buf, chip->ahb_base, CALIBRATE_BUF_SIZE);
> > 
> > 	/* Establish our read mode with freq field set to 0 (HCLK/16) */
> > 	chip->ctl_val[smc_read] = save_read_val & 0xfffff0ff;
> >-- 
> >2.20.1
> >
> >
> 
>

  reply	other threads:[~2019-04-19  1:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 13:39 [PATCH dev-5.0 0/4] spi-nor: aspeed: add support for the 4B opcodes Cédric Le Goater
2019-04-17 13:39 ` [PATCH dev-5.0 1/4] mtd: spi-nor: aspeed: introduce a aspeed_smc_default_read() helper Cédric Le Goater
2019-04-17 18:09   ` Alexander Amelkin
2019-04-18  6:07     ` Andrew Jeffery
2019-04-18  6:23       ` Cédric Le Goater
2019-04-17 13:39 ` [PATCH dev-5.0 2/4] mtd: spi-nor: aspeed: clarify 4BYTE address mode mask Cédric Le Goater
2019-04-18  6:09   ` Andrew Jeffery
2019-04-17 13:39 ` [PATCH dev-5.0 3/4] mtd: spi-nor: aspeed: use memcpy_fromio() to capture the optimization buffer Cédric Le Goater
2019-04-18  6:10   ` Andrew Jeffery
2019-04-17 13:39 ` [PATCH dev-5.0 4/4] mtd: spi-nor: aspeed: add support for the 4B opcodes Cédric Le Goater
2019-04-18  6:10   ` Andrew Jeffery
2019-04-18 21:23 ` [PATCH dev-5.0 3/4] mtd: spi-nor: aspeed: use memcpy_fromio() to capture the optimization buffer Milton Miller II
2019-04-19  1:03   ` Andrew Jeffery [this message]
2019-04-19  6:02     ` Cédric Le Goater
2019-04-19  7:23       ` Andrew Jeffery
2019-04-19  8:09         ` Cédric Le Goater
2019-04-19  8:22           ` Andrew Jeffery
2019-05-02  3:53           ` Andrew Jeffery
2019-05-03 22:19           ` Milton Miller II
2019-04-18 22:27 ` [PATCH dev-5.0 2/4] mtd: spi-nor: aspeed: clarify 4BYTE address mode mask Milton Miller II
2019-04-19  6:09   ` Cédric Le Goater
2019-04-19  6:41     ` Andrew Jeffery
2019-04-18 22:41 ` [PATCH dev-5.0 0/4] spi-nor: aspeed: add support for the 4B opcodes Milton Miller II
2019-04-19  7:08   ` Cédric Le Goater

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=a8ab1055-64c6-4763-b244-2a17e70a10a1@www.fastmail.com \
    --to=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=miltonm@us.ibm.com \
    --cc=openbmc@lists.ozlabs.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 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.