diff options
author | Anton Blanchard <anton@samba.org> | 2013-08-06 18:01:51 +0200 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-08-14 07:33:40 +0200 |
commit | 54bb7f4bda0ee49f39dc593c2d73fe6053a99dbb (patch) | |
tree | 80a86974e8e89de50ec9eaacf3366a2f44c82986 /arch/powerpc/include/asm/spinlock.h | |
parent | powerpc: Fix little endian coredumps (diff) | |
download | linux-54bb7f4bda0ee49f39dc593c2d73fe6053a99dbb.tar.xz linux-54bb7f4bda0ee49f39dc593c2d73fe6053a99dbb.zip |
powerpc: Make rwlocks endian safe
Our ppc64 spinlocks and rwlocks use a trick where a lock token and
the paca index are placed in the lock with a single store. Since we
are using two u16s they need adjusting for little endian.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/spinlock.h')
-rw-r--r-- | arch/powerpc/include/asm/spinlock.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h index 7c345b6518db..5f54a744dcc5 100644 --- a/arch/powerpc/include/asm/spinlock.h +++ b/arch/powerpc/include/asm/spinlock.h @@ -32,8 +32,12 @@ #ifdef CONFIG_PPC64 /* use 0x800000yy when locked, where yy == CPU number */ +#ifdef __BIG_ENDIAN__ #define LOCK_TOKEN (*(u32 *)(&get_paca()->lock_token)) #else +#define LOCK_TOKEN (*(u32 *)(&get_paca()->paca_index)) +#endif +#else #define LOCK_TOKEN 1 #endif |