aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2014-11-11 13:55:45 -0500
committerArnd Bergmann <arnd@arndb.de>2014-11-11 13:55:45 -0500
commit1c8d29696f0d79902962526d6c54ebfeb842c61d (patch)
tree047caddef4ee91e42002bc1234d273c6fbc54967
parent3ba5acf368ae415cd14d026b7cfe29de942b65fc (diff)
parenta8e0aead70b4af957e6b27b82fba849c6179b707 (diff)
Merge branch 'io' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into asm-generic
* 'io' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux: documentation: memory-barriers: clarify relaxed io accessor semantics x86: io: implement dummy relaxed accessor macros for writes tile: io: implement dummy relaxed accessor macros for writes sparc: io: implement dummy relaxed accessor macros for writes powerpc: io: implement dummy relaxed accessor macros for writes parisc: io: implement dummy relaxed accessor macros for writes mn10300: io: implement dummy relaxed accessor macros for writes m68k: io: implement dummy relaxed accessor macros for writes m32r: io: implement dummy relaxed accessor macros for writes ia64: io: implement dummy relaxed accessor macros for writes cris: io: implement dummy relaxed accessor macros for writes frv: io: implement dummy relaxed accessor macros for writes xtensa: io: remove dummy relaxed accessor macros for reads s390: io: remove dummy relaxed accessor macros for reads microblaze: io: remove dummy relaxed accessor macros asm-generic: io: implement relaxed accessor macros as conditional wrappers Conflicts: include/asm-generic/io.h Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--Documentation/memory-barriers.txt13
-rw-r--r--arch/cris/include/asm/io.h3
-rw-r--r--arch/frv/include/asm/io.h3
-rw-r--r--arch/ia64/include/asm/io.h4
-rw-r--r--arch/m32r/include/asm/io.h3
-rw-r--r--arch/m68k/include/asm/io.h8
-rw-r--r--arch/m68k/include/asm/io_no.h4
-rw-r--r--arch/microblaze/include/asm/io.h8
-rw-r--r--arch/mn10300/include/asm/io.h4
-rw-r--r--arch/parisc/include/asm/io.h12
-rw-r--r--arch/powerpc/include/asm/io.h12
-rw-r--r--arch/s390/include/asm/io.h5
-rw-r--r--arch/sparc/include/asm/io.h9
-rw-r--r--arch/sparc/include/asm/io_32.h4
-rw-r--r--arch/sparc/include/asm/io_64.h8
-rw-r--r--arch/tile/include/asm/io.h4
-rw-r--r--arch/x86/include/asm/io.h4
-rw-r--r--arch/xtensa/include/asm/io.h7
-rw-r--r--include/asm-generic/io.h37
19 files changed, 106 insertions, 46 deletions
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 22a969cdd476..4af4cea8cff0 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -2465,10 +2465,15 @@ functions:
2465 Please refer to the PCI specification for more information on interactions 2465 Please refer to the PCI specification for more information on interactions
2466 between PCI transactions. 2466 between PCI transactions.
2467 2467
2468 (*) readX_relaxed() 2468 (*) readX_relaxed(), writeX_relaxed()
2469 2469
2470 These are similar to readX(), but are not guaranteed to be ordered in any 2470 These are similar to readX() and writeX(), but provide weaker memory
2471 way. Be aware that there is no I/O read barrier available. 2471 ordering guarantees. Specifically, they do not guarantee ordering with
2472 respect to normal memory accesses (e.g. DMA buffers) nor do they guarantee
2473 ordering with respect to LOCK or UNLOCK operations. If the latter is
2474 required, an mmiowb() barrier can be used. Note that relaxed accesses to
2475 the same peripheral are guaranteed to be ordered with respect to each
2476 other.
2472 2477
2473 (*) ioreadX(), iowriteX() 2478 (*) ioreadX(), iowriteX()
2474 2479
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h
index e59dba12ce94..752a3f45df60 100644
--- a/arch/cris/include/asm/io.h
+++ b/arch/cris/include/asm/io.h
@@ -112,6 +112,9 @@ static inline void writel(unsigned int b, volatile void __iomem *addr)
112 else 112 else
113 *(volatile unsigned int __force *) addr = b; 113 *(volatile unsigned int __force *) addr = b;
114} 114}
115#define writeb_relaxed(b, addr) writeb(b, addr)
116#define writew_relaxed(b, addr) writew(b, addr)
117#define writel_relaxed(b, addr) writel(b, addr)
115#define __raw_writeb writeb 118#define __raw_writeb writeb
116#define __raw_writew writew 119#define __raw_writew writew
117#define __raw_writel writel 120#define __raw_writel writel
diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index 8cb50a2fbcb2..99bb7efaf9b7 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -243,6 +243,9 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr)
243 __flush_PCI_writes(); 243 __flush_PCI_writes();
244} 244}
245 245
246#define writeb_relaxed writeb
247#define writew_relaxed writew
248#define writel_relaxed writel
246 249
247/* Values for nocacheflag and cmode */ 250/* Values for nocacheflag and cmode */
248#define IOMAP_FULL_CACHING 0 251#define IOMAP_FULL_CACHING 0
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index bee0acd52f7e..80a7e34be009 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -393,6 +393,10 @@ __writeq (unsigned long val, volatile void __iomem *addr)
393#define writew(v,a) __writew((v), (a)) 393#define writew(v,a) __writew((v), (a))
394#define writel(v,a) __writel((v), (a)) 394#define writel(v,a) __writel((v), (a))
395#define writeq(v,a) __writeq((v), (a)) 395#define writeq(v,a) __writeq((v), (a))
396#define writeb_relaxed(v,a) __writeb((v), (a))
397#define writew_relaxed(v,a) __writew((v), (a))
398#define writel_relaxed(v,a) __writel((v), (a))
399#define writeq_relaxed(v,a) __writeq((v), (a))
396#define __raw_writeb writeb 400#define __raw_writeb writeb
397#define __raw_writew writew 401#define __raw_writew writew
398#define __raw_writel writel 402#define __raw_writel writel
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index 4010f1fc5b65..6e7787f3dac7 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -161,6 +161,9 @@ static inline void _writel(unsigned long l, unsigned long addr)
161#define __raw_writeb writeb 161#define __raw_writeb writeb
162#define __raw_writew writew 162#define __raw_writew writew
163#define __raw_writel writel 163#define __raw_writel writel
164#define writeb_relaxed writeb
165#define writew_relaxed writew
166#define writel_relaxed writel
164 167
165#define ioread8 read 168#define ioread8 read
166#define ioread16 readw 169#define ioread16 readw
diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
index c70cc9155003..bccd5a914eb6 100644
--- a/arch/m68k/include/asm/io.h
+++ b/arch/m68k/include/asm/io.h
@@ -3,3 +3,11 @@
3#else 3#else
4#include <asm/io_mm.h> 4#include <asm/io_mm.h>
5#endif 5#endif
6
7#define readb_relaxed(addr) readb(addr)
8#define readw_relaxed(addr) readw(addr)
9#define readl_relaxed(addr) readl(addr)
10
11#define writeb_relaxed(b, addr) writeb(b, addr)
12#define writew_relaxed(b, addr) writew(b, addr)
13#define writel_relaxed(b, addr) writel(b, addr)
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index be4b5a813ad4..a93c8cde4d38 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -40,10 +40,6 @@ static inline unsigned int _swapl(volatile unsigned long v)
40#define readl(addr) \ 40#define readl(addr) \
41 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; }) 41 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
42 42
43#define readb_relaxed(addr) readb(addr)
44#define readw_relaxed(addr) readw(addr)
45#define readl_relaxed(addr) readl(addr)
46
47#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b)) 43#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
48#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b)) 44#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
49#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b)) 45#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 433751b2a003..940f5fc1d1da 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -69,12 +69,4 @@ extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
69 69
70#include <asm-generic/io.h> 70#include <asm-generic/io.h>
71 71
72#define readb_relaxed readb
73#define readw_relaxed readw
74#define readl_relaxed readl
75
76#define writeb_relaxed writeb
77#define writew_relaxed writew
78#define writel_relaxed writel
79
80#endif /* _ASM_MICROBLAZE_IO_H */ 72#endif /* _ASM_MICROBLAZE_IO_H */
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index e6ed0d897ccc..897ba3c12b32 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -67,6 +67,10 @@ static inline void writel(u32 b, volatile void __iomem *addr)
67#define __raw_writew writew 67#define __raw_writew writew
68#define __raw_writel writel 68#define __raw_writel writel
69 69
70#define writeb_relaxed writeb
71#define writew_relaxed writew
72#define writel_relaxed writel
73
70/*****************************************************************************/ 74/*****************************************************************************/
71/* 75/*
72 * traditional input/output functions 76 * traditional input/output functions
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index 1f6d2ae7aba5..8cd0abf28ffb 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -217,10 +217,14 @@ static inline void writeq(unsigned long long q, volatile void __iomem *addr)
217#define writel writel 217#define writel writel
218#define writeq writeq 218#define writeq writeq
219 219
220#define readb_relaxed(addr) readb(addr) 220#define readb_relaxed(addr) readb(addr)
221#define readw_relaxed(addr) readw(addr) 221#define readw_relaxed(addr) readw(addr)
222#define readl_relaxed(addr) readl(addr) 222#define readl_relaxed(addr) readl(addr)
223#define readq_relaxed(addr) readq(addr) 223#define readq_relaxed(addr) readq(addr)
224#define writeb_relaxed(b, addr) writeb(b, addr)
225#define writew_relaxed(w, addr) writew(w, addr)
226#define writel_relaxed(l, addr) writel(l, addr)
227#define writeq_relaxed(q, addr) writeq(q, addr)
224 228
225#define mmiowb() do { } while (0) 229#define mmiowb() do { } while (0)
226 230
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 97d3869991ca..9eaf301ac952 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -617,10 +617,14 @@ static inline void name at \
617/* 617/*
618 * We don't do relaxed operations yet, at least not with this semantic 618 * We don't do relaxed operations yet, at least not with this semantic
619 */ 619 */
620#define readb_relaxed(addr) readb(addr) 620#define readb_relaxed(addr) readb(addr)
621#define readw_relaxed(addr) readw(addr) 621#define readw_relaxed(addr) readw(addr)
622#define readl_relaxed(addr) readl(addr) 622#define readl_relaxed(addr) readl(addr)
623#define readq_relaxed(addr) readq(addr) 623#define readq_relaxed(addr) readq(addr)
624#define writeb_relaxed(v, addr) writeb(v, addr)
625#define writew_relaxed(v, addr) writew(v, addr)
626#define writel_relaxed(v, addr) writel(v, addr)
627#define writeq_relaxed(v, addr) writeq(v, addr)
624 628
625#ifdef CONFIG_PPC32 629#ifdef CONFIG_PPC32
626#define mmiowb() 630#define mmiowb()
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index d22c2eeae78f..6ad9013c67e7 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -61,11 +61,6 @@ static inline void iounmap(volatile void __iomem *addr)
61#define __raw_writel zpci_write_u32 61#define __raw_writel zpci_write_u32
62#define __raw_writeq zpci_write_u64 62#define __raw_writeq zpci_write_u64
63 63
64#define readb_relaxed readb
65#define readw_relaxed readw
66#define readl_relaxed readl
67#define readq_relaxed readq
68
69#endif /* CONFIG_PCI */ 64#endif /* CONFIG_PCI */
70 65
71#include <asm-generic/io.h> 66#include <asm-generic/io.h>
diff --git a/arch/sparc/include/asm/io.h b/arch/sparc/include/asm/io.h
index f6902cf3cbe9..493f22c4684f 100644
--- a/arch/sparc/include/asm/io.h
+++ b/arch/sparc/include/asm/io.h
@@ -10,6 +10,15 @@
10 * Defines used for both SPARC32 and SPARC64 10 * Defines used for both SPARC32 and SPARC64
11 */ 11 */
12 12
13/* Relaxed accessors for MMIO */
14#define readb_relaxed(__addr) readb(__addr)
15#define readw_relaxed(__addr) readw(__addr)
16#define readl_relaxed(__addr) readl(__addr)
17
18#define writeb_relaxed(__b, __addr) writeb(__b, __addr)
19#define writew_relaxed(__w, __addr) writew(__w, __addr)
20#define writel_relaxed(__l, __addr) writel(__l, __addr)
21
13/* Big endian versions of memory read/write routines */ 22/* Big endian versions of memory read/write routines */
14#define readb_be(__addr) __raw_readb(__addr) 23#define readb_be(__addr) __raw_readb(__addr)
15#define readw_be(__addr) __raw_readw(__addr) 24#define readw_be(__addr) __raw_readw(__addr)
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 9f532902627c..407ac14295f4 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -4,10 +4,6 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/ioport.h> /* struct resource */ 5#include <linux/ioport.h> /* struct resource */
6 6
7#define readb_relaxed(__addr) readb(__addr)
8#define readw_relaxed(__addr) readw(__addr)
9#define readl_relaxed(__addr) readl(__addr)
10
11#define IO_SPACE_LIMIT 0xffffffff 7#define IO_SPACE_LIMIT 0xffffffff
12 8
13#define memset_io(d,c,sz) _memset_io(d,c,sz) 9#define memset_io(d,c,sz) _memset_io(d,c,sz)
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 80b54b326d49..d50e6127325d 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -136,6 +136,7 @@ static inline u32 readl(const volatile void __iomem *addr)
136} 136}
137 137
138#define readq readq 138#define readq readq
139#define readq_relaxed readq
139static inline u64 readq(const volatile void __iomem *addr) 140static inline u64 readq(const volatile void __iomem *addr)
140{ u64 ret; 141{ u64 ret;
141 142
@@ -175,6 +176,7 @@ static inline void writel(u32 l, volatile void __iomem *addr)
175} 176}
176 177
177#define writeq writeq 178#define writeq writeq
179#define writeq_relaxed writeq
178static inline void writeq(u64 q, volatile void __iomem *addr) 180static inline void writeq(u64 q, volatile void __iomem *addr)
179{ 181{
180 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */" 182 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */"
@@ -183,7 +185,6 @@ static inline void writeq(u64 q, volatile void __iomem *addr)
183 : "memory"); 185 : "memory");
184} 186}
185 187
186
187#define inb inb 188#define inb inb
188static inline u8 inb(unsigned long addr) 189static inline u8 inb(unsigned long addr)
189{ 190{
@@ -264,11 +265,6 @@ static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned l
264 outsl((unsigned long __force)port, buf, count); 265 outsl((unsigned long __force)port, buf, count);
265} 266}
266 267
267#define readb_relaxed(__addr) readb(__addr)
268#define readw_relaxed(__addr) readw(__addr)
269#define readl_relaxed(__addr) readl(__addr)
270#define readq_relaxed(__addr) readq(__addr)
271
272/* Valid I/O Space regions are anywhere, because each PCI bus supported 268/* Valid I/O Space regions are anywhere, because each PCI bus supported
273 * can live in an arbitrary area of the physical address range. 269 * can live in an arbitrary area of the physical address range.
274 */ 270 */
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index 9fe434969fab..d372641054d9 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -241,6 +241,10 @@ static inline void writeq(u64 val, unsigned long addr)
241#define readw_relaxed readw 241#define readw_relaxed readw
242#define readl_relaxed readl 242#define readl_relaxed readl
243#define readq_relaxed readq 243#define readq_relaxed readq
244#define writeb_relaxed writeb
245#define writew_relaxed writew
246#define writel_relaxed writel
247#define writeq_relaxed writeq
244 248
245#define ioread8 readb 249#define ioread8 readb
246#define ioread16 readw 250#define ioread16 readw
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index ae2b593e7c6e..0cdbe6e81b45 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -74,6 +74,9 @@ build_mmio_write(__writel, "l", unsigned int, "r", )
74#define __raw_readw __readw 74#define __raw_readw __readw
75#define __raw_readl __readl 75#define __raw_readl __readl
76 76
77#define writeb_relaxed(v, a) __writeb(v, a)
78#define writew_relaxed(v, a) __writew(v, a)
79#define writel_relaxed(v, a) __writel(v, a)
77#define __raw_writeb __writeb 80#define __raw_writeb __writeb
78#define __raw_writew __writew 81#define __raw_writew __writew
79#define __raw_writel __writel 82#define __raw_writel __writel
@@ -86,6 +89,7 @@ build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
86build_mmio_write(writeq, "q", unsigned long, "r", :"memory") 89build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
87 90
88#define readq_relaxed(a) readq(a) 91#define readq_relaxed(a) readq(a)
92#define writeq_relaxed(v, a) writeq(v, a)
89 93
90#define __raw_readq(a) readq(a) 94#define __raw_readq(a) readq(a)
91#define __raw_writeq(val, addr) writeq(val, addr) 95#define __raw_writeq(val, addr) writeq(val, addr)
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 74944207167e..fe1600a09438 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -74,13 +74,6 @@ static inline void iounmap(volatile void __iomem *addr)
74 74
75#endif /* CONFIG_MMU */ 75#endif /* CONFIG_MMU */
76 76
77/*
78 * Generic I/O
79 */
80#define readb_relaxed readb
81#define readw_relaxed readw
82#define readl_relaxed readl
83
84#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
85 78
86#include <asm-generic/io.h> 79#include <asm-generic/io.h>
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 00483d769d86..9db042304df3 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -175,6 +175,43 @@ static inline void writeq(u64 value, volatile void __iomem *addr)
175#endif /* CONFIG_64BIT */ 175#endif /* CONFIG_64BIT */
176 176
177/* 177/*
178 * {read,write}{b,w,l,q}_relaxed() are like the regular version, but
179 * are not guaranteed to provide ordering against spinlocks or memory
180 * accesses.
181 */
182#ifndef readb_relaxed
183#define readb_relaxed readb
184#endif
185
186#ifndef readw_relaxed
187#define readw_relaxed readw
188#endif
189
190#ifndef readl_relaxed
191#define readl_relaxed readl
192#endif
193
194#ifndef readq_relaxed
195#define readq_relaxed readq
196#endif
197
198#ifndef writeb_relaxed
199#define writeb_relaxed writeb
200#endif
201
202#ifndef writew_relaxed
203#define writew_relaxed writew
204#endif
205
206#ifndef writel_relaxed
207#define writel_relaxed writel
208#endif
209
210#ifndef writeq_relaxed
211#define writeq_relaxed writeq
212#endif
213
214/*
178 * {read,write}s{b,w,l,q}() repeatedly access the same memory address in 215 * {read,write}s{b,w,l,q}() repeatedly access the same memory address in
179 * native endianness in 8-, 16-, 32- or 64-bit chunks (@count times). 216 * native endianness in 8-, 16-, 32- or 64-bit chunks (@count times).
180 */ 217 */