/*1* xtensa mmu stuff2*3* Extracted from init.c4*/5#include <linux/percpu.h>6#include <linux/init.h>7#include <linux/string.h>8#include <linux/slab.h>9#include <linux/cache.h>1011#include <asm/tlb.h>12#include <asm/tlbflush.h>13#include <asm/mmu_context.h>14#include <asm/page.h>1516void __init paging_init(void)17{18memset(swapper_pg_dir, 0, PAGE_SIZE);19}2021/*22* Flush the mmu and reset associated register to default values.23*/24void __init init_mmu(void)25{26/* Writing zeros to the <t>TLBCFG special registers ensure27* that valid values exist in the register. For existing28* PGSZID<w> fields, zero selects the first element of the29* page-size array. For nonexistent PGSZID<w> fields, zero is30* the best value to write. Also, when changing PGSZID<w>31* fields, the corresponding TLB must be flushed.32*/33set_itlbcfg_register(0);34set_dtlbcfg_register(0);35flush_tlb_all();3637/* Set rasid register to a known value. */3839set_rasid_register(ASID_USER_FIRST);4041/* Set PTEVADDR special register to the start of the page42* table, which is in kernel mappable space (ie. not43* statically mapped). This register's value is undefined on44* reset.45*/46set_ptevaddr_register(PGTABLE_START);47}4849struct kmem_cache *pgtable_cache __read_mostly;5051static void pgd_ctor(void *addr)52{53pte_t *ptep = (pte_t *)addr;54int i;5556for (i = 0; i < 1024; i++, ptep++)57pte_clear(NULL, 0, ptep);5859}6061void __init pgtable_cache_init(void)62{63pgtable_cache = kmem_cache_create("pgd",64PAGE_SIZE, PAGE_SIZE,65SLAB_HWCACHE_ALIGN,66pgd_ctor);67}686970