drm/ast: Only warn about unsupported TX chips on Gen4 and later
[drm/drm-misc.git] / arch / csky / include / asm / pgalloc.h
blob9c84c9012e534251edfb5f8252ddc8c6e96f1ecc
1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef __ASM_CSKY_PGALLOC_H
4 #define __ASM_CSKY_PGALLOC_H
6 #include <linux/highmem.h>
7 #include <linux/mm.h>
8 #include <linux/sched.h>
10 #define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL
11 #include <asm-generic/pgalloc.h>
13 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
14 pte_t *pte)
16 set_pmd(pmd, __pmd(__pa(pte)));
19 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
20 pgtable_t pte)
22 set_pmd(pmd, __pmd(__pa(page_address(pte))));
25 extern void pgd_init(unsigned long *p);
27 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
29 pte_t *pte;
30 unsigned long i;
32 pte = (pte_t *) __get_free_page(GFP_KERNEL);
33 if (!pte)
34 return NULL;
36 for (i = 0; i < PAGE_SIZE/sizeof(pte_t); i++)
37 (pte + i)->pte_low = _PAGE_GLOBAL;
39 return pte;
42 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
44 pgd_t *ret;
45 pgd_t *init;
47 ret = (pgd_t *) __get_free_page(GFP_KERNEL);
48 if (ret) {
49 init = pgd_offset(&init_mm, 0UL);
50 pgd_init((unsigned long *)ret);
51 memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
52 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
53 /* prevent out of order excute */
54 smp_mb();
55 #ifdef CONFIG_CPU_NEED_TLBSYNC
56 dcache_wb_range((unsigned int)ret,
57 (unsigned int)(ret + PTRS_PER_PGD));
58 #endif
61 return ret;
64 #define __pte_free_tlb(tlb, pte, address) \
65 do { \
66 pagetable_pte_dtor(page_ptdesc(pte)); \
67 tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \
68 } while (0)
70 extern void pagetable_init(void);
71 extern void mmu_init(unsigned long min_pfn, unsigned long max_pfn);
72 extern void pre_trap_init(void);
74 #endif /* __ASM_CSKY_PGALLOC_H */