More cleaning ...
[linux-2.6/linux-mips.git] / include / asm-parisc / tlbflush.h
blobea8cf008dad9f26628ef14b37f382c65f8310ab3
1 #ifndef _PARISC_TLBFLUSH_H
2 #define _PARISC_TLBFLUSH_H
4 /* TLB flushing routines.... */
6 #include <linux/mm.h>
7 #include <asm/mmu_context.h>
9 extern void flush_tlb_all(void);
12 * flush_tlb_mm()
14 * XXX This code is NOT valid for HP-UX compatibility processes,
15 * (although it will probably work 99% of the time). HP-UX
16 * processes are free to play with the space id's and save them
17 * over long periods of time, etc. so we have to preserve the
18 * space and just flush the entire tlb. We need to check the
19 * personality in order to do that, but the personality is not
20 * currently being set correctly.
22 * Of course, Linux processes could do the same thing, but
23 * we don't support that (and the compilers, dynamic linker,
24 * etc. do not do that).
27 static inline void flush_tlb_mm(struct mm_struct *mm)
29 if (mm == &init_mm) BUG(); /* Should never happen */
31 #ifdef CONFIG_SMP
32 flush_tlb_all();
33 #else
34 if (mm) {
35 if (mm->context != 0)
36 free_sid(mm->context);
37 mm->context = alloc_sid();
38 if (mm == current->active_mm)
39 load_context(mm->context);
41 #endif
44 extern __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end)
48 static inline void flush_tlb_page(struct vm_area_struct *vma,
49 unsigned long addr)
51 /* For one page, it's not worth testing the split_tlb variable */
53 mtsp(vma->vm_mm->context,1);
54 pdtlb(addr);
55 pitlb(addr);
58 static inline void flush_tlb_range(struct vm_area_struct *vma,
59 unsigned long start, unsigned long end)
61 unsigned long npages;
63 npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
64 if (npages >= 512) /* XXX arbitrary, should be tuned */
65 flush_tlb_all();
66 else {
68 mtsp(vma->vm_mm->context,1);
69 if (split_tlb) {
70 while (npages--) {
71 pdtlb(start);
72 pitlb(start);
73 start += PAGE_SIZE;
75 } else {
76 while (npages--) {
77 pdtlb(start);
78 start += PAGE_SIZE;
84 #define flush_tlb_kernel_range(start, end) flush_tlb_all()
86 #endif