mm: reorder includes after introduction of linux/pgtable.h
[sfrench/cifs-2.6.git] / arch / arm / mm / mm.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifdef CONFIG_MMU
3 #include <linux/list.h>
4 #include <linux/vmalloc.h>
5 #include <linux/pgtable.h>
6
7 /* the upper-most page table pointer */
8 extern pmd_t *top_pmd;
9
10 extern int icache_size;
11
12 /*
13  * 0xffff8000 to 0xffffffff is reserved for any ARM architecture
14  * specific hacks for copying pages efficiently, while 0xffff4000
15  * is reserved for VIPT aliasing flushing by generic code.
16  *
17  * Note that we don't allow VIPT aliasing caches with SMP.
18  */
19 #define COPYPAGE_MINICACHE      0xffff8000
20 #define COPYPAGE_V6_FROM        0xffff8000
21 #define COPYPAGE_V6_TO          0xffffc000
22 /* PFN alias flushing, for VIPT caches */
23 #define FLUSH_ALIAS_START       0xffff4000
24
25 static inline void set_top_pte(unsigned long va, pte_t pte)
26 {
27         pte_t *ptep = pte_offset_kernel(top_pmd, va);
28         set_pte_ext(ptep, pte, 0);
29         local_flush_tlb_kernel_page(va);
30 }
31
32 static inline pte_t get_top_pte(unsigned long va)
33 {
34         pte_t *ptep = pte_offset_kernel(top_pmd, va);
35         return *ptep;
36 }
37
38 static inline pmd_t *pmd_off_k(unsigned long virt)
39 {
40         return pmd_offset(pud_offset(p4d_offset(pgd_offset_k(virt), virt), virt), virt);
41 }
42
43 struct mem_type {
44         pteval_t prot_pte;
45         pteval_t prot_pte_s2;
46         pmdval_t prot_l1;
47         pmdval_t prot_sect;
48         unsigned int domain;
49 };
50
51 const struct mem_type *get_mem_type(unsigned int type);
52
53 extern void __flush_dcache_page(struct address_space *mapping, struct page *page);
54
55 /*
56  * ARM specific vm_struct->flags bits.
57  */
58
59 /* (super)section-mapped I/O regions used by ioremap()/iounmap() */
60 #define VM_ARM_SECTION_MAPPING  0x80000000
61
62 /* permanent static mappings from iotable_init() */
63 #define VM_ARM_STATIC_MAPPING   0x40000000
64
65 /* empty mapping */
66 #define VM_ARM_EMPTY_MAPPING    0x20000000
67
68 /* mapping type (attributes) for permanent static mappings */
69 #define VM_ARM_MTYPE(mt)                ((mt) << 20)
70 #define VM_ARM_MTYPE_MASK       (0x1f << 20)
71
72
73 struct static_vm {
74         struct vm_struct vm;
75         struct list_head list;
76 };
77
78 extern struct list_head static_vmlist;
79 extern struct static_vm *find_static_vm_vaddr(void *vaddr);
80 extern __init void add_static_vm_early(struct static_vm *svm);
81
82 #endif
83
84 #ifdef CONFIG_ZONE_DMA
85 extern phys_addr_t arm_dma_limit;
86 extern unsigned long arm_dma_pfn_limit;
87 #else
88 #define arm_dma_limit ((phys_addr_t)~0)
89 #define arm_dma_pfn_limit (~0ul >> PAGE_SHIFT)
90 #endif
91
92 extern phys_addr_t arm_lowmem_limit;
93
94 void __init bootmem_init(void);
95 void arm_mm_memblock_reserve(void);
96 void dma_contiguous_remap(void);
97
98 unsigned long __clear_cr(unsigned long mask);