Skip to content

Commit 37c5e94

Browse files
author
Scott Wood
committed
powerpc/fsl-book3e: Avoid lbarx on e5500
lbarx/stbcx. are implemented on e6500, but not on e5500. Likewise, SMT is on e6500, but not on e5500. So, avoid executing an unimplemented instruction by only locking when needed (i.e. in the presence of SMT). Signed-off-by: Scott Wood <oss@buserror.net>
1 parent fb822e6 commit 37c5e94

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/powerpc/mm/hugetlbpage-book3e.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <linux/mm.h>
99
#include <linux/hugetlb.h>
1010

11+
#include <asm/mmu.h>
12+
1113
#ifdef CONFIG_PPC_FSL_BOOK3E
1214
#ifdef CONFIG_PPC64
1315
static inline int tlb1_next(void)
@@ -60,6 +62,14 @@ static inline void book3e_tlb_lock(void)
6062
unsigned long tmp;
6163
int token = smp_processor_id() + 1;
6264

65+
/*
66+
* Besides being unnecessary in the absence of SMT, this
67+
* check prevents trying to do lbarx/stbcx. on e5500 which
68+
* doesn't implement either feature.
69+
*/
70+
if (!cpu_has_feature(CPU_FTR_SMT))
71+
return;
72+
6373
asm volatile("1: lbarx %0, 0, %1;"
6474
"cmpwi %0, 0;"
6575
"bne 2f;"
@@ -80,6 +90,9 @@ static inline void book3e_tlb_unlock(void)
8090
{
8191
struct paca_struct *paca = get_paca();
8292

93+
if (!cpu_has_feature(CPU_FTR_SMT))
94+
return;
95+
8396
isync();
8497
paca->tcd_ptr->lock = 0;
8598
}

0 commit comments

Comments
 (0)