[PATCH] ARM: Factor out common pmd_populate functionality
Both pmd_populate variants set two pmd entries before ensuring that they are flushed from the cache. Separate this functionality into __pmd_populate(). Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>hifive-unleashed-5.1
parent
e00d349e77
commit
bdf042486a
|
@ -89,6 +89,13 @@ static inline void pte_free(struct page *pte)
|
||||||
__free_page(pte);
|
__free_page(pte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void __pmd_populate(pmd_t *pmdp, unsigned long pmdval)
|
||||||
|
{
|
||||||
|
pmdp[0] = __pmd(pmdval);
|
||||||
|
pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
|
||||||
|
flush_pmd_entry(pmdp);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Populate the pmdp entry with a pointer to the pte. This pmd is part
|
* Populate the pmdp entry with a pointer to the pte. This pmd is part
|
||||||
* of the mm address space.
|
* of the mm address space.
|
||||||
|
@ -99,32 +106,19 @@ static inline void
|
||||||
pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
|
pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
|
||||||
{
|
{
|
||||||
unsigned long pte_ptr = (unsigned long)ptep;
|
unsigned long pte_ptr = (unsigned long)ptep;
|
||||||
unsigned long pmdval;
|
|
||||||
|
|
||||||
BUG_ON(mm != &init_mm);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The pmd must be loaded with the physical
|
* The pmd must be loaded with the physical
|
||||||
* address of the PTE table
|
* address of the PTE table
|
||||||
*/
|
*/
|
||||||
pte_ptr -= PTRS_PER_PTE * sizeof(void *);
|
pte_ptr -= PTRS_PER_PTE * sizeof(void *);
|
||||||
pmdval = __pa(pte_ptr) | _PAGE_KERNEL_TABLE;
|
__pmd_populate(pmdp, __pa(pte_ptr) | _PAGE_KERNEL_TABLE);
|
||||||
pmdp[0] = __pmd(pmdval);
|
|
||||||
pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
|
|
||||||
flush_pmd_entry(pmdp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
|
pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
|
||||||
{
|
{
|
||||||
unsigned long pmdval;
|
__pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE);
|
||||||
|
|
||||||
BUG_ON(mm == &init_mm);
|
|
||||||
|
|
||||||
pmdval = page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE;
|
|
||||||
pmdp[0] = __pmd(pmdval);
|
|
||||||
pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
|
|
||||||
flush_pmd_entry(pmdp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue