tlbflush.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #define smp_flush_tlb_all() flush_tlb_all()
  19. /*
  20. * flush_tlb_mm()
  21. *
  22. * XXX This code is NOT valid for HP-UX compatibility processes,
  23. * (although it will probably work 99% of the time). HP-UX
  24. * processes are free to play with the space id's and save them
  25. * over long periods of time, etc. so we have to preserve the
  26. * space and just flush the entire tlb. We need to check the
  27. * personality in order to do that, but the personality is not
  28. * currently being set correctly.
  29. *
  30. * Of course, Linux processes could do the same thing, but
  31. * we don't support that (and the compilers, dynamic linker,
  32. * etc. do not do that).
  33. */
  34. static inline void flush_tlb_mm(struct mm_struct *mm)
  35. {
  36. BUG_ON(mm == &init_mm); /* Should never happen */
  37. #if 1 || defined(CONFIG_SMP)
  38. flush_tlb_all();
  39. #else
  40. /* FIXME: currently broken, causing space id and protection ids
  41. * to go out of sync, resulting in faults on userspace accesses.
  42. */
  43. if (mm) {
  44. if (mm->context != 0)
  45. free_sid(mm->context);
  46. mm->context = alloc_sid();
  47. if (mm == current->active_mm)
  48. load_context(mm->context);
  49. }
  50. #endif
  51. }
  52. static inline void flush_tlb_page(struct vm_area_struct *vma,
  53. unsigned long addr)
  54. {
  55. unsigned long flags, sid;
  56. /* For one page, it's not worth testing the split_tlb variable */
  57. mb();
  58. sid = vma->vm_mm->context;
  59. purge_tlb_start(flags);
  60. mtsp(sid, 1);
  61. pdtlb(addr);
  62. pitlb(addr);
  63. purge_tlb_end(flags);
  64. }
  65. void __flush_tlb_range(unsigned long sid,
  66. unsigned long start, unsigned long end);
  67. #define flush_tlb_range(vma,start,end) __flush_tlb_range((vma)->vm_mm->context,start,end)
  68. #define flush_tlb_kernel_range(start, end) __flush_tlb_range(0,start,end)
  69. #endif