提交 92d7223a 编写于 作者: S Sinan Kaya 提交者: Matt Turner

alpha: io: reorder barriers to guarantee writeX() and iowriteX() ordering #2

memory-barriers.txt has been updated with the following requirement.

"When using writel(), a prior wmb() is not needed to guarantee that the
cache coherent memory writes have completed before writing to the MMIO
region."

Current writeX() and iowriteX() implementations on alpha are not
satisfying this requirement as the barrier is after the register write.

Move mb() in writeX() and iowriteX() functions to guarantee that HW
observes memory changes before performing register operations.
Signed-off-by: NSinan Kaya <okaya@codeaurora.org>
Reported-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NMatt Turner <mattst88@gmail.com>
上级 f5e82fa2
...@@ -37,20 +37,20 @@ unsigned int ioread32(void __iomem *addr) ...@@ -37,20 +37,20 @@ unsigned int ioread32(void __iomem *addr)
void iowrite8(u8 b, void __iomem *addr) void iowrite8(u8 b, void __iomem *addr)
{ {
IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
mb(); mb();
IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
} }
void iowrite16(u16 b, void __iomem *addr) void iowrite16(u16 b, void __iomem *addr)
{ {
IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
mb(); mb();
IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
} }
void iowrite32(u32 b, void __iomem *addr) void iowrite32(u32 b, void __iomem *addr)
{ {
IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
mb(); mb();
IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
} }
EXPORT_SYMBOL(ioread8); EXPORT_SYMBOL(ioread8);
...@@ -176,26 +176,26 @@ u64 readq(const volatile void __iomem *addr) ...@@ -176,26 +176,26 @@ u64 readq(const volatile void __iomem *addr)
void writeb(u8 b, volatile void __iomem *addr) void writeb(u8 b, volatile void __iomem *addr)
{ {
__raw_writeb(b, addr);
mb(); mb();
__raw_writeb(b, addr);
} }
void writew(u16 b, volatile void __iomem *addr) void writew(u16 b, volatile void __iomem *addr)
{ {
__raw_writew(b, addr);
mb(); mb();
__raw_writew(b, addr);
} }
void writel(u32 b, volatile void __iomem *addr) void writel(u32 b, volatile void __iomem *addr)
{ {
__raw_writel(b, addr);
mb(); mb();
__raw_writel(b, addr);
} }
void writeq(u64 b, volatile void __iomem *addr) void writeq(u64 b, volatile void __iomem *addr)
{ {
__raw_writeq(b, addr);
mb(); mb();
__raw_writeq(b, addr);
} }
EXPORT_SYMBOL(readb); EXPORT_SYMBOL(readb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册