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