Skip to content

Commit cd0e00c

Browse files
Sinan Kayamattst88
authored andcommitted
alpha: io: reorder barriers to guarantee writeX() and iowriteX() ordering
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 <[email protected]> Reported-by: Arnd Bergmann <[email protected]> Signed-off-by: Matt Turner <[email protected]>
1 parent 6fd16ce commit cd0e00c

File tree

1 file changed

+7
-7
lines changed
  • arch/alpha/include/asm

1 file changed

+7
-7
lines changed

arch/alpha/include/asm/io.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,14 @@ extern inline unsigned int ioread16(void __iomem *addr)
341341

342342
extern inline void iowrite8(u8 b, void __iomem *addr)
343343
{
344-
IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
345344
mb();
345+
IO_CONCAT(__IO_PREFIX, iowrite8)(b, addr);
346346
}
347347

348348
extern inline void iowrite16(u16 b, void __iomem *addr)
349349
{
350-
IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
351350
mb();
351+
IO_CONCAT(__IO_PREFIX, iowrite16)(b, addr);
352352
}
353353

354354
extern inline u8 inb(unsigned long port)
@@ -382,8 +382,8 @@ extern inline unsigned int ioread32(void __iomem *addr)
382382

383383
extern inline void iowrite32(u32 b, void __iomem *addr)
384384
{
385-
IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
386385
mb();
386+
IO_CONCAT(__IO_PREFIX, iowrite32)(b, addr);
387387
}
388388

389389
extern inline u32 inl(unsigned long port)
@@ -434,14 +434,14 @@ extern inline u16 readw(const volatile void __iomem *addr)
434434

435435
extern inline void writeb(u8 b, volatile void __iomem *addr)
436436
{
437-
__raw_writeb(b, addr);
438437
mb();
438+
__raw_writeb(b, addr);
439439
}
440440

441441
extern inline void writew(u16 b, volatile void __iomem *addr)
442442
{
443-
__raw_writew(b, addr);
444443
mb();
444+
__raw_writew(b, addr);
445445
}
446446
#endif
447447

@@ -482,14 +482,14 @@ extern inline u64 readq(const volatile void __iomem *addr)
482482

483483
extern inline void writel(u32 b, volatile void __iomem *addr)
484484
{
485-
__raw_writel(b, addr);
486485
mb();
486+
__raw_writel(b, addr);
487487
}
488488

489489
extern inline void writeq(u64 b, volatile void __iomem *addr)
490490
{
491-
__raw_writeq(b, addr);
492491
mb();
492+
__raw_writeq(b, addr);
493493
}
494494
#endif
495495

0 commit comments

Comments
 (0)