blob: ce727d47275c2a7f4430f54b617bba6fb8196df8 [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
Russell Kingb4b20ad2014-04-13 18:57:29 +01005#include <asm/pgtable.h>
6
Nicolas Pitre5f0fbf92008-09-16 13:05:53 -04007/* the upper-most page table pointer */
Russell King1b2e2b72006-08-21 17:06:38 +01008extern pmd_t *top_pmd;
9
Russell Kingde27c302011-07-02 14:46:27 +010010/*
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
Russell King67ece142011-07-02 15:20:44 +010023static inline void set_top_pte(unsigned long va, pte_t pte)
24{
Russell King60db4fc2011-07-04 11:25:53 +010025 pte_t *ptep = pte_offset_kernel(top_pmd, va);
26 set_pte_ext(ptep, pte, 0);
Russell King67ece142011-07-02 15:20:44 +010027 local_flush_tlb_kernel_page(va);
28}
29
Russell King0d31fe42011-07-04 11:22:27 +010030static inline pte_t get_top_pte(unsigned long va)
31{
Russell King60db4fc2011-07-04 11:25:53 +010032 pte_t *ptep = pte_offset_kernel(top_pmd, va);
33 return *ptep;
Russell King0d31fe42011-07-04 11:22:27 +010034}
35
Russell King1b2e2b72006-08-21 17:06:38 +010036static inline pmd_t *pmd_off_k(unsigned long virt)
37{
Russell Kingcc780af2011-05-26 19:50:30 +010038 return pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt);
Russell King1b2e2b72006-08-21 17:06:38 +010039}
40
Russell Kingb29e9f52007-04-21 10:47:29 +010041struct mem_type {
Russell Kingf6e33542010-11-16 00:22:09 +000042 pteval_t prot_pte;
Christoffer Dall4d9c5b82014-02-02 22:21:31 +010043 pteval_t prot_pte_s2;
Catalin Marinas442e70c2011-09-05 17:51:56 +010044 pmdval_t prot_l1;
45 pmdval_t prot_sect;
Russell Kingb29e9f52007-04-21 10:47:29 +010046 unsigned int domain;
47};
48
49const struct mem_type *get_mem_type(unsigned int type);
50
Russell King7b0a1002009-10-24 14:11:59 +010051extern void __flush_dcache_page(struct address_space *mapping, struct page *page);
52
Nicolas Pitre576d2f22011-09-16 01:14:23 -040053/*
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
Russell Kinga8490882012-08-25 09:03:15 +010063/* empty mapping */
64#define VM_ARM_EMPTY_MAPPING 0x20000000
65
Nicolas Pitre576d2f22011-09-16 01:14:23 -040066/* mapping type (attributes) for permanent static mappings */
67#define VM_ARM_MTYPE(mt) ((mt) << 20)
68#define VM_ARM_MTYPE_MASK (0x1f << 20)
69
Marek Szyprowskie9da6e92012-07-30 09:11:33 +020070/* consistent regions used by dma_alloc_attrs() */
71#define VM_ARM_DMA_CONSISTENT 0x20000000
72
Joonsoo Kimed8fd212013-02-09 06:28:05 +010073
74struct static_vm {
75 struct vm_struct vm;
76 struct list_head list;
77};
78
79extern struct list_head static_vmlist;
80extern struct static_vm *find_static_vm_vaddr(void *vaddr);
81extern __init void add_static_vm_early(struct static_vm *svm);
82
Russell King3ff15592006-11-30 13:53:54 +000083#endif
84
Russell King022ae532011-07-08 21:26:59 +010085#ifdef CONFIG_ZONE_DMA
Marek Szyprowski4986e5c2012-06-06 12:05:01 +020086extern phys_addr_t arm_dma_limit;
Russell King4dcfa602013-07-09 12:14:49 +010087extern unsigned long arm_dma_pfn_limit;
Russell King022ae532011-07-08 21:26:59 +010088#else
Russell King09b2ad12012-07-05 13:11:31 +010089#define arm_dma_limit ((phys_addr_t)~0)
Russell King4dcfa602013-07-09 12:14:49 +010090#define arm_dma_pfn_limit (~0ul >> PAGE_SHIFT)
Russell King022ae532011-07-08 21:26:59 +010091#endif
92
Marek Szyprowskic7909502011-12-29 13:09:51 +010093extern phys_addr_t arm_lowmem_limit;
94
Russell King8d717a52010-05-22 19:47:18 +010095void __init bootmem_init(void);
Russell King2778f622010-07-09 16:27:52 +010096void arm_mm_memblock_reserve(void);
Marek Szyprowskic7909502011-12-29 13:09:51 +010097void dma_contiguous_remap(void);
Russell Kingb4b20ad2014-04-13 18:57:29 +010098
99unsigned long __clear_cr(unsigned long mask);