diff options
author | Kevin Hilman <khilman@linaro.org> | 2015-09-14 14:16:54 -0700 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2015-09-14 14:16:54 -0700 |
commit | 0e4f19b4e5d6c4801d0ee2c26a5850de1b44f4af (patch) | |
tree | cbd277d85dedfe2f64b94c5e385b311e2c017137 /arch/mips/include/asm/pgtable.h | |
parent | 59255ac55ba6ecd195ef97c6bcd1303a7f838c94 (diff) | |
parent | 4d869de174c78ae29ca91b41581367c8092d933d (diff) |
Merge branch 'linux-linaro-lsk-v3.10' into linux-linaro-lsk-v3.10-rtlsk-v3.10-16.03-rtlsk-v3.10-16.02-rtlsk-v3.10-16.01-rtlsk-v3.10-15.12-rtlsk-v3.10-15.11-rtlsk-v3.10-15.10-rtlsk-v3.10-15.09-rtlinux-linaro-lsk-v3.10-rt
Diffstat (limited to 'arch/mips/include/asm/pgtable.h')
-rw-r--r-- | arch/mips/include/asm/pgtable.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 8b8f6b393363..e821de7cb14e 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -150,8 +150,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) * Make sure the buddy is global too (if it's !none, * it better already be global) */ +#ifdef CONFIG_SMP + /* + * For SMP, multiple CPUs can race, so we need to do + * this atomically. + */ +#ifdef CONFIG_64BIT +#define LL_INSN "lld" +#define SC_INSN "scd" +#else /* CONFIG_32BIT */ +#define LL_INSN "ll" +#define SC_INSN "sc" +#endif + 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) + : [global] "r" (page_global)); +#else /* !CONFIG_SMP */ if (pte_none(*buddy)) pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; +#endif /* CONFIG_SMP */ } #endif } |