mmu_context.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * MM context support for the Hexagon architecture
  4. *
  5. * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
  6. */
  7. #ifndef _ASM_MMU_CONTEXT_H
  8. #define _ASM_MMU_CONTEXT_H
  9. #include <linux/mm_types.h>
  10. #include <asm/setup.h>
  11. #include <asm/page.h>
  12. #include <asm/pgalloc.h>
  13. #include <asm/mem-layout.h>
  14. /*
  15. * VM port hides all TLB management, so "lazy TLB" isn't very
  16. * meaningful. Even for ports to architectures with visble TLBs,
  17. * this is almost invariably a null function.
  18. *
  19. * mm->context is set up by pgd_alloc, so no init_new_context required.
  20. */
  21. /*
  22. * Switch active mm context
  23. */
  24. static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  25. struct task_struct *tsk)
  26. {
  27. int l1;
  28. /*
  29. * For virtual machine, we have to update system map if it's been
  30. * touched.
  31. */
  32. if (next->context.generation < prev->context.generation) {
  33. for (l1 = MIN_KERNEL_SEG; l1 <= max_kernel_seg; l1++)
  34. next->pgd[l1] = init_mm.pgd[l1];
  35. next->context.generation = prev->context.generation;
  36. }
  37. __vmnewmap((void *)next->context.ptbase);
  38. }
  39. /*
  40. * Activate new memory map for task
  41. */
  42. #define activate_mm activate_mm
  43. static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
  44. {
  45. unsigned long flags;
  46. local_irq_save(flags);
  47. switch_mm(prev, next, current_thread_info()->task);
  48. local_irq_restore(flags);
  49. }
  50. /* Generic hooks for arch_dup_mmap and arch_exit_mmap */
  51. #include <asm-generic/mm_hooks.h>
  52. #include <asm-generic/mmu_context.h>
  53. #endif