* Re: Do cpu-endian MMIO accessors exist? [not found] ` <200907220005.27583.arnd@arndb.de> @ 2009-07-22 7:24 ` Jiri Slaby 2009-07-22 8:35 ` Arnd Bergmann 0 siblings, 1 reply; 5+ messages in thread From: Jiri Slaby @ 2009-07-22 7:24 UTC (permalink / raw) To: Arnd Bergmann Cc: Pekka Paalanen, linux-kernel, Christoph Hellwig, lethal, linux-sh On 07/22/2009 12:05 AM, Arnd Bergmann wrote: > On Tuesday 21 July 2009, Jiri Slaby wrote: >> I guess it's a bug that ioread/write* on sh are not with >> barriers? > > That depends on how that architecture defines its bus interface. > On many simple architectures, you do not need any synchronization > operations. No, I should have written this explicitly. I meant read* have a barrier, whereas ioread* do not. Similarly for writes. Is this expected? For example: #define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) #define readl(a) ({ u32 r_ = __raw_readl(a); mb(); r_; }) #define ioread32(a) __raw_readl(a) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Do cpu-endian MMIO accessors exist? 2009-07-22 7:24 ` Do cpu-endian MMIO accessors exist? Jiri Slaby @ 2009-07-22 8:35 ` Arnd Bergmann 2009-07-22 8:43 ` Alan Cox 0 siblings, 1 reply; 5+ messages in thread From: Arnd Bergmann @ 2009-07-22 8:35 UTC (permalink / raw) To: Jiri Slaby Cc: Pekka Paalanen, linux-kernel, Christoph Hellwig, lethal, linux-sh On Wednesday 22 July 2009, Jiri Slaby wrote: > No, I should have written this explicitly. I meant read* have a barrier, > whereas ioread* do not. Similarly for writes. Is this expected? > > For example: > #define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) > #define readl(a) ({ u32 r_ = __raw_readl(a); mb(); r_; }) > #define ioread32(a) __raw_readl(a) No, this looks like a bug. I would have expected #define ioread32(a) readl(a) in this case. Also, ioread32 should actually multiplex between readl() and inl() based on the address token, as the code in lib/iomap.c does. It's probably easy enough to enable CONFIG_GENERIC_IOMAP on sh, and remove the ioread*/iowrite* macros from arch/sh/include/asm/io.h. Arnd <>< ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Do cpu-endian MMIO accessors exist? 2009-07-22 8:35 ` Arnd Bergmann @ 2009-07-22 8:43 ` Alan Cox 2009-07-22 13:44 ` Arnd Bergmann 0 siblings, 1 reply; 5+ messages in thread From: Alan Cox @ 2009-07-22 8:43 UTC (permalink / raw) To: Arnd Bergmann Cc: Jiri Slaby, Pekka Paalanen, linux-kernel, Christoph Hellwig, lethal, linux-sh On Wed, 22 Jul 2009 10:35:49 +0200 Arnd Bergmann <arnd@arndb.de> wrote: > On Wednesday 22 July 2009, Jiri Slaby wrote: > > No, I should have written this explicitly. I meant read* have a barrier, > > whereas ioread* do not. Similarly for writes. Is this expected? > > > > For example: > > #define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) > > #define readl(a) ({ u32 r_ = __raw_readl(a); mb(); r_; }) > > #define ioread32(a) __raw_readl(a) > > No, this looks like a bug. I would have expected > > #define ioread32(a) readl(a) > > in this case. Also, ioread32 should actually multiplex between > readl() and inl() based on the address token, as the code in > lib/iomap.c does. It's probably easy enough to enable > CONFIG_GENERIC_IOMAP on sh, and remove the ioread*/iowrite* > macros from arch/sh/include/asm/io.h. If your platform is purely MMIO based then ioread32 and readl can become the same thing, which is much more efficient. Even if you have port based devices that are mapped as MMIO surely its more efficient to do the relevant address tweaking in the iomap not in the read ? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Do cpu-endian MMIO accessors exist? 2009-07-22 8:43 ` Alan Cox @ 2009-07-22 13:44 ` Arnd Bergmann 2009-07-27 5:00 ` Paul Mundt 0 siblings, 1 reply; 5+ messages in thread From: Arnd Bergmann @ 2009-07-22 13:44 UTC (permalink / raw) To: Alan Cox Cc: Jiri Slaby, Pekka Paalanen, linux-kernel, Christoph Hellwig, lethal, linux-sh On Wednesday 22 July 2009, Alan Cox wrote: > > > in this case. Also, ioread32 should actually multiplex between > > readl() and inl() based on the address token, as the code in > > lib/iomap.c does. It's probably easy enough to enable > > CONFIG_GENERIC_IOMAP on sh, and remove the ioread*/iowrite* > > macros from arch/sh/include/asm/io.h. > > If your platform is purely MMIO based then ioread32 and readl can become > the same thing, which is much more efficient. Even if you have port based > devices that are mapped as MMIO surely its more efficient to do the > relevant address tweaking in the iomap not in the read ? I did check that the architecture in question (sh) cannot do this, because it actually implements board specific PIO functions in arch/sh/boards/mach-*/io.c. For architectures that don't need such hacks, I fully agree. Arnd <>< ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Do cpu-endian MMIO accessors exist? 2009-07-22 13:44 ` Arnd Bergmann @ 2009-07-27 5:00 ` Paul Mundt 0 siblings, 0 replies; 5+ messages in thread From: Paul Mundt @ 2009-07-27 5:00 UTC (permalink / raw) To: Arnd Bergmann Cc: Alan Cox, Jiri Slaby, Pekka Paalanen, linux-kernel, Christoph Hellwig, linux-sh On Wed, Jul 22, 2009 at 03:44:40PM +0200, Arnd Bergmann wrote: > On Wednesday 22 July 2009, Alan Cox wrote: > > > > > in this case. Also, ioread32 should actually multiplex between > > > readl() and inl() based on the address token, as the code in > > > lib/iomap.c does. It's probably easy enough to enable > > > CONFIG_GENERIC_IOMAP on sh, and remove the ioread*/iowrite* > > > macros from arch/sh/include/asm/io.h. > > > > If your platform is purely MMIO based then ioread32 and readl can become > > the same thing, which is much more efficient. Even if you have port based > > devices that are mapped as MMIO surely its more efficient to do the > > relevant address tweaking in the iomap not in the read ? > > I did check that the architecture in question (sh) cannot do this, > because it actually implements board specific PIO functions in > arch/sh/boards/mach-*/io.c. > > For architectures that don't need such hacks, I fully agree. > SH doesn't really need it either, it is mostly legacy crap that was commonly done for SuperIOs. I've tried to kill off most of it, and most of the offenders now are in boards that very few people have available or even use. We're at the point now where the platforms that are the worst offenders can just be killed off, and the few that matter can be converted. The generic iomap is a bit tricky given that most peripherals, PCI I/O and mem space, etc. all fall under non-translatable sections of the address space, despite being MMIO. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-27 5:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20090721234243.1928d9e2@daedalus.pq.iki.fi>
[not found] ` <200907212315.50225.arnd@arndb.de>
[not found] ` <4A663987.4040500@gmail.com>
[not found] ` <200907220005.27583.arnd@arndb.de>
2009-07-22 7:24 ` Do cpu-endian MMIO accessors exist? Jiri Slaby
2009-07-22 8:35 ` Arnd Bergmann
2009-07-22 8:43 ` Alan Cox
2009-07-22 13:44 ` Arnd Bergmann
2009-07-27 5:00 ` Paul Mundt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox