.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/arch/arm/mm/nommu.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
24 | 25 | #include "mm.h" |
---|
25 | 26 | |
---|
26 | 27 | unsigned long vectors_base; |
---|
| 28 | + |
---|
| 29 | +/* |
---|
| 30 | + * empty_zero_page is a special page that is used for |
---|
| 31 | + * zero-initialized data and COW. |
---|
| 32 | + */ |
---|
| 33 | +struct page *empty_zero_page; |
---|
| 34 | +EXPORT_SYMBOL(empty_zero_page); |
---|
27 | 35 | |
---|
28 | 36 | #ifdef CONFIG_ARM_MPU |
---|
29 | 37 | struct mpu_rgn_info mpu_rgn_info; |
---|
.. | .. |
---|
147 | 155 | */ |
---|
148 | 156 | void __init paging_init(const struct machine_desc *mdesc) |
---|
149 | 157 | { |
---|
| 158 | + void *zero_page; |
---|
| 159 | + |
---|
150 | 160 | early_trap_init((void *)vectors_base); |
---|
151 | 161 | mpu_setup(); |
---|
| 162 | + |
---|
| 163 | + /* allocate the zero page. */ |
---|
| 164 | + zero_page = (void *)memblock_alloc(PAGE_SIZE, PAGE_SIZE); |
---|
| 165 | + if (!zero_page) |
---|
| 166 | + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", |
---|
| 167 | + __func__, PAGE_SIZE, PAGE_SIZE); |
---|
| 168 | + |
---|
152 | 169 | bootmem_init(); |
---|
| 170 | + |
---|
| 171 | + empty_zero_page = virt_to_page(zero_page); |
---|
| 172 | + flush_dcache_page(empty_zero_page); |
---|
153 | 173 | } |
---|
154 | 174 | |
---|
155 | 175 | /* |
---|
.. | .. |
---|
205 | 225 | EXPORT_SYMBOL(ioremap); |
---|
206 | 226 | |
---|
207 | 227 | void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size) |
---|
208 | | - __alias(ioremap_cached); |
---|
209 | | - |
---|
210 | | -void __iomem *ioremap_cached(resource_size_t res_cookie, size_t size) |
---|
211 | 228 | { |
---|
212 | 229 | return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED, |
---|
213 | 230 | __builtin_return_address(0)); |
---|
214 | 231 | } |
---|
215 | 232 | EXPORT_SYMBOL(ioremap_cache); |
---|
216 | | -EXPORT_SYMBOL(ioremap_cached); |
---|
217 | 233 | |
---|
218 | 234 | void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size) |
---|
219 | 235 | { |
---|