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