From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Trent Piepho <tpiepho@freescale.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
Russell King <rmk+lkml@arm.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>,
David Miller <davem@davemloft.net>,
linux-arch@vger.kernel.org, scottwood@freescale.com,
linuxppc-dev@ozlabs.org, alan@lxorguk.ukuu.org.uk,
linux-kernel@vger.kernel.org
Subject: Re: MMIO and gcc re-ordering issue
Date: Wed, 04 Jun 2008 08:26:58 +1000 [thread overview]
Message-ID: <1212532018.9496.49.camel@pasglop> (raw)
In-Reply-To: <Pine.LNX.4.64.0806031154050.3242@t2.domain.actdsltmp>
On Tue, 2008-06-03 at 12:43 -0700, Trent Piepho wrote:
>
> Byte-swapping vs not byte-swapping is not usually what the programmer wants.
> Usually your device's registers are defined as being big-endian or
> little-endian and you want whatever is needed to give you that.
Yes, which is why I (and some other archs) have writel_be/readl_be.
The standard writel/readl being LE.
However, the "raw" variants are defined to be native endian, which is of
some use to -some- archs apparently where they have SoC device whose
endianness follow the core.
> I believe that on some archs that can be either byte order, some built-in
> devices will change their registers to match, and so you want "native endian"
> or no swapping for these. Though that's definitely in the minority.
>
> An accessors that always byte-swaps regardless of the endianness of the host
> is never something I've seen a driver want.
>
> IOW, there are four ways one can defined endianness/swapping:
> 1) Little-endian
> 2) Big-endian
> 3) Native-endian aka non-byte-swapping
> 4) Foreign-endian aka byte-swapping
>
> 1 and 2 are by far the most used. Some code wants 3. No one wants 4. Yet
> our API is providing 3 & 4, the two which are the least useful.
No, we don't provide 4, it was something unclear with nick.
We provide 1. (writel/readl and __variants), some archs provide 2
(writel_be/readl_be, tho I don't have __variants, I suppose I could),
and everybody provides 3. though in some cases (like us) only in the
form of __variants (ie, non ordered, like __raw_readl/__raw_writel).
Nick's proposal is to plug those gaps, though it's, I believe, missing
the _be variants.
> Is it enough to provide only "all or none" for ordering strictness? For
> instance on powerpc, one can get a speedup by dropping strict ordering for IO
> vs cacheable memory, but still keeping ordering for IO vs IO and IO vs locks.
> This is much easier to program for than no ordering at all. In fact, if one
> doesn't use coherent DMA, it's basically the same as fully strict ordering.
Ben.
WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Trent Piepho <tpiepho@freescale.com>
Cc: linux-arch@vger.kernel.org, Nick Piggin <nickpiggin@yahoo.com.au>,
Russell King <rmk+lkml@arm.linux.org.uk>,
linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
scottwood@freescale.com,
Linus Torvalds <torvalds@linux-foundation.org>,
David Miller <davem@davemloft.net>,
alan@lxorguk.ukuu.org.uk
Subject: Re: MMIO and gcc re-ordering issue
Date: Wed, 04 Jun 2008 08:26:58 +1000 [thread overview]
Message-ID: <1212532018.9496.49.camel@pasglop> (raw)
In-Reply-To: <Pine.LNX.4.64.0806031154050.3242@t2.domain.actdsltmp>
On Tue, 2008-06-03 at 12:43 -0700, Trent Piepho wrote:
>
> Byte-swapping vs not byte-swapping is not usually what the programmer wants.
> Usually your device's registers are defined as being big-endian or
> little-endian and you want whatever is needed to give you that.
Yes, which is why I (and some other archs) have writel_be/readl_be.
The standard writel/readl being LE.
However, the "raw" variants are defined to be native endian, which is of
some use to -some- archs apparently where they have SoC device whose
endianness follow the core.
> I believe that on some archs that can be either byte order, some built-in
> devices will change their registers to match, and so you want "native endian"
> or no swapping for these. Though that's definitely in the minority.
>
> An accessors that always byte-swaps regardless of the endianness of the host
> is never something I've seen a driver want.
>
> IOW, there are four ways one can defined endianness/swapping:
> 1) Little-endian
> 2) Big-endian
> 3) Native-endian aka non-byte-swapping
> 4) Foreign-endian aka byte-swapping
>
> 1 and 2 are by far the most used. Some code wants 3. No one wants 4. Yet
> our API is providing 3 & 4, the two which are the least useful.
No, we don't provide 4, it was something unclear with nick.
We provide 1. (writel/readl and __variants), some archs provide 2
(writel_be/readl_be, tho I don't have __variants, I suppose I could),
and everybody provides 3. though in some cases (like us) only in the
form of __variants (ie, non ordered, like __raw_readl/__raw_writel).
Nick's proposal is to plug those gaps, though it's, I believe, missing
the _be variants.
> Is it enough to provide only "all or none" for ordering strictness? For
> instance on powerpc, one can get a speedup by dropping strict ordering for IO
> vs cacheable memory, but still keeping ordering for IO vs IO and IO vs locks.
> This is much easier to program for than no ordering at all. In fact, if one
> doesn't use coherent DMA, it's basically the same as fully strict ordering.
Ben.
next prev parent reply other threads:[~2008-06-03 22:27 UTC|newest]
Thread overview: 319+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 20:40 [PATCH] [POWERPC] Improve (in|out)_beXX() asm code Trent Piepho
2008-05-20 20:40 ` Trent Piepho
2008-05-20 21:16 ` Benjamin Herrenschmidt
2008-05-20 21:16 ` Benjamin Herrenschmidt
2008-05-20 21:38 ` Scott Wood
2008-05-20 21:38 ` Scott Wood
2008-05-20 22:02 ` Benjamin Herrenschmidt
2008-05-20 22:02 ` Benjamin Herrenschmidt
2008-05-20 22:21 ` Trent Piepho
2008-05-20 22:15 ` Alan Cox
2008-05-20 22:15 ` Alan Cox
2008-05-20 22:35 ` Scott Wood
2008-05-20 22:35 ` Scott Wood
2008-05-20 22:39 ` David Miller
2008-05-20 22:39 ` David Miller
2008-05-20 22:43 ` Scott Wood
2008-05-20 22:43 ` Scott Wood
2008-05-20 22:53 ` David Miller
2008-05-20 22:53 ` David Miller
2008-05-23 4:24 ` Benjamin Herrenschmidt
2008-05-22 22:56 ` Trent Piepho
2008-05-22 22:56 ` Trent Piepho
2008-05-23 12:36 ` MMIO and gcc re-ordering (Was: [PATCH] [POWERPC] Improve (in|out)_beXX() asm code) Benjamin Herrenschmidt
2008-05-23 12:36 ` Benjamin Herrenschmidt
2008-05-23 12:50 ` Benjamin Herrenschmidt
2008-05-23 12:50 ` Benjamin Herrenschmidt
2008-05-23 21:14 ` Scott Wood
2008-05-23 21:14 ` Scott Wood
2008-05-23 22:47 ` Benjamin Herrenschmidt
2008-05-23 22:47 ` Benjamin Herrenschmidt
2008-05-27 1:33 ` MMIO and gcc re-ordering issue Benjamin Herrenschmidt
2008-05-27 1:33 ` Benjamin Herrenschmidt
2008-05-27 1:40 ` David Miller
2008-05-27 1:40 ` David Miller
2008-05-27 2:15 ` Benjamin Herrenschmidt
2008-05-27 2:15 ` Benjamin Herrenschmidt
2008-05-27 2:28 ` David Miller
2008-05-27 2:28 ` David Miller
2008-05-27 3:39 ` Benjamin Herrenschmidt
2008-05-27 3:39 ` Benjamin Herrenschmidt
2008-05-27 15:35 ` Linus Torvalds
2008-05-27 15:35 ` Linus Torvalds
2008-05-27 16:47 ` Linus Torvalds
2008-05-27 16:47 ` Linus Torvalds
2008-05-27 17:31 ` Linus Torvalds
2008-05-27 17:31 ` Linus Torvalds
2008-06-02 10:36 ` Ingo Molnar
2008-06-02 10:36 ` Ingo Molnar
2008-06-02 21:53 ` Benjamin Herrenschmidt
2008-06-02 21:53 ` Benjamin Herrenschmidt
2008-05-27 21:12 ` Benjamin Herrenschmidt
2008-05-27 21:12 ` Benjamin Herrenschmidt
2008-05-27 18:23 ` Trent Piepho
2008-05-27 18:23 ` Trent Piepho
2008-05-27 18:33 ` Scott Wood
2008-05-27 18:33 ` Scott Wood
2008-05-27 21:10 ` Benjamin Herrenschmidt
2008-05-27 21:10 ` Benjamin Herrenschmidt
2008-05-27 21:30 ` Linus Torvalds
2008-05-27 21:30 ` Linus Torvalds
2008-05-27 21:38 ` Alan Cox
2008-05-27 21:38 ` Alan Cox
2008-05-27 21:53 ` Matthew Wilcox
2008-05-27 21:53 ` Matthew Wilcox
2008-05-27 21:46 ` Alan Cox
2008-05-27 21:46 ` Alan Cox
2008-05-27 22:02 ` Linus Torvalds
2008-05-27 22:02 ` Linus Torvalds
2008-05-27 21:59 ` Linus Torvalds
2008-05-27 21:59 ` Linus Torvalds
2008-05-27 21:38 ` Benjamin Herrenschmidt
2008-05-27 21:38 ` Benjamin Herrenschmidt
2008-05-27 21:42 ` Matthew Wilcox
2008-05-27 21:42 ` Matthew Wilcox
2008-05-27 22:17 ` Benjamin Herrenschmidt
2008-05-27 22:17 ` Benjamin Herrenschmidt
2008-05-28 8:36 ` Haavard Skinnemoen
2008-05-28 8:36 ` Haavard Skinnemoen
2008-05-29 11:05 ` Pantelis Antoniou
2008-05-29 11:05 ` Pantelis Antoniou
2008-05-30 1:13 ` Benjamin Herrenschmidt
2008-05-30 1:13 ` Benjamin Herrenschmidt
2008-05-30 6:07 ` Haavard Skinnemoen
2008-05-30 6:07 ` Haavard Skinnemoen
2008-05-30 7:24 ` Benjamin Herrenschmidt
2008-05-30 7:24 ` Benjamin Herrenschmidt
2008-05-30 8:27 ` Haavard Skinnemoen
2008-05-30 8:27 ` Haavard Skinnemoen
2008-05-30 9:22 ` Geert Uytterhoeven
2008-05-30 9:22 ` Geert Uytterhoeven
2008-06-02 8:11 ` Haavard Skinnemoen
2008-06-02 8:11 ` Haavard Skinnemoen
2008-06-02 15:48 ` Scott Wood
2008-06-02 15:48 ` Scott Wood
2008-06-03 7:46 ` Haavard Skinnemoen
2008-06-03 7:46 ` Haavard Skinnemoen
2008-06-04 15:31 ` Linus Torvalds
2008-06-04 15:31 ` Linus Torvalds
2008-05-27 21:55 ` Linus Torvalds
2008-05-27 21:55 ` Linus Torvalds
2008-05-27 22:19 ` Benjamin Herrenschmidt
2008-05-27 22:19 ` Benjamin Herrenschmidt
2008-05-29 7:10 ` Arnd Bergmann
2008-05-29 7:10 ` Arnd Bergmann
2008-05-29 10:46 ` Alan Cox
2008-05-29 10:46 ` Alan Cox
2008-06-02 7:24 ` Russell King
2008-06-02 7:24 ` Russell King
2008-06-03 4:16 ` Nick Piggin
2008-06-03 4:16 ` Nick Piggin
2008-06-03 4:32 ` Benjamin Herrenschmidt
2008-06-03 4:32 ` Benjamin Herrenschmidt
2008-06-03 6:11 ` Nick Piggin
2008-06-03 6:11 ` Nick Piggin
2008-06-03 6:48 ` Benjamin Herrenschmidt
2008-06-03 6:48 ` Benjamin Herrenschmidt
2008-06-03 6:53 ` Paul Mackerras
2008-06-03 6:53 ` Paul Mackerras
2008-06-03 7:18 ` Nick Piggin
2008-06-03 7:18 ` Nick Piggin
2008-06-03 14:47 ` Linus Torvalds
2008-06-03 14:47 ` Linus Torvalds
2008-06-03 18:47 ` Trent Piepho
2008-06-03 18:47 ` Trent Piepho
2008-06-03 18:55 ` Matthew Wilcox
2008-06-03 18:55 ` Matthew Wilcox
2008-06-03 19:57 ` Trent Piepho
2008-06-03 19:57 ` Trent Piepho
2008-06-03 21:35 ` Matthew Wilcox
2008-06-03 21:35 ` Matthew Wilcox
2008-06-03 21:58 ` Trent Piepho
2008-06-03 21:58 ` Trent Piepho
2008-06-04 2:00 ` Nick Piggin
2008-06-04 2:00 ` Nick Piggin
2008-06-03 19:07 ` Linus Torvalds
2008-06-03 19:07 ` Linus Torvalds
2008-06-04 2:05 ` Nick Piggin
2008-06-04 2:05 ` Nick Piggin
2008-06-04 2:46 ` Linus Torvalds
2008-06-04 2:46 ` Linus Torvalds
2008-06-04 11:47 ` Alan Cox
2008-06-04 11:47 ` Alan Cox
2008-06-10 6:56 ` Nick Piggin
2008-06-10 6:56 ` Nick Piggin
2008-06-10 17:41 ` Jesse Barnes
2008-06-10 17:41 ` Jesse Barnes
2008-06-10 18:10 ` James Bottomley
2008-06-10 18:10 ` James Bottomley
2008-06-10 19:05 ` Roland Dreier
2008-06-10 19:05 ` Roland Dreier
2008-06-10 19:19 ` Jesse Barnes
2008-06-10 19:19 ` Jesse Barnes
2008-06-11 3:29 ` Nick Piggin
2008-06-11 3:29 ` Nick Piggin
2008-06-11 3:29 ` Nick Piggin
2008-06-11 3:29 ` Nick Piggin
2008-06-11 3:40 ` Benjamin Herrenschmidt
2008-06-11 3:40 ` Benjamin Herrenschmidt
2008-06-11 4:06 ` Nick Piggin
2008-06-11 4:06 ` Nick Piggin
2008-06-11 16:07 ` Jesse Barnes
2008-06-11 16:07 ` Jesse Barnes
2008-06-12 11:27 ` Nick Piggin
2008-06-12 11:27 ` Nick Piggin
2008-06-11 4:18 ` Paul Mackerras
2008-06-11 4:18 ` Paul Mackerras
2008-06-11 5:00 ` Nick Piggin
2008-06-11 5:00 ` Nick Piggin
2008-06-11 5:13 ` Paul Mackerras
2008-06-11 5:13 ` Paul Mackerras
2008-06-11 5:35 ` Nick Piggin
2008-06-11 5:35 ` Nick Piggin
2008-06-11 6:02 ` Nick Piggin
2008-06-11 6:02 ` Nick Piggin
2008-06-12 12:14 ` Paul Mackerras
2008-06-12 12:14 ` Paul Mackerras
2008-06-12 13:08 ` Nick Piggin
2008-06-12 13:08 ` Nick Piggin
2008-06-11 14:46 ` Linus Torvalds
2008-06-11 14:46 ` Linus Torvalds
2008-06-11 5:20 ` Paul Mackerras
2008-06-11 5:20 ` Paul Mackerras
2008-06-04 2:19 ` Nick Piggin
2008-06-04 2:19 ` Nick Piggin
2008-06-03 19:43 ` Trent Piepho
2008-06-03 19:43 ` Trent Piepho
2008-06-03 21:33 ` Matthew Wilcox
2008-06-03 21:33 ` Matthew Wilcox
2008-06-03 21:44 ` Trent Piepho
2008-06-03 21:44 ` Trent Piepho
2008-06-04 2:25 ` Nick Piggin
2008-06-04 2:25 ` Nick Piggin
2008-06-04 6:39 ` Trent Piepho
2008-06-04 6:39 ` Trent Piepho
2008-06-03 22:26 ` Benjamin Herrenschmidt [this message]
2008-06-03 22:26 ` Benjamin Herrenschmidt
2008-05-27 3:42 ` Arjan van de Ven
2008-05-27 3:42 ` Arjan van de Ven
2008-05-27 4:08 ` Roland Dreier
2008-05-27 4:08 ` Roland Dreier
2008-05-27 4:20 ` Arjan van de Ven
2008-05-27 4:20 ` Arjan van de Ven
2008-05-27 7:08 ` Benjamin Herrenschmidt
2008-05-27 7:08 ` Benjamin Herrenschmidt
2008-05-27 15:50 ` Roland Dreier
2008-05-27 15:50 ` Roland Dreier
2008-05-27 16:37 ` James Bottomley
2008-05-27 16:37 ` James Bottomley
2008-05-27 17:38 ` Roland Dreier
2008-05-27 17:38 ` Roland Dreier
2008-05-27 17:53 ` James Bottomley
2008-05-27 17:53 ` James Bottomley
2008-05-27 18:07 ` Roland Dreier
2008-05-27 18:07 ` Roland Dreier
2008-05-27 18:17 ` Roland Dreier
2008-05-27 18:17 ` Roland Dreier
2008-05-27 21:23 ` Chris Friesen
2008-05-27 21:23 ` Chris Friesen
2008-05-27 21:29 ` Roland Dreier
2008-05-27 21:29 ` Roland Dreier
2008-05-27 23:04 ` Paul Mackerras
2008-05-27 23:04 ` Paul Mackerras
2008-05-27 21:11 ` Benjamin Herrenschmidt
2008-05-27 21:11 ` Benjamin Herrenschmidt
2008-05-27 21:33 ` Roland Dreier
2008-05-27 21:33 ` Roland Dreier
2008-05-27 22:13 ` Benjamin Herrenschmidt
2008-05-27 22:13 ` Benjamin Herrenschmidt
2008-05-27 22:39 ` Roland Dreier
2008-05-27 22:39 ` Roland Dreier
2008-05-29 14:47 ` Jes Sorensen
2008-05-29 14:47 ` Jes Sorensen
2008-05-29 15:01 ` James Bottomley
2008-05-29 15:01 ` James Bottomley
2008-05-30 9:36 ` Jes Sorensen
2008-05-30 9:36 ` Jes Sorensen
2008-05-30 17:21 ` Jesse Barnes
2008-05-30 17:21 ` Jesse Barnes
2008-05-31 7:57 ` Jeremy Higdon
2008-05-31 7:57 ` Jeremy Higdon
2008-05-29 21:40 ` Benjamin Herrenschmidt
2008-05-29 21:40 ` Benjamin Herrenschmidt
2008-05-29 21:48 ` Trent Piepho
2008-05-29 21:48 ` Trent Piepho
2008-05-29 22:05 ` Benjamin Herrenschmidt
2008-05-29 22:05 ` Benjamin Herrenschmidt
2008-05-30 1:53 ` Trent Piepho
2008-05-30 1:53 ` Trent Piepho
2008-05-29 21:53 ` Jesse Barnes
2008-05-29 21:53 ` Jesse Barnes
2008-05-30 9:39 ` Jes Sorensen
2008-05-30 9:39 ` Jes Sorensen
2008-05-30 9:48 ` Jes Sorensen
2008-05-30 9:48 ` Jes Sorensen
2008-05-31 8:14 ` Pavel Machek
2008-05-31 8:14 ` Pavel Machek
2008-06-02 9:48 ` Jes Sorensen
2008-06-02 9:48 ` Jes Sorensen
2008-05-29 22:06 ` Roland Dreier
2008-05-29 22:06 ` Roland Dreier
2008-05-29 22:25 ` Trent Piepho
2008-05-29 22:25 ` Trent Piepho
2008-05-30 3:56 ` Paul Mackerras
2008-05-30 3:56 ` Paul Mackerras
2008-05-31 7:52 ` Jeremy Higdon
2008-05-31 7:52 ` Jeremy Higdon
2008-06-02 9:56 ` Jes Sorensen
2008-06-02 9:56 ` Jes Sorensen
2008-06-02 21:02 ` Jeremy Higdon
2008-06-02 21:02 ` Jeremy Higdon
2008-06-03 4:33 ` Nick Piggin
2008-06-03 4:33 ` Nick Piggin
2008-06-03 8:15 ` Jeremy Higdon
2008-06-03 8:15 ` Jeremy Higdon
2008-06-03 8:19 ` Nick Piggin
2008-06-03 8:19 ` Nick Piggin
2008-06-03 8:45 ` Jeremy Higdon
2008-06-03 8:45 ` Jeremy Higdon
2008-06-03 16:52 ` Jesse Barnes
2008-06-03 16:52 ` Jesse Barnes
2008-06-05 8:40 ` Jes Sorensen
2008-06-05 8:40 ` Jes Sorensen
2008-06-05 8:43 ` Benjamin Herrenschmidt
2008-06-05 8:43 ` Benjamin Herrenschmidt
2008-06-12 15:07 ` Matthew Wilcox
2008-06-12 15:07 ` Matthew Wilcox
2008-06-13 0:07 ` Benjamin Herrenschmidt
2008-06-13 0:07 ` Benjamin Herrenschmidt
2008-05-31 8:04 ` Pavel Machek
2008-05-31 8:04 ` Pavel Machek
2008-05-27 8:24 ` Alan Cox
2008-05-27 8:24 ` Alan Cox
2008-05-27 15:28 ` Jonathan Corbet
2008-05-27 15:28 ` Jonathan Corbet
2008-05-20 22:55 ` [PATCH] [POWERPC] Improve (in|out)_beXX() asm code Trent Piepho
2008-05-20 22:55 ` Trent Piepho
2008-05-21 14:01 ` Benjamin Herrenschmidt
2008-05-21 14:01 ` Benjamin Herrenschmidt
2008-05-20 22:00 ` Trent Piepho
2008-05-20 22:00 ` Trent Piepho
2008-05-21 14:00 ` Benjamin Herrenschmidt
2008-05-21 14:00 ` Benjamin Herrenschmidt
2008-05-21 19:44 ` Trent Piepho
2008-05-21 19:44 ` Trent Piepho
2008-05-21 20:41 ` Benjamin Herrenschmidt
2008-05-21 20:41 ` Benjamin Herrenschmidt
2008-05-20 22:00 ` Andreas Schwab
2008-05-20 22:00 ` Andreas Schwab
2008-05-20 22:11 ` Trent Piepho
2008-05-20 22:11 ` Trent Piepho
2008-05-20 22:47 ` Andreas Schwab
2008-05-20 22:47 ` Andreas Schwab
2008-05-20 23:14 ` Trent Piepho
2008-05-20 23:14 ` Trent Piepho
2008-05-21 8:03 ` Andreas Schwab
2008-05-21 8:03 ` Andreas Schwab
2008-05-21 20:25 ` Trent Piepho
2008-05-21 20:25 ` Trent Piepho
2008-05-27 23:48 ` [PATCH V2] [POWERPC] Improve (in|out)_[bl]eXX() " Trent Piepho
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=1212532018.9496.49.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=nickpiggin@yahoo.com.au \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=scottwood@freescale.com \
--cc=torvalds@linux-foundation.org \
--cc=tpiepho@freescale.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.