tlbflush.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef _PARISC_TLBFLUSH_H
  2. #define _PARISC_TLBFLUSH_H
  3. /* TLB flushing routines.... */
  4. #include <linux/mm.h>
  5. #include <linux/sched.h>
  6. #include <asm/mmu_context.h>
  7. /* This is for the serialisation of PxTLB broadcasts. At least on the
  8. * N class systems, only one PxTLB inter processor broadcast can be
  9. * active at any one time on the Merced bus. This tlb purge
  10. * synchronisation is fairly lightweight and harmless so we activate
  11. * it on all systems not just the N class.
  12. */
  13. extern spinlock_t pa_tlb_lock;
  14. #define purge_tlb_start(flags) spin_lock_irqsave(&pa_tlb_lock, flags)
  15. #define purge_tlb_end(flags) spin_unlock_irqrestore(&pa_tlb_lock, flags)
  16. extern void flush_tlb_all(void);
  17. extern void flush_tlb_all_local(void *);
  18. /*
  19. * flush_tlb_mm()
  20. *
  21. * XXX This code is NOT valid for HP-UX compatibility processes,
  22. * (although it will probably work 99% of the time). HP-UX
  23. * processes are free to play with the space id's and save them
  24. * over long periods of time, etc. so we have to preserve the
  25. * space and just flush the entire tlb. We need to check the
  26. * personality in order to do that, but the personality is not
  27. * currently being set correctly.
  28. *
  29. * Of course, Linux processes could do the same thing, but
  30. * we don't support that (and the compilers, dynamic linker,
  31. * etc. do not do that).
  32. */
  33. static inline void flush_tlb_mm(struct mm_struct *mm)
  34. {
  35. BUG_ON(mm == &init_mm); /* Should never happen */
  36. #if 1 || defined(CONFIG_SMP)
  37. flush_tlb_all();
  38. #else
  39. /* FIXME: currently broken, causing space id and protection ids
  40. * to go out of sync, resulting in faults on userspace accesses.
  41. */
  42. if (mm) {
  43. if (mm->context != 0)
  44. free_sid(mm->context);
  45. mm->context = alloc_sid();
  46. if (mm == current->active_mm)
  47. load_context(mm->context);
  48. }
  49. #endif
  50. }
  51. static inline void flush_tlb_page(struct vm_area_struct *vma,
  52. unsigned long addr)
  53. {
  54. unsigned long flags;
  55. /* For one page, it's not worth testing the split_tlb variable */
  56. mb();
  57. mtsp(vma->vm_mm->context,1);
  58. purge_tlb_start(flags);
  59. pdtlb(addr);
  60. pitlb(addr);
  61. purge_tlb_end(flags);
  62. }
  63. void __flush_tlb_range(unsigned long sid,
  64. unsigned long start, unsigned long end);
  65. #define flush_tlb_range(vma,start,end) __flush_tlb_range((vma)->vm_mm->context,start,end)
  66. #define flush_tlb_kernel_range(start, end) __flush_tlb_range(0,start,end)
  67. #endif