hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/arch/arm/mm/nommu.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/mm/nommu.c
34 *
....@@ -24,6 +25,13 @@
2425 #include "mm.h"
2526
2627 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);
2735
2836 #ifdef CONFIG_ARM_MPU
2937 struct mpu_rgn_info mpu_rgn_info;
....@@ -147,9 +155,21 @@
147155 */
148156 void __init paging_init(const struct machine_desc *mdesc)
149157 {
158
+ void *zero_page;
159
+
150160 early_trap_init((void *)vectors_base);
151161 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
+
152169 bootmem_init();
170
+
171
+ empty_zero_page = virt_to_page(zero_page);
172
+ flush_dcache_page(empty_zero_page);
153173 }
154174
155175 /*
....@@ -205,15 +225,11 @@
205225 EXPORT_SYMBOL(ioremap);
206226
207227 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)
211228 {
212229 return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED,
213230 __builtin_return_address(0));
214231 }
215232 EXPORT_SYMBOL(ioremap_cache);
216
-EXPORT_SYMBOL(ioremap_cached);
217233
218234 void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size)
219235 {