powerpc/nohash: Use IS_ENABLED() to simplify __set_pte_at()
By using IS_ENABLED() we can simplify __set_pte_at() by removing redundant *ptep = pte. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
0d594aa75f
commit
d5808ffaec
@ -147,40 +147,33 @@ extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
|
|||||||
static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
|
static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
|
||||||
pte_t *ptep, pte_t pte, int percpu)
|
pte_t *ptep, pte_t pte, int percpu)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_PPC32) && defined(CONFIG_PTE_64BIT)
|
|
||||||
/* Second case is 32-bit with 64-bit PTE. In this case, we
|
/* Second case is 32-bit with 64-bit PTE. In this case, we
|
||||||
* can just store as long as we do the two halves in the right order
|
* can just store as long as we do the two halves in the right order
|
||||||
* with a barrier in between.
|
* with a barrier in between.
|
||||||
* In the percpu case, we also fallback to the simple update
|
* In the percpu case, we also fallback to the simple update
|
||||||
*/
|
*/
|
||||||
if (percpu) {
|
if (IS_ENABLED(CONFIG_PPC32) && IS_ENABLED(CONFIG_PTE_64BIT) && !percpu) {
|
||||||
*ptep = pte;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
__asm__ __volatile__("\
|
__asm__ __volatile__("\
|
||||||
stw%U0%X0 %2,%0\n\
|
stw%U0%X0 %2,%0\n\
|
||||||
eieio\n\
|
eieio\n\
|
||||||
stw%U0%X0 %L2,%1"
|
stw%U0%X0 %L2,%1"
|
||||||
: "=m" (*ptep), "=m" (*((unsigned char *)ptep+4))
|
: "=m" (*ptep), "=m" (*((unsigned char *)ptep+4))
|
||||||
: "r" (pte) : "memory");
|
: "r" (pte) : "memory");
|
||||||
|
return;
|
||||||
#else
|
}
|
||||||
/* Anything else just stores the PTE normally. That covers all 64-bit
|
/* Anything else just stores the PTE normally. That covers all 64-bit
|
||||||
* cases, and 32-bit non-hash with 32-bit PTEs.
|
* cases, and 32-bit non-hash with 32-bit PTEs.
|
||||||
*/
|
*/
|
||||||
*ptep = pte;
|
*ptep = pte;
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_BOOK3E_64
|
|
||||||
/*
|
/*
|
||||||
* With hardware tablewalk, a sync is needed to ensure that
|
* With hardware tablewalk, a sync is needed to ensure that
|
||||||
* subsequent accesses see the PTE we just wrote. Unlike userspace
|
* subsequent accesses see the PTE we just wrote. Unlike userspace
|
||||||
* mappings, we can't tolerate spurious faults, so make sure
|
* mappings, we can't tolerate spurious faults, so make sure
|
||||||
* the new PTE will be seen the first time.
|
* the new PTE will be seen the first time.
|
||||||
*/
|
*/
|
||||||
if (is_kernel_addr(addr))
|
if (IS_ENABLED(CONFIG_PPC_BOOK3E_64) && is_kernel_addr(addr))
|
||||||
mb();
|
mb();
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user