Skip to content

Commit 92d7223

Browse files
Sinan Kayamattst88
authored andcommitted
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: Sinan Kaya <okaya@codeaurora.org> Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Matt Turner <mattst88@gmail.com>
1 parent f5e82fa commit 92d7223

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • arch/alpha/kernel

arch/alpha/kernel/io.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ unsigned int ioread32(void __iomem *addr)
3737

3838
void iowrite8(u8 b, void __iomem *addr)
3939
{
40-
IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
4140
mb();
41+
IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
4242
}
4343

4444
void iowrite16(u16 b, void __iomem *addr)
4545
{
46-
IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
4746
mb();
47+
IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
4848
}
4949

5050
void iowrite32(u32 b, void __iomem *addr)
5151
{
52-
IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
5352
mb();
53+
IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
5454
}
5555

5656
EXPORT_SYMBOL(ioread8);
@@ -176,26 +176,26 @@ u64 readq(const volatile void __iomem *addr)
176176

177177
void writeb(u8 b, volatile void __iomem *addr)
178178
{
179-
__raw_writeb(b, addr);
180179
mb();
180+
__raw_writeb(b, addr);
181181
}
182182

183183
void writew(u16 b, volatile void __iomem *addr)
184184
{
185-
__raw_writew(b, addr);
186185
mb();
186+
__raw_writew(b, addr);
187187
}
188188

189189
void writel(u32 b, volatile void __iomem *addr)
190190
{
191-
__raw_writel(b, addr);
192191
mb();
192+
__raw_writel(b, addr);
193193
}
194194

195195
void writeq(u64 b, volatile void __iomem *addr)
196196
{
197-
__raw_writeq(b, addr);
198197
mb();
198+
__raw_writeq(b, addr);
199199
}
200200

201201
EXPORT_SYMBOL(readb);

0 commit comments

Comments
 (0)