ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "ksummit-discuss@lists.linuxfoundation.org"
	<ksummit-discuss@lists.linuxfoundation.org>
Subject: Re: [Ksummit-discuss] [TECH TOPIC] Semantics of MMIO mapping attributes accross archs
Date: Tue, 7 Jul 2015 10:56:16 +0100	[thread overview]
Message-ID: <20150707095615.GD23879@arm.com> (raw)
In-Reply-To: <1436220126.3948.74.camel@kernel.crashing.org>

On Mon, Jul 06, 2015 at 11:02:06PM +0100, Benjamin Herrenschmidt wrote:
> On Mon, 2015-07-06 at 10:33 +0100, Will Deacon wrote:
> > On arm64, ioremap == ioremap_nocache, which gives strong ordering
> > guarantees but forbids things like unaligned access.
> 
> Ok, same for us. Except ordering guarantees aren't even that strong ...

By "strong", I mean "ordered with respect to each other" and not subject
to "gathering" (more on that below).

> >  ioremap_wc gives a
> > more relaxed mapping, which is non-cached but allows re-ordering and
> > unaligned access.
> 
> Ok, our other mapping (G=0) weakens ordering even more but won't allow
> unaligned either. We don't have a non-cachable mapping that allows
> unaligned accesses at all in fact :-( I've been fighting with our HW
> guys on that one, but they keep thinking it's not useful.

Yikes. How do you deal with that? I've seen GCC perform idiom recognition
on calls to memset/memcpy assuming unaligned access on arm64.

> > ioremap_wt is new and strange, but rmk and I were going down the same
> > route as ioremap_wc for that, because people expect to be able to do
> > blind memcpy with those pointers.
> 
> Ok, powerpc architecturally supports WT but no recent implementation
> does. I'm not sure what is the practical purpose.

That's a similar story for us. In terms of normal memory, we basically
have writeback-cacheable and non-cacheable.

> > As for ordering of writeX/readX wrt DMA, our IO accessors are so
> > insanely
> > heavyweight that I don't think the ioremap flavour matters atm.
> 
> This is the same for us, but that also means in our case that writeX
> will not combine on ioremap_wc(), only relaxed_writeX() might after we
> change it to be something else than writeX(). What is the situation for
> you ?

The barriers between the writes will forbid any combining. In fact, it
would make the mapping look an awful lot like a plain old ioremap except
that a readX could be speculated and unaligned access is permitted.

As long as the accessors are required to enforce ordering that the
underlying memory type is incapable of providing, I don't see what we
could do to solve this (somehow make readX/writeX behaviour dependent on
the pointer?).

Will

  reply	other threads:[~2015-07-07  9:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-04  8:17 Benjamin Herrenschmidt
2015-07-04 14:12 ` Dan Williams
2015-07-05  3:02   ` Benjamin Herrenschmidt
2015-07-05 18:55     ` Andy Lutomirski
2015-07-05 19:56       ` Benjamin Herrenschmidt
2015-07-05 20:09         ` Andy Lutomirski
2015-07-06  9:33         ` Will Deacon
2015-07-06 22:02           ` Benjamin Herrenschmidt
2015-07-07  9:56             ` Will Deacon [this message]
2015-07-07 10:29               ` Will Deacon
2015-07-06  9:52       ` Catalin Marinas
2015-07-06 17:14         ` Andy Lutomirski
2015-07-06 22:04           ` Benjamin Herrenschmidt
2015-07-06 19:11       ` Luck, Tony
2015-07-07  0:01 ` Luis R. Rodriguez

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=20150707095615.GD23879@arm.com \
    --to=will.deacon@arm.com \
    --cc=benh@kernel.crashing.org \
    --cc=ksummit-discuss@lists.linuxfoundation.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