···4444 * the value desired).4545 */46464747+#ifndef MAX_DMA_ADDRESS4748#define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KIO_SIZE - 1)4848-4949+#endif49505051/* Reserve and release a DMA channel */5152extern int request_dma(unsigned int dmanr, const char * device_id);
+8-1
arch/xtensa/include/asm/io.h
···69697070static inline void *ioremap(unsigned long offset, unsigned long size)7171{7272+#ifdef CONFIG_MMU7273 if (offset >= XCHAL_KIO_PADDR7374 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)7475 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);7575-7676 else7777 BUG();7878+#else7979+ return (void *)offset;8080+#endif7881}79828083static inline void *ioremap_nocache(unsigned long offset, unsigned long size)8184{8585+#ifdef CONFIG_MMU8286 if (offset >= XCHAL_KIO_PADDR8387 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)8488 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);8589 else8690 BUG();9191+#else9292+ return (void *)offset;9393+#endif8794}88958996static inline void iounmap(void *addr)
···309309 * All other exceptions are unexpected and thus unrecoverable!310310 */311311312312+#ifdef CONFIG_MMU312313 .extern fast_second_level_miss_double_kernel313314314315.Lksp: /* a0: a0, a1: a1, a2: a2, a3: trashed, depc: depc, excsave: a3 */···320319 bnez a3, .Lunrecoverable3213201: movi a3, fast_second_level_miss_double_kernel322321 jx a3322322+#else323323+.equ .Lksp, .Lunrecoverable324324+#endif323325324326 /* Critical! We can't handle this situation. PANIC! */325327
+2-1
arch/xtensa/mm/Makefile
···22# Makefile for the Linux/Xtensa-specific parts of the memory manager.33#4455-obj-y := init.o fault.o tlb.o misc.o cache.o55+obj-y := init.o cache.o misc.o66+obj-$(CONFIG_MMU) += fault.o mmu.o tlb.o
+1-61
arch/xtensa/mm/init.c
···2424#include <linux/mm.h>2525#include <linux/slab.h>26262727-#include <asm/pgtable.h>2827#include <asm/bootparam.h>2929-#include <asm/mmu_context.h>3030-#include <asm/tlb.h>3128#include <asm/page.h>3232-#include <asm/pgalloc.h>3333-3434-3535-DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);36293730/* References to section boundaries */3831···153160}154161155162156156-void __init paging_init(void)163163+void __init zones_init(void)157164{158165 unsigned long zones_size[MAX_NR_ZONES];159166 int i;···168175 zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn;169176#endif170177171171- /* Initialize the kernel's page tables. */172172-173173- memset(swapper_pg_dir, 0, PAGE_SIZE);174174-175178 free_area_init_node(0, zones_size, ARCH_PFN_OFFSET, NULL);176176-}177177-178178-/*179179- * Flush the mmu and reset associated register to default values.180180- */181181-182182-void __init init_mmu (void)183183-{184184- /* Writing zeros to the <t>TLBCFG special registers ensure185185- * that valid values exist in the register. For existing186186- * PGSZID<w> fields, zero selects the first element of the187187- * page-size array. For nonexistent PGSZID<w> fields, zero is188188- * the best value to write. Also, when changing PGSZID<w>189189- * fields, the corresponding TLB must be flushed.190190- */191191- set_itlbcfg_register (0);192192- set_dtlbcfg_register (0);193193- flush_tlb_all ();194194-195195- /* Set rasid register to a known value. */196196-197197- set_rasid_register (ASID_USER_FIRST);198198-199199- /* Set PTEVADDR special register to the start of the page200200- * table, which is in kernel mappable space (ie. not201201- * statically mapped). This register's value is undefined on202202- * reset.203203- */204204- set_ptevaddr_register (PGTABLE_START);205179}206180207181/*···240280 free_reserved_mem(&__init_begin, &__init_end);241281 printk("Freeing unused kernel memory: %dk freed\n",242282 (&__init_end - &__init_begin) >> 10);243243-}244244-245245-struct kmem_cache *pgtable_cache __read_mostly;246246-247247-static void pgd_ctor(void* addr)248248-{249249- pte_t* ptep = (pte_t*)addr;250250- int i;251251-252252- for (i = 0; i < 1024; i++, ptep++)253253- pte_clear(NULL, 0, ptep);254254-255255-}256256-257257-void __init pgtable_cache_init(void)258258-{259259- pgtable_cache = kmem_cache_create("pgd",260260- PAGE_SIZE, PAGE_SIZE,261261- SLAB_HWCACHE_ALIGN,262262- pgd_ctor);263283}
+2
arch/xtensa/mm/misc.S
···84848585 retw86868787+#ifdef CONFIG_MMU8788/*8889 * If we have to deal with cache aliasing, we use temporary memory mappings8990 * to ensure that the source and destination pages have the same color as···312311/* End of special treatment in tlb miss exception */313312314313ENTRY(__tlbtemp_mapping_end)314314+#endif /* CONFIG_MMU315315316316/*317317 * void __invalidate_icache_page(ulong start)
+70
arch/xtensa/mm/mmu.c
···11+/*22+ * xtensa mmu stuff33+ *44+ * Extracted from init.c55+ */66+#include <linux/percpu.h>77+#include <linux/init.h>88+#include <linux/string.h>99+#include <linux/slab.h>1010+#include <linux/cache.h>1111+1212+#include <asm/tlb.h>1313+#include <asm/tlbflush.h>1414+#include <asm/mmu_context.h>1515+#include <asm/page.h>1616+1717+DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);1818+1919+void __init paging_init(void)2020+{2121+ memset(swapper_pg_dir, 0, PAGE_SIZE);2222+}2323+2424+/*2525+ * Flush the mmu and reset associated register to default values.2626+ */2727+void __init init_mmu(void)2828+{2929+ /* Writing zeros to the <t>TLBCFG special registers ensure3030+ * that valid values exist in the register. For existing3131+ * PGSZID<w> fields, zero selects the first element of the3232+ * page-size array. For nonexistent PGSZID<w> fields, zero is3333+ * the best value to write. Also, when changing PGSZID<w>3434+ * fields, the corresponding TLB must be flushed.3535+ */3636+ set_itlbcfg_register(0);3737+ set_dtlbcfg_register(0);3838+ flush_tlb_all();3939+4040+ /* Set rasid register to a known value. */4141+4242+ set_rasid_register(ASID_USER_FIRST);4343+4444+ /* Set PTEVADDR special register to the start of the page4545+ * table, which is in kernel mappable space (ie. not4646+ * statically mapped). This register's value is undefined on4747+ * reset.4848+ */4949+ set_ptevaddr_register(PGTABLE_START);5050+}5151+5252+struct kmem_cache *pgtable_cache __read_mostly;5353+5454+static void pgd_ctor(void *addr)5555+{5656+ pte_t *ptep = (pte_t *)addr;5757+ int i;5858+5959+ for (i = 0; i < 1024; i++, ptep++)6060+ pte_clear(NULL, 0, ptep);6161+6262+}6363+6464+void __init pgtable_cache_init(void)6565+{6666+ pgtable_cache = kmem_cache_create("pgd",6767+ PAGE_SIZE, PAGE_SIZE,6868+ SLAB_HWCACHE_ALIGN,6969+ pgd_ctor);7070+}