Fix __tlbiel in hash_native_64
PATCH 1/1 Fix __tlbiel in hash_native_64
__tlbie and __tlbiel are out of sync. __tlbie does the right thing it calls tlbie with "tlbie rb, L" if CPU_FTR_ARCH_206 (cpu feature) is clear and with "tlbie rb" otherwise. During the cleanup of __tlbiel I noticed that __tlbiel was setting bit 11 PPC_BIT(21) independent of the ISA version for non-4k (L) pages. This patch fixes that issue. It also changes the current PPC_TLBIEL to PPC_TLBIEL_5 and introduces a new PPC_TLBIEL similar to PPC_TLBIE.
The arguments to PPC_TLBIE have also been changed/switched in order to be consistent with the actual assembly usage for clearer reading of code.
--- arch/powerpc/include/asm/ppc-opcode.h | 9 ++++++--- arch/powerpc/mm/hash_native_64.c | 14 ++++++++------ arch/powerpc/mm/tlb-radix.c | 4 ++-- 3 files changed, 16 insertions(+), 11 deletions(-)
arch/powerpc/include/asm/ppc-opcode.h +6 -3
@@ -354,14 +354,17 @@#define PPC_TLBILX_VA (a, b) PPC_TLBILX(3, a, b)#define PPC_WAIT (w) stringify_in_c(.long PPC_INST_WAIT | \ __PPC_WC(w)) -#define PPC_TLBIE (lp,a) stringify_in_c(.long PPC_INST_TLBIE | \ - ___PPC_RB(a) | ___PPC_RS(lp)) +#define PPC_TLBIE (rb,lp) stringify_in_c(.long PPC_INST_TLBIE | \ + ___PPC_RB(rb) | ___PPC_RS(lp))#define PPC_TLBIE_5 (rb,rs,ric,prs,r) \ stringify_in_c(.long PPC_INST_TLBIE | \ ___PPC_RB(rb) | ___PPC_RS(rs) | \ ___PPC_RIC(ric) | ___PPC_PRS(prs) | \ ___PPC_R(r)) -#define PPC_TLBIEL (rb,rs,ric,prs,r) \ +#define PPC_TLBIEL (rb,lp) \ + stringify_in_c(.long PPC_INST_TLBIEL | \ + ___PPC_RB(rb) | ___PPC_RS(lp)) +#define PPC_TLBIEL_5 (rb,rs,ric,prs,r) \ stringify_in_c(.long PPC_INST_TLBIEL | \ ___PPC_RB(rb) | ___PPC_RS(rs) | \ ___PPC_RIC(ric) | ___PPC_PRS(prs) | \
arch/powerpc/mm/hash_native_64.c +8 -6
@@ -74,7 +74,7 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize) va |= ssize <<8 ; sllp =get_sllp_encoding (apsize); va |= sllp <<5 ; - asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2) + asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%0,%1), %2) : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) : "memory");break ;
@@ -93,7 +93,7 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize)*/ va |= (vpn &0xfe );/* AVAL */ va |=1 ;/* L */ - asm volatile(ASM_FTR_IFCLR("tlbie %0,1", PPC_TLBIE(%1,%0), %2) + asm volatile(ASM_FTR_IFCLR("tlbie %0,1", PPC_TLBIE(%0,%1), %2) : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) : "memory");break ;
@@ -123,8 +123,9 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize) va |= ssize <<8 ; sllp =get_sllp_encoding (apsize); va |= sllp <<5 ; - asmvolatile (".long 0x7c000224 | (%0 << 11) | (0 << 21)" - : :"r" (va) :"memory" ); + asm volatile(ASM_FTR_IFCLR("tlbiel %0,0", PPC_TLBIEL(%0,%1), %2) + : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) + : "memory");break ;default :/* We need 14 to 14 + i bits of va */
@@ -141,8 +142,9 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)*/ va |= (vpn &0xfe ); va |=1 ;/* L */ - asmvolatile (".long 0x7c000224 | (%0 << 11) | (1 << 21)" - : :"r" (va) :"memory" ); + asm volatile(ASM_FTR_IFCLR("tlbiel %0,1", PPC_TLBIEL(%0,%1), %2) + : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) + : "memory");break ; }
arch/powerpc/mm/tlb-radix.c +2 -2
@@ -35,7 +35,7 @@ static inline void __tlbiel_pid(unsigned long pid, int set, r =1 ;/* raidx format */ asmvolatile ("ptesync" : : :"memory" ); - asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1) + asm volatile(PPC_TLBIEL_5(%0, %4, %3, %2, %1) : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory"); asm volatile("ptesync": : :"memory"); }
@@ -80,7 +80,7 @@ static inline void _tlbiel_va(unsigned long va, unsigned long pid, r =1 ;/* raidx format */ asmvolatile ("ptesync" : : :"memory" ); - asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1) + asm volatile(PPC_TLBIEL_5(%0, %4, %3, %2, %1) : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory"); asm volatile("ptesync": : :"memory"); }
Signature · 1 line
2.5.5
Quoted 12 lines · Balbir Singh
__tlbieand__tlbielare out of sync.__tlbiedoes the right thing it calls tlbie with "tlbie rb, L" ifCPU_FTR_ARCH_206(cpu feature) is clear and with "tlbie rb" otherwise. During the cleanup of__tlbielI noticed that__tlbielwas setting bit 11PPC_BIT(21)independent of the ISA version for non-4k (L) pages. This patch fixes that issue. It also changes the currentPPC_TLBIELtoPPC_TLBIEL_5and introduces a newPPC_TLBIELsimilar toPPC_TLBIE.The arguments to
PPC_TLBIEhave also been changed/switched in order to be consistent with the actual assembly usage for clearer reading of code.
Quoted 5 lines
Cc Paul Mackerras <[email protected]>Cc Aneesh Kumar K.V <[email protected]>Cc Michael Ellerman <[email protected]>Signed-off-by Balbir Singh <[email protected]>
Please ignore.. resending with fixes
Balbir