summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Wood <oss@buserror.net>2016-03-02 22:51:04 -0600
committerScott Wood <oss@buserror.net>2016-03-03 23:43:05 -0600
commit37c5e942bb2eedd98c1cd1fa1f94d79f6b830c38 (patch)
tree2d846e3812b414f352d91779c311e4b08f1cd069
parentfb822e6076d972691c5dd33431c10f82dda94ae9 (diff)
downloadlinux-sh-37c5e942bb2eedd98c1cd1fa1f94d79f6b830c38.tar.gz
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>
-rw-r--r--arch/powerpc/mm/hugetlbpage-book3e.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/mm/hugetlbpage-book3e.c b/arch/powerpc/mm/hugetlbpage-book3e.c
index 7e6d0880813f..83a8be791e06 100644
--- a/arch/powerpc/mm/hugetlbpage-book3e.c
+++ b/arch/powerpc/mm/hugetlbpage-book3e.c
@@ -8,6 +8,8 @@
#include <linux/mm.h>
#include <linux/hugetlb.h>
+#include <asm/mmu.h>
+
#ifdef CONFIG_PPC_FSL_BOOK3E
#ifdef CONFIG_PPC64
static inline int tlb1_next(void)
@@ -60,6 +62,14 @@ static inline void book3e_tlb_lock(void)
unsigned long tmp;
int token = smp_processor_id() + 1;
+ /*
+ * Besides being unnecessary in the absence of SMT, this
+ * check prevents trying to do lbarx/stbcx. on e5500 which
+ * doesn't implement either feature.
+ */
+ if (!cpu_has_feature(CPU_FTR_SMT))
+ return;
+
asm volatile("1: lbarx %0, 0, %1;"
"cmpwi %0, 0;"
"bne 2f;"
@@ -80,6 +90,9 @@ static inline void book3e_tlb_unlock(void)
{
struct paca_struct *paca = get_paca();
+ if (!cpu_has_feature(CPU_FTR_SMT))
+ return;
+
isync();
paca->tcd_ptr->lock = 0;
}