initial commit with v2.6.9
[linux-2.6.9-moxart.git] / include / asm-parisc / tlbflush.h
blob86ba2c7ec6f3e59f5b615d0c2b4bd6f4917676d3
1 #ifndef _PARISC_TLBFLUSH_H
2 #define _PARISC_TLBFLUSH_H
4 /* TLB flushing routines.... */
6 #include <linux/config.h>
7 #include <linux/mm.h>
8 #include <asm/mmu_context.h>
10 extern void flush_tlb_all(void);
13 * flush_tlb_mm()
15 * XXX This code is NOT valid for HP-UX compatibility processes,
16 * (although it will probably work 99% of the time). HP-UX
17 * processes are free to play with the space id's and save them
18 * over long periods of time, etc. so we have to preserve the
19 * space and just flush the entire tlb. We need to check the
20 * personality in order to do that, but the personality is not
21 * currently being set correctly.
23 * Of course, Linux processes could do the same thing, but
24 * we don't support that (and the compilers, dynamic linker,
25 * etc. do not do that).
28 static inline void flush_tlb_mm(struct mm_struct *mm)
30 BUG_ON(mm == &init_mm); /* Should never happen */
32 #ifdef CONFIG_SMP
33 flush_tlb_all();
34 #else
35 if (mm) {
36 if (mm->context != 0)
37 free_sid(mm->context);
38 mm->context = alloc_sid();
39 if (mm == current->active_mm)
40 load_context(mm->context);
42 #endif
45 extern __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end)
49 static inline void flush_tlb_page(struct vm_area_struct *vma,
50 unsigned long addr)
52 /* For one page, it's not worth testing the split_tlb variable */
54 mtsp(vma->vm_mm->context,1);
55 pdtlb(addr);
56 pitlb(addr);
59 static inline void flush_tlb_range(struct vm_area_struct *vma,
60 unsigned long start, unsigned long end)
62 unsigned long npages;
64 npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
65 if (npages >= 512) /* XXX arbitrary, should be tuned */
66 flush_tlb_all();
67 else {
69 mtsp(vma->vm_mm->context,1);
70 if (split_tlb) {
71 while (npages--) {
72 pdtlb(start);
73 pitlb(start);
74 start += PAGE_SIZE;
76 } else {
77 while (npages--) {
78 pdtlb(start);
79 start += PAGE_SIZE;
85 #define flush_tlb_kernel_range(start, end) flush_tlb_all()
87 #endif