diff options
author | Sinan Kaya <okaya@codeaurora.org> | 2018-04-05 09:09:11 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2018-04-06 12:01:56 +0200 |
commit | 755bd04aaf4bf7c49ce8aad2677ea4d14271fc46 (patch) | |
tree | a0899a14c45441eada77bc04a6ccf8fbec69db13 /include/asm-generic/io.h | |
parent | 032d59e1cde9dd71bb5918e1f6529776623ee86b (diff) |
io: define stronger ordering for the default writeX() implementation
The default implementation of mapping writeX() to __raw_writeX() is wrong.
writeX() has stronger ordering semantics. Compiler is allowed to reorder
memory writes against __raw_writeX().
Use the previously defined __io_aw() and __io_bw() macros to harden
code generation according to architecture support.
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'include/asm-generic/io.h')
-rw-r--r-- | include/asm-generic/io.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index d27e8af9dd5a..964725e4f459 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -208,7 +208,9 @@ static inline u64 readq(const volatile void __iomem *addr) #define writeb writeb static inline void writeb(u8 value, volatile void __iomem *addr) { + __io_bw(); __raw_writeb(value, addr); + __io_aw(); } #endif @@ -216,7 +218,9 @@ static inline void writeb(u8 value, volatile void __iomem *addr) #define writew writew static inline void writew(u16 value, volatile void __iomem *addr) { + __io_bw(); __raw_writew(cpu_to_le16(value), addr); + __io_aw(); } #endif @@ -224,7 +228,9 @@ static inline void writew(u16 value, volatile void __iomem *addr) #define writel writel static inline void writel(u32 value, volatile void __iomem *addr) { + __io_bw(); __raw_writel(__cpu_to_le32(value), addr); + __io_aw(); } #endif @@ -233,7 +239,9 @@ static inline void writel(u32 value, volatile void __iomem *addr) #define writeq writeq static inline void writeq(u64 value, volatile void __iomem *addr) { + __io_bw(); __raw_writeq(__cpu_to_le64(value), addr); + __io_aw(); } #endif #endif /* CONFIG_64BIT */ |