mmu.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * xtensa mmu stuff
  3. *
  4. * Extracted from init.c
  5. */
  6. #include <linux/percpu.h>
  7. #include <linux/init.h>
  8. #include <linux/string.h>
  9. #include <linux/slab.h>
  10. #include <linux/cache.h>
  11. #include <asm/tlb.h>
  12. #include <asm/tlbflush.h>
  13. #include <asm/mmu_context.h>
  14. #include <asm/page.h>
  15. void __init paging_init(void)
  16. {
  17. memset(swapper_pg_dir, 0, PAGE_SIZE);
  18. }
  19. /*
  20. * Flush the mmu and reset associated register to default values.
  21. */
  22. void __init init_mmu(void)
  23. {
  24. #if !(XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY)
  25. /*
  26. * Writing zeros to the instruction and data TLBCFG special
  27. * registers ensure that valid values exist in the register.
  28. *
  29. * For existing PGSZID<w> fields, zero selects the first element
  30. * of the page-size array. For nonexistent PGSZID<w> fields,
  31. * zero is the best value to write. Also, when changing PGSZID<w>
  32. * fields, the corresponding TLB must be flushed.
  33. */
  34. set_itlbcfg_register(0);
  35. set_dtlbcfg_register(0);
  36. #endif
  37. flush_tlb_all();
  38. /* Set rasid register to a known value. */
  39. set_rasid_register(ASID_INSERT(ASID_USER_FIRST));
  40. /* Set PTEVADDR special register to the start of the page
  41. * table, which is in kernel mappable space (ie. not
  42. * statically mapped). This register's value is undefined on
  43. * reset.
  44. */
  45. set_ptevaddr_register(PGTABLE_START);
  46. }