blob: d5a982d15a88e2a37a524267f31633f497aa0d4b [file] [log] [blame]
Russell King3ff15592006-11-30 13:53:54 +00001#ifdef CONFIG_MMU
Joonsoo Kimed8fd212013-02-09 06:28:05 +01002#include <linux/list.h>
3#include <linux/vmalloc.h>
Russell King3ff15592006-11-30 13:53:54 +00004
Nicolas Pitre5f0fbf92008-09-16 13:05:53 -04005/* the upper-most page table pointer */
Russell King1b2e2b72006-08-21 17:06:38 +01006extern pmd_t *top_pmd;
7
Russell Kingde27c302011-07-02 14:46:27 +01008/*
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
Russell King67ece142011-07-02 15:20:44 +010021static inline void set_top_pte(unsigned long va, pte_t pte)
22{
Russell King60db4fc2011-07-04 11:25:53 +010023 pte_t *ptep = pte_offset_kernel(top_pmd, va);
24 set_pte_ext(ptep, pte, 0);
Russell King67ece142011-07-02 15:20:44 +010025 local_flush_tlb_kernel_page(va);
26}
27
Russell King0d31fe42011-07-04 11:22:27 +010028static inline pte_t get_top_pte(unsigned long va)
29{
Russell King60db4fc2011-07-04 11:25:53 +010030 pte_t *ptep = pte_offset_kernel(top_pmd, va);
31 return *ptep;
Russell King0d31fe42011-07-04 11:22:27 +010032}
33
Russell King1b2e2b72006-08-21 17:06:38 +010034static inline pmd_t *pmd_off_k(unsigned long virt)
35{
Russell Kingcc780af2011-05-26 19:50:30 +010036 return pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt);
Russell King1b2e2b72006-08-21 17:06:38 +010037}
38
Russell Kingb29e9f52007-04-21 10:47:29 +010039struct mem_type {
Russell Kingf6e33542010-11-16 00:22:09 +000040 pteval_t prot_pte;
Catalin Marinas442e70c2011-09-05 17:51:56 +010041 pmdval_t prot_l1;
42 pmdval_t prot_sect;
Russell Kingb29e9f52007-04-21 10:47:29 +010043 unsigned int domain;
44};
45
46const struct mem_type *get_mem_type(unsigned int type);
47
Russell King7b0a1002009-10-24 14:11:59 +010048extern void __flush_dcache_page(struct address_space *mapping, struct page *page);
49
Nicolas Pitre576d2f22011-09-16 01:14:23 -040050/*
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
Russell Kinga8490882012-08-25 09:03:15 +010060/* empty mapping */
61#define VM_ARM_EMPTY_MAPPING 0x20000000
62
Nicolas Pitre576d2f22011-09-16 01:14:23 -040063/* mapping type (attributes) for permanent static mappings */
64#define VM_ARM_MTYPE(mt) ((mt) << 20)
65#define VM_ARM_MTYPE_MASK (0x1f << 20)
66
Marek Szyprowskie9da6e92012-07-30 09:11:33 +020067/* consistent regions used by dma_alloc_attrs() */
68#define VM_ARM_DMA_CONSISTENT 0x20000000
69
Joonsoo Kimed8fd212013-02-09 06:28:05 +010070
71struct static_vm {
72 struct vm_struct vm;
73 struct list_head list;
74};
75
76extern struct list_head static_vmlist;
77extern struct static_vm *find_static_vm_vaddr(void *vaddr);
78extern __init void add_static_vm_early(struct static_vm *svm);
79
Russell King3ff15592006-11-30 13:53:54 +000080#endif
81
Russell King022ae532011-07-08 21:26:59 +010082#ifdef CONFIG_ZONE_DMA
Marek Szyprowski4986e5c2012-06-06 12:05:01 +020083extern phys_addr_t arm_dma_limit;
Russell King4dcfa602013-07-09 12:14:49 +010084extern unsigned long arm_dma_pfn_limit;
Russell King022ae532011-07-08 21:26:59 +010085#else
Russell King09b2ad12012-07-05 13:11:31 +010086#define arm_dma_limit ((phys_addr_t)~0)
Russell King4dcfa602013-07-09 12:14:49 +010087#define arm_dma_pfn_limit (~0ul >> PAGE_SHIFT)
Russell King022ae532011-07-08 21:26:59 +010088#endif
89
Marek Szyprowskic7909502011-12-29 13:09:51 +010090extern phys_addr_t arm_lowmem_limit;
91
Russell King8d717a52010-05-22 19:47:18 +010092void __init bootmem_init(void);
Russell King2778f622010-07-09 16:27:52 +010093void arm_mm_memblock_reserve(void);
Marek Szyprowskic7909502011-12-29 13:09:51 +010094void dma_contiguous_remap(void);