Recommended functions for accessing internal registers

Benjamin Herrenschmidt benh at
Thu Dec 3 07:57:55 EST 2009

On Tue, 2009-12-01 at 17:44 +0100, Fortini Matteo wrote:
> I see that throughout the kernel source, internal PPC registers are 
> accessed through [in|out]_be[32|16|8]() functions. However, they are 
> translated into 3 inline assembly instructions, one of which is an 
> isync, which has a huge performance hit.
> I tried using readl_be() which seems to be the right function according 
> to the Documentation/ dir, but it is translated directly to in_be32(), 
> so no luck.
> Is it really necessary to use all those instructions? I know I could use 
> a (volatile u32 *) variable to avoid subsequent read/writes to be 
> optimized out, but it seems to be a deprecated use.

There are good reasons why the accessors contain those barriers. What
are you doing that would be performance critical enough for those to be
a problem ?


More information about the Linuxppc-dev mailing list