From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm/mach-imx: use endian-safe readl/readw/writel/writew
Date: Sun, 24 Jan 2016 22:28:46 +0100 [thread overview]
Message-ID: <27961664.oTCXiXao1R@wuerfel> (raw)
In-Reply-To: <1453651346-12760-1-git-send-email-johannes@sipsolutions.net>
On Sunday 24 January 2016 17:02:25 Johannes Berg wrote:
> Instead of __raw_*, use *_relaxed. The conversion was done
> using the following spatch (since that automatically adjusts
> the coding style unlike a simple search&replace).
>
> @@
> expression E1, E2;
> @@
> -__raw_writel(E1, E2)
> +writel_relaxed(E1, E2)
> @@
> expression E1, E2;
> @@
> -__raw_writew(E1, E2)
> +writew_relaxed(E1, E2)
> @@
> expression E1;
> @@
> -__raw_readl(E1)
> +readl_relaxed(E1)
> @@
> expression E1;
> @@
> -__raw_readw(E1)
> +readw_relaxed(E1)
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
>
(Adding Shawn and Sascha here as well)
The patch looks fine to me, in the sense that we can safely assume
that the behavior won't change for little-endian, and that it is
fixing a bug for big-endian.
I would feel more comfortable with a patch using the non-relaxed()
accessors though, as that can avoid a number of subtle bugs with
I/O ordering.
Unfortunately, there is a nonzero overhead in the extra cache sync
on the Cortex-A9 based platforms (most imx6), so this has to
be done very carefully to avoid performance regressions. It's
probably a good idea to keep the two changes as separate commits,
but I'd also like to get both applied in the same merge window,
as 'readl_relaxed' tends to say "I have proven that I don't need
barriers", while the existing code just screams "I have no idea
about what I'm doing here".
Any other opinions on this?
Arnd
next prev parent reply other threads:[~2016-01-24 21:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-24 16:02 [PATCH 1/2] arm/mach-imx: use endian-safe readl/readw/writel/writew Johannes Berg
2016-01-24 16:02 ` [PATCH 2/2] arm/mach-imx: enable big endian mode Johannes Berg
2016-01-24 16:51 ` Arnd Bergmann
2016-01-24 21:28 ` Arnd Bergmann [this message]
2016-01-25 10:43 ` [PATCH 1/2] arm/mach-imx: use endian-safe readl/readw/writel/writew Johannes Berg
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=27961664.oTCXiXao1R@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