All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org, nicolas.ferre@atmel.com,
	boris.brezillon@free-electrons.com, marex@denx.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mtd: atmel-quadspi: add driver for Atmel QSPI controller
Date: Tue, 19 Jul 2016 12:42:42 +0200	[thread overview]
Message-ID: <3594494.0P5B8Rztl3@wuerfel> (raw)
In-Reply-To: <512741bf-9dce-90f3-d969-3d3cb167fe25@atmel.com>

On Tuesday, July 19, 2016 12:03:11 PM CEST Cyrille Pitchen wrote:
> 
> Indeed I added the ARM dependency for the COMPILE_TEST case only for
> _memcpy_toio() and _memcpy_fromio(). I thought it would be enough.
> 
> Also, I use _memcpy_toio() and _memcpy_fromio() on purpose as opposed to
> memcpy_toio() and mempcy_fromio(). I've tested the two latest functions quite
> a long time ago and it didn't work. If I remember, on our architecture,
> memcpy_toio() and memcpy_fromio() are simply implemented with the regular
> memcpy().

They are implemented using "mmiocpy" when CONFIG_BIG_ENDIAN is not set.
mmiocpy is an alias for the out-of-line memcpy() implementation, but it's
different from calling memcpy() as the compiler can decide to replace
small memcpy with a pointer dereference, and that can be unaligned on
ARMv7 for non-MMIO pointers.

> The additional memory barriers inserted by readb() and writeb() seems to be
> needed to guarantee the IO accesses are not reordered on the system bus.

Those barriers should not be needed at all, I've never seen an I/O bus
that reorders consecutive reads to the same address range.
 
> In the atmel-quadspi.c driver, there is a comment on the use of memcpy():
> /* Then fallback to a PIO transfer (memcpy() DOES NOT work!) */

Please try again, I think this was fixed with

commit 1bd46782d08b01b73df0085b51ea1021b19b44fd
Author: Russell King <rmk+kernel@arm.linux.org.uk>
Date:   Fri Jul 3 15:22:54 2015 +0100

    ARM: avoid unwanted GCC memset()/memcpy() optimisations for IO variants
    
    We don't want GCC optimising our memset_io(), memcpy_fromio() or
    memcpy_toio() variants, so we must not call one of the standard
    functions.  Provide a separate name for our assembly memcpy() and
    memset() functions, and use that instead, thereby bypassing GCC's
    ability to optimise these operations.
    
    GCCs optimisation may introduce unaligned accesses which are invalid
    for device mappings.
    
    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

	Arnd

  reply	other threads:[~2016-07-19 10:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 15:10 [PATCH 0/2] mtd: spi-nor: add driver for Atmel QSPI controller Cyrille Pitchen
2016-06-13 15:10 ` [PATCH 1/2] Documentation: atmel-quadspi: add binding file for Atmel QSPI driver Cyrille Pitchen
2016-07-14  1:16   ` Brian Norris
2016-06-13 15:10 ` [PATCH 2/2] mtd: atmel-quadspi: add driver for Atmel QSPI controller Cyrille Pitchen
2016-07-14  1:32   ` Brian Norris
2016-07-16  0:45     ` Brian Norris
2016-07-18 19:35       ` Arnd Bergmann
2016-07-18 19:55         ` Brian Norris
2016-07-18 19:59           ` Arnd Bergmann
2016-07-19 10:03             ` Cyrille Pitchen
2016-07-19 10:42               ` Arnd Bergmann [this message]
2016-07-19 10:38       ` Cyrille Pitchen
2016-06-22 13:39 ` [PATCH 0/2] mtd: spi-nor: " Cyrille Pitchen
  -- strict thread matches above, loose matches on Subject: below --
2016-05-23 16:17 Cyrille Pitchen
2016-05-23 16:17 ` [PATCH 2/2] mtd: atmel-quadspi: " Cyrille Pitchen

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=3594494.0P5B8Rztl3@wuerfel \
    --to=arnd@arndb.de \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    --cc=nicolas.ferre@atmel.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.