public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4] mtd: nand: sunxi: fix OOB handling in ->write_xxx() functions
Date: Mon, 14 Sep 2015 14:36 +0200	[thread overview]
Message-ID: <3052942.HDd39OoZnN@wuerfel> (raw)
In-Reply-To: <3809181.WuS0af6Yyz@wuerfel>

On Monday 14 September 2015 13:49:12 Arnd Bergmann wrote:
> > > If all hardware can do 32-bit accesses here and the size is guaranteed to be a
> > > multiple of four bytes, you can probably improve performance by using a
> > > __raw_writel() loop there. Using __raw_writel() in general is almost always
> > > a bug, but here it actually makes sense. See also the powerpc implementation
> > > of _memcpy_toio().
> > 
> > AFAICT, buffer passed to ->write_bu() are not necessarily aligned on
> > 32bits, so using writel here might require copying data in temporary
> > buffers :-/.
> > 
> > Don't hesitate to point where I'm wrong ;-).
> 
> Brian or Dwmw2 should be able to know for sure. I think it's definitely
> worth trying as the potential performance gains could be huge, if you
> replace
> 
>         for (p = start; p < start + length; data++, p++) {
>                 writeb(*data, p);
>                 wmb();
>         }
> 
> with
> 
>         for (p = start; p < start + length; data++, p+=4) {
>                 writel(*data, p);
>         };
>         wmb();
> 

As Boris pointed out on IRC, we have an optimized version of
memcpy_toio on little-endian, which already does this. I'm not completely
sure why we don't use it for big-endian architectures as well.

Powerpc uses the same method on big-endian, but it's possible that
it does not do the right thing on one of the older platforms using
BE32 mode, or one that has a weird bus mode.

	Arnd
 

  reply	other threads:[~2015-09-14 12:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14  8:41 [PATCH v4] mtd: nand: sunxi: fix OOB handling in ->write_xxx() functions Boris Brezillon
2015-09-14  8:59 ` Arnd Bergmann
2015-09-14  9:41   ` Boris Brezillon
2015-09-14 11:49     ` Arnd Bergmann
2015-09-14 12:36       ` Arnd Bergmann [this message]
2015-09-14 17:02 ` Brian Norris
2015-09-21 20:43   ` Brian Norris

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=3052942.HDd39OoZnN@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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