diff options
| author | Rodrigo Vivi <[email protected]> | 2018-07-23 09:13:12 -0700 | 
|---|---|---|
| committer | Rodrigo Vivi <[email protected]> | 2018-07-23 09:13:12 -0700 | 
| commit | c74a7469f97c0f40b46e82ee979f9fb1bb6e847c (patch) | |
| tree | f2690a1a916b73ef94657fbf0e0141ae57701825 /arch/powerpc/include/asm/nohash/64/pgalloc.h | |
| parent | 6f15a7de86c8cf2dc09fc9e6d07047efa40ef809 (diff) | |
| parent | 500775074f88d9cf5416bed2ca19592812d62c41 (diff) | |
Merge drm/drm-next into drm-intel-next-queued
We need a backmerge to get DP_DPCD_REV_14 before we push other
i915 changes to dinq that could break compilation.
Signed-off-by: Rodrigo Vivi <[email protected]>
Diffstat (limited to 'arch/powerpc/include/asm/nohash/64/pgalloc.h')
| -rw-r--r-- | arch/powerpc/include/asm/nohash/64/pgalloc.h | 96 | 
1 files changed, 35 insertions, 61 deletions
| diff --git a/arch/powerpc/include/asm/nohash/64/pgalloc.h b/arch/powerpc/include/asm/nohash/64/pgalloc.h index 9721c7867b9c..e2d62d033708 100644 --- a/arch/powerpc/include/asm/nohash/64/pgalloc.h +++ b/arch/powerpc/include/asm/nohash/64/pgalloc.h @@ -52,8 +52,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)  	kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);  } -#ifndef CONFIG_PPC_64K_PAGES -  #define pgd_populate(MM, PGD, PUD)	pgd_set(PGD, (unsigned long)PUD)  static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) @@ -86,6 +84,18 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,  #define pmd_pgtable(pmd) pmd_page(pmd) +static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) +{ +	return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX), +			pgtable_gfp_flags(mm, GFP_KERNEL)); +} + +static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) +{ +	kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd); +} + +  static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,  					  unsigned long address)  { @@ -120,84 +130,48 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)  	__free_page(ptepage);  } -extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift); -#ifdef CONFIG_SMP -extern void __tlb_remove_table(void *_table); -#endif -static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, -				  unsigned long address) +static inline void pgtable_free(void *table, int shift)  { -	tlb_flush_pgtable(tlb, address); -	pgtable_free_tlb(tlb, page_address(table), 0); +	if (!shift) { +		pgtable_page_dtor(virt_to_page(table)); +		free_page((unsigned long)table); +	} else { +		BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE); +		kmem_cache_free(PGT_CACHE(shift), table); +	}  } -#else /* if CONFIG_PPC_64K_PAGES */ - -extern pte_t *pte_fragment_alloc(struct mm_struct *, unsigned long, int); -extern void pte_fragment_free(unsigned long *, int); -extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift); +#define get_hugepd_cache_index(x)	(x)  #ifdef CONFIG_SMP -extern void __tlb_remove_table(void *_table); -#endif - -#define pud_populate(mm, pud, pmd)	pud_set(pud, (unsigned long)pmd) - -static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, -				       pte_t *pte) +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)  { -	pmd_set(pmd, (unsigned long)pte); -} +	unsigned long pgf = (unsigned long)table; -static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, -				pgtable_t pte_page) -{ -	pmd_set(pmd, (unsigned long)pte_page); +	BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE); +	pgf |= shift; +	tlb_remove_table(tlb, (void *)pgf);  } -static inline pgtable_t pmd_pgtable(pmd_t pmd) +static inline void __tlb_remove_table(void *_table)  { -	return (pgtable_t)(pmd_val(pmd) & ~PMD_MASKED_BITS); -} +	void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE); +	unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE; -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, -					  unsigned long address) -{ -	return (pte_t *)pte_fragment_alloc(mm, address, 1); +	pgtable_free(table, shift);  } -static inline pgtable_t pte_alloc_one(struct mm_struct *mm, -					unsigned long address) -{ -	return (pgtable_t)pte_fragment_alloc(mm, address, 0); -} - -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) -{ -	pte_fragment_free((unsigned long *)pte, 1); -} - -static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) +#else +static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)  { -	pte_fragment_free((unsigned long *)ptepage, 0); +	pgtable_free(table, shift);  } +#endif  static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,  				  unsigned long address)  {  	tlb_flush_pgtable(tlb, address); -	pgtable_free_tlb(tlb, table, 0); -} -#endif /* CONFIG_PPC_64K_PAGES */ - -static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) -{ -	return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX), -			pgtable_gfp_flags(mm, GFP_KERNEL)); -} - -static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) -{ -	kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd); +	pgtable_free_tlb(tlb, page_address(table), 0);  }  #define __pmd_free_tlb(tlb, pmd, addr)		      \ |