From: jnair@caviumnetworks.com (Jayachandran C)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/2] ioremap_wc on arm64
Date: Wed, 24 May 2017 13:33:20 +0000 [thread overview]
Message-ID: <20170524131054.GA5647@localhost> (raw)
In-Reply-To: <20170523140824.GC5948@e104818-lin.cambridge.arm.com>
On Tue, May 23, 2017 at 03:08:24PM +0100, Catalin Marinas wrote:
> On Tue, May 23, 2017 at 10:09:03AM +0000, Jayachandran C wrote:
> > On Mon, May 22, 2017 at 04:49:47PM +0100, Catalin Marinas wrote:
> > > On Mon, May 22, 2017 at 02:21:00PM +0000, Jayachandran C wrote:
> > > > On Mon, May 22, 2017 at 01:22:37PM +0100, Will Deacon wrote:
> > > > > I think it was used for framebuffers. Note that using normal-NC also aligns
> > > > > with arch/arm/ and, since normal-NC is strictly a more relaxed memory type
> > > > > than Device-GRE, I'm really not keen making on this change.
> > > >
> > > > Even if that is the case, having Normal attribute for ioremap just for
> > > > ioremap_wc is inconsistent. The Device Gathering attribute by its definition
> > > > is exactly what write combining requires. The memremap() API looks like a
> > > > better way to expose Normal-NC mapping (with additional features like
> > > > speculation etc.) if implemented correctly.
> > >
> > > I agree, memremap() is a better way but this was merged in 4.3 while
> > > ioremap_wc() had been around for a long time. If you want to change its
> > > semantics, you'd need to go through all its uses in the kernel and make
> > > sure they *only* use I/O accessors with such memory. At a quick grep,
> > > there are several places where the __iomem pointer attribute is dropped
> > > shortly after ioremap() and the pointer is accessed directly. That's
> > > where things will break with Device GRE memory since the compiler
> > > doesn't guarantee aligned accesses.
> >
> > There is a difference in behavior with regard to unaligned access between
> > ioremap_wc and ioremap already. I don't follow why unaligned access has to
> > supported for ioremap_wc but not for ioremap - it would be much better to
> > be consistent here.
>
> Please re-read my paragraph above.
I had the same feeling after seeing your reply :)
> It's nice if both ioremap_wc() and
> ioremap() returned Device memory as long as you fix the ioremap_wc()
> misuses throughout the kernel.
ioremap and ioremap_wc is been used and abused in multiple places after
dropping the __iomem annotation, and it is not an easy task to figure
out where unaligned access is done on the pointer returned. I am told
specifically that in ioremap_wc needs to support unaligned access as
opposed to ioremap.
I am trying to figure out if there are specific cases you expect it to
fail. Since arm64 is a fairly new architecture and it will be easy
to get this correct now, rather than to let the status quo continue.
There is no "Gather" attribute on arm, so using "Normal uncached" for
ioremap_wc is understandable. On arm64, given that there is an attribute
specifically for write combining - you have decided to go with Normal
uncached. I had hoped for a proper reason for that and not a vague
"maybe framebuffer, go grep the kernel and figure out" response.
> > > > Also, patch 1/2 should be useful anyway - can that be picked up?
> > >
> > > The patch is harmless but are we going to have a user of Device_GRE?
> >
> > This patch would make the attribute in MAIR and the index MT_DEVICE_GRE
> > useful for __ioremap. Otherwise I don't see the use in having the
> > attribute at all. I can at least give this to people who want Device GRE
> > mapping, which is the fastest way to access device memory on ThunderX2.
>
> Is this a driver that's going to be used on arm64 kernels only? I'm not
> that keen on __ioremap() since it's not a standard driver API, so you
> end up with #ifdef CONFIG_ARM64 in the driver code.
FWIW, __ioremap() is EXPORT_SYMBOL. Having the attribute will be useful.
JC.
prev parent reply other threads:[~2017-05-24 13:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 7:01 [PATCH 0/2] ioremap_wc on arm64 Jayachandran C
2017-05-22 7:01 ` [PATCH 1/2] arm64: add PROT_DEVICE_GRE for Device GRE mapping Jayachandran C
2017-05-22 7:01 ` [PATCH 2/2] arm64: switch ioremap_wc to use Device GRE Jayachandran C
2017-05-22 8:56 ` [PATCH 0/2] ioremap_wc on arm64 Catalin Marinas
2017-05-22 11:53 ` Jayachandran C
2017-05-22 11:58 ` Alexander Graf
2017-05-22 12:22 ` Will Deacon
2017-05-22 14:21 ` Jayachandran C
2017-05-22 15:49 ` Catalin Marinas
2017-05-23 10:09 ` Jayachandran C
2017-05-23 14:08 ` Catalin Marinas
2017-05-24 13:33 ` Jayachandran C [this message]
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=20170524131054.GA5647@localhost \
--to=jnair@caviumnetworks.com \
--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;
as well as URLs for NNTP newsgroup(s).