drm/panthor: Don't add write fences to the shared BOs
[drm/drm-misc.git] / arch / mips / mm / pgtable-64.c
blob1e544827dea9dcf840df006452ba03e970b57e21
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 1999, 2000 by Silicon Graphics
7 * Copyright (C) 2003 by Ralf Baechle
8 */
9 #include <linux/export.h>
10 #include <linux/init.h>
11 #include <linux/mm.h>
12 #include <asm/fixmap.h>
13 #include <asm/pgalloc.h>
14 #include <asm/tlbflush.h>
16 void pgd_init(void *addr)
18 unsigned long *p, *end;
19 unsigned long entry;
21 #if !defined(__PAGETABLE_PUD_FOLDED)
22 entry = (unsigned long)invalid_pud_table;
23 #elif !defined(__PAGETABLE_PMD_FOLDED)
24 entry = (unsigned long)invalid_pmd_table;
25 #else
26 entry = (unsigned long)invalid_pte_table;
27 #endif
29 p = (unsigned long *) addr;
30 end = p + PTRS_PER_PGD;
32 do {
33 p[0] = entry;
34 p[1] = entry;
35 p[2] = entry;
36 p[3] = entry;
37 p[4] = entry;
38 p += 8;
39 p[-3] = entry;
40 p[-2] = entry;
41 p[-1] = entry;
42 } while (p != end);
45 #ifndef __PAGETABLE_PMD_FOLDED
46 void pmd_init(void *addr)
48 unsigned long *p, *end;
49 unsigned long pagetable = (unsigned long)invalid_pte_table;
51 p = (unsigned long *)addr;
52 end = p + PTRS_PER_PMD;
54 do {
55 p[0] = pagetable;
56 p[1] = pagetable;
57 p[2] = pagetable;
58 p[3] = pagetable;
59 p[4] = pagetable;
60 p += 8;
61 p[-3] = pagetable;
62 p[-2] = pagetable;
63 p[-1] = pagetable;
64 } while (p != end);
66 EXPORT_SYMBOL_GPL(pmd_init);
67 #endif
69 #ifndef __PAGETABLE_PUD_FOLDED
70 void pud_init(void *addr)
72 unsigned long *p, *end;
73 unsigned long pagetable = (unsigned long)invalid_pmd_table;
75 p = (unsigned long *)addr;
76 end = p + PTRS_PER_PUD;
78 do {
79 p[0] = pagetable;
80 p[1] = pagetable;
81 p[2] = pagetable;
82 p[3] = pagetable;
83 p[4] = pagetable;
84 p += 8;
85 p[-3] = pagetable;
86 p[-2] = pagetable;
87 p[-1] = pagetable;
88 } while (p != end);
90 #endif
92 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
93 pmd_t mk_pmd(struct page *page, pgprot_t prot)
95 pmd_t pmd;
97 pmd_val(pmd) = (page_to_pfn(page) << PFN_PTE_SHIFT) | pgprot_val(prot);
99 return pmd;
102 void set_pmd_at(struct mm_struct *mm, unsigned long addr,
103 pmd_t *pmdp, pmd_t pmd)
105 *pmdp = pmd;
107 #endif
109 void __init pagetable_init(void)
111 unsigned long vaddr;
112 pgd_t *pgd_base;
114 /* Initialize the entire pgd. */
115 pgd_init(swapper_pg_dir);
116 #ifndef __PAGETABLE_PUD_FOLDED
117 pud_init(invalid_pud_table);
118 #endif
119 #ifndef __PAGETABLE_PMD_FOLDED
120 pmd_init(invalid_pmd_table);
121 #endif
122 pgd_base = swapper_pg_dir;
124 * Fixed mappings:
126 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
127 fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base);