MIPS: Adjust set_pte() SMP fix to handle R10000_LLSC_WAR
[pandora-kernel.git] / arch / mips / include / asm / pgtable.h
index 95bcedb..d9e9925 100644 (file)
@@ -168,20 +168,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
                unsigned long page_global = _PAGE_GLOBAL;
                unsigned long tmp;
 
-               __asm__ __volatile__ (
-                       "       .set    push\n"
-                       "       .set    noreorder\n"
-                       "1:     " LL_INSN "     %[tmp], %[buddy]\n"
-                       "       bnez    %[tmp], 2f\n"
-                       "        or     %[tmp], %[tmp], %[global]\n"
-                       "       " SC_INSN "     %[tmp], %[buddy]\n"
-                       "       beqz    %[tmp], 1b\n"
-                       "        nop\n"
-                       "2:\n"
-                       "       .set pop"
-                       : [buddy] "+m" (buddy->pte),
-                         [tmp] "=&r" (tmp)
+               if (kernel_uses_llsc && R10000_LLSC_WAR) {
+                       __asm__ __volatile__ (
+                       "       .set    arch=r4000                      \n"
+                       "       .set    push                            \n"
+                       "       .set    noreorder                       \n"
+                       "1:"    LL_INSN " %[tmp], %[buddy]              \n"
+                       "       bnez    %[tmp], 2f                      \n"
+                       "        or     %[tmp], %[tmp], %[global]       \n"
+                               SC_INSN " %[tmp], %[buddy]              \n"
+                       "       beqzl   %[tmp], 1b                      \n"
+                       "       nop                                     \n"
+                       "2:                                             \n"
+                       "       .set    pop                             \n"
+                       "       .set    mips0                           \n"
+                       : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp)
                        : [global] "r" (page_global));
+               } else if (kernel_uses_llsc) {
+                       __asm__ __volatile__ (
+                       "       .set    arch=r4000                      \n"
+                       "       .set    push                            \n"
+                       "       .set    noreorder                       \n"
+                       "1:"    LL_INSN " %[tmp], %[buddy]              \n"
+                       "       bnez    %[tmp], 2f                      \n"
+                       "        or     %[tmp], %[tmp], %[global]       \n"
+                               SC_INSN " %[tmp], %[buddy]              \n"
+                       "       beqz    %[tmp], 1b                      \n"
+                       "       nop                                     \n"
+                       "2:                                             \n"
+                       "       .set    pop                             \n"
+                       "       .set    mips0                           \n"
+                       : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp)
+                       : [global] "r" (page_global));
+               }
 #else /* !CONFIG_SMP */
                if (pte_none(*buddy))
                        pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL;