tlb.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_TLB_H
  3. #define __ASM_TLB_H
  4. #include <asm/cpu-features.h>
  5. #include <asm/mipsregs.h>
  6. /*
  7. * MIPS doesn't need any special per-pte or per-vma handling, except
  8. * we need to flush cache for area to be unmapped.
  9. */
  10. #define tlb_start_vma(tlb, vma) \
  11. do { \
  12. if (!tlb->fullmm) \
  13. flush_cache_range(vma, vma->vm_start, vma->vm_end); \
  14. } while (0)
  15. #define tlb_end_vma(tlb, vma) do { } while (0)
  16. #define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
  17. /*
  18. * .. because we flush the whole mm when it fills up.
  19. */
  20. #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
  21. #define _UNIQUE_ENTRYHI(base, idx) \
  22. (((base) + ((idx) << (PAGE_SHIFT + 1))) | \
  23. (cpu_has_tlbinv ? MIPS_ENTRYHI_EHINV : 0))
  24. #define UNIQUE_ENTRYHI(idx) _UNIQUE_ENTRYHI(CKSEG0, idx)
  25. #define UNIQUE_GUEST_ENTRYHI(idx) _UNIQUE_ENTRYHI(CKSEG1, idx)
  26. static inline unsigned int num_wired_entries(void)
  27. {
  28. unsigned int wired = read_c0_wired();
  29. if (cpu_has_mips_r6)
  30. wired &= MIPSR6_WIRED_WIRED;
  31. return wired;
  32. }
  33. #include <asm-generic/tlb.h>
  34. #endif /* __ASM_TLB_H */