tlb.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef __ASMARM_TLB_H
  2. #define __ASMARM_TLB_H
  3. #include <asm/pgalloc.h>
  4. #include <asm/tlbflush.h>
  5. /*
  6. * TLB handling. This allows us to remove pages from the page
  7. * tables, and efficiently handle the TLB issues.
  8. */
  9. struct mmu_gather {
  10. struct mm_struct *mm;
  11. unsigned int need_flush;
  12. unsigned int fullmm;
  13. };
  14. DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
  15. static inline struct mmu_gather *
  16. tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
  17. {
  18. struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
  19. tlb->mm = mm;
  20. tlb->need_flush = 0;
  21. tlb->fullmm = full_mm_flush;
  22. return tlb;
  23. }
  24. static inline void
  25. tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
  26. {
  27. if (tlb->need_flush)
  28. flush_tlb_mm(tlb->mm);
  29. /* keep the page table cache within bounds */
  30. check_pgt_cache();
  31. put_cpu_var(mmu_gathers);
  32. }
  33. #define tlb_remove_tlb_entry(tlb,ptep,address) do { } while (0)
  34. //#define tlb_start_vma(tlb,vma) do { } while (0)
  35. //FIXME - ARM32 uses this now that things changed in the kernel. seems like it may be pointless on arm26, however to get things compiling...
  36. #define tlb_start_vma(tlb,vma) \
  37. do { \
  38. if (!tlb->fullmm) \
  39. flush_cache_range(vma, vma->vm_start, vma->vm_end); \
  40. } while (0)
  41. #define tlb_end_vma(tlb,vma) do { } while (0)
  42. static inline void
  43. tlb_remove_page(struct mmu_gather *tlb, struct page *page)
  44. {
  45. tlb->need_flush = 1;
  46. free_page_and_swap_cache(page);
  47. }
  48. #define pte_free_tlb(tlb,ptep) pte_free(ptep)
  49. #define pmd_free_tlb(tlb,pmdp) pmd_free(pmdp)
  50. #endif