aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa/mm/init.c')
-rw-r--r--arch/xtensa/mm/init.c62
1 files changed, 1 insertions, 61 deletions
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 6190988bba17..427e14fa43c5 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -24,15 +24,8 @@
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <asm/pgtable.h>
28#include <asm/bootparam.h> 27#include <asm/bootparam.h>
29#include <asm/mmu_context.h>
30#include <asm/tlb.h>
31#include <asm/page.h> 28#include <asm/page.h>
32#include <asm/pgalloc.h>
33
34
35DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
36 29
37/* References to section boundaries */ 30/* References to section boundaries */
38 31
@@ -160,7 +153,7 @@ void __init bootmem_init(void)
160} 153}
161 154
162 155
163void __init paging_init(void) 156void __init zones_init(void)
164{ 157{
165 unsigned long zones_size[MAX_NR_ZONES]; 158 unsigned long zones_size[MAX_NR_ZONES];
166 int i; 159 int i;
@@ -175,43 +168,10 @@ void __init paging_init(void)
175 zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn; 168 zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn;
176#endif 169#endif
177 170
178 /* Initialize the kernel's page tables. */
179
180 memset(swapper_pg_dir, 0, PAGE_SIZE);
181
182 free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL); 171 free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL);
183} 172}
184 173
185/* 174/*
186 * Flush the mmu and reset associated register to default values.
187 */
188
189void __init init_mmu (void)
190{
191 /* Writing zeros to the <t>TLBCFG special registers ensure
192 * that valid values exist in the register. For existing
193 * PGSZID<w> fields, zero selects the first element of the
194 * page-size array. For nonexistent PGSZID<w> fields, zero is
195 * the best value to write. Also, when changing PGSZID<w>
196 * fields, the corresponding TLB must be flushed.
197 */
198 set_itlbcfg_register (0);
199 set_dtlbcfg_register (0);
200 flush_tlb_all ();
201
202 /* Set rasid register to a known value. */
203
204 set_rasid_register (ASID_USER_FIRST);
205
206 /* Set PTEVADDR special register to the start of the page
207 * table, which is in kernel mappable space (ie. not
208 * statically mapped). This register's value is undefined on
209 * reset.
210 */
211 set_ptevaddr_register (PGTABLE_START);
212}
213
214/*
215 * Initialize memory pages. 175 * Initialize memory pages.
216 */ 176 */
217 177
@@ -281,23 +241,3 @@ void free_initmem(void)
281 printk("Freeing unused kernel memory: %dk freed\n", 241 printk("Freeing unused kernel memory: %dk freed\n",
282 (&__init_end - &__init_begin) >> 10); 242 (&__init_end - &__init_begin) >> 10);
283} 243}
284
285struct kmem_cache *pgtable_cache __read_mostly;
286
287static void pgd_ctor(void* addr)
288{
289 pte_t* ptep = (pte_t*)addr;
290 int i;
291
292 for (i = 0; i < 1024; i++, ptep++)
293 pte_clear(NULL, 0, ptep);
294
295}
296
297void __init pgtable_cache_init(void)
298{
299 pgtable_cache = kmem_cache_create("pgd",
300 PAGE_SIZE, PAGE_SIZE,
301 SLAB_HWCACHE_ALIGN,
302 pgd_ctor);
303}