[Top] [All Lists]

Re: [PATCH] Fix mmiowb() for MIPS I

To: Atsushi Nemoto <>
Subject: Re: [PATCH] Fix mmiowb() for MIPS I
From: "Maciej W. Rozycki" <>
Date: Wed, 21 Feb 2007 17:46:18 +0000 (GMT)
In-reply-to: <>
Original-recipient: rfc822;
References: <>
On Thu, 22 Feb 2007, Atsushi Nemoto wrote:

> The SYNC instruction is not available on MIPS I.  Use __sync() instead.
> Signed-off-by: Atsushi Nemoto <>
> ---
> diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
> index 92ec261..855c304 100644
> --- a/include/asm-mips/io.h
> +++ b/include/asm-mips/io.h
> @@ -502,8 +502,7 @@ BUILDSTRING(q, u64)
>  #endif
> -/* Depends on MIPS II instruction set */
> -#define mmiowb() asm volatile ("sync" ::: "memory")
> +#define mmiowb() __sync()
>  static inline void memset_io(volatile void __iomem *addr, unsigned char val, 
> int count)
>  {

 That's still not correct -- it should probably be defined like mb() 
currently is as the write-back buffer may defeat strong ordering (IIRC, 
the R2020 can do byte merging).  Also the semantics of mmiowb() does not 
seem to be well specified -- I gather a sequence of:

        writeb(mmioreg, val);

should guarantee "val" has reached the register (mmiowb() replacing 
incorrect mb() used in many places like this), but with either definition 
of mmiowb() and a MIPS-I-style external write-back buffer it will not 


<Prev in Thread] Current Thread [Next in Thread>