MAINTAINERS: add util-linux-ng package
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / asm-ia64 / tlbflush.h
blob3be25dfed16466c8e541a298c9e7d26feac202f1
1 #ifndef _ASM_IA64_TLBFLUSH_H
2 #define _ASM_IA64_TLBFLUSH_H
4 /*
5 * Copyright (C) 2002 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
10 #include <linux/mm.h>
12 #include <asm/intrinsics.h>
13 #include <asm/mmu_context.h>
14 #include <asm/page.h>
17 * Now for some TLB flushing routines. This is the kind of stuff that
18 * can be very expensive, so try to avoid them whenever possible.
20 extern void setup_ptcg_sem(int max_purges, int from_palo);
23 * Flush everything (kernel mapping may also have changed due to
24 * vmalloc/vfree).
26 extern void local_flush_tlb_all (void);
28 #ifdef CONFIG_SMP
29 extern void smp_flush_tlb_all (void);
30 extern void smp_flush_tlb_mm (struct mm_struct *mm);
31 extern void smp_flush_tlb_cpumask (cpumask_t xcpumask);
32 # define flush_tlb_all() smp_flush_tlb_all()
33 #else
34 # define flush_tlb_all() local_flush_tlb_all()
35 # define smp_flush_tlb_cpumask(m) local_flush_tlb_all()
36 #endif
38 static inline void
39 local_finish_flush_tlb_mm (struct mm_struct *mm)
41 if (mm == current->active_mm)
42 activate_context(mm);
46 * Flush a specified user mapping. This is called, e.g., as a result of fork() and
47 * exit(). fork() ends up here because the copy-on-write mechanism needs to write-protect
48 * the PTEs of the parent task.
50 static inline void
51 flush_tlb_mm (struct mm_struct *mm)
53 if (!mm)
54 return;
56 set_bit(mm->context, ia64_ctx.flushmap);
57 mm->context = 0;
59 if (atomic_read(&mm->mm_users) == 0)
60 return; /* happens as a result of exit_mmap() */
62 #ifdef CONFIG_SMP
63 smp_flush_tlb_mm(mm);
64 #else
65 local_finish_flush_tlb_mm(mm);
66 #endif
69 extern void flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end);
72 * Page-granular tlb flush.
74 static inline void
75 flush_tlb_page (struct vm_area_struct *vma, unsigned long addr)
77 #ifdef CONFIG_SMP
78 flush_tlb_range(vma, (addr & PAGE_MASK), (addr & PAGE_MASK) + PAGE_SIZE);
79 #else
80 if (vma->vm_mm == current->active_mm)
81 ia64_ptcl(addr, (PAGE_SHIFT << 2));
82 else
83 vma->vm_mm->context = 0;
84 #endif
88 * Flush the local TLB. Invoked from another cpu using an IPI.
90 #ifdef CONFIG_SMP
91 void smp_local_flush_tlb(void);
92 #else
93 #define smp_local_flush_tlb()
94 #endif
96 static inline void flush_tlb_kernel_range(unsigned long start,
97 unsigned long end)
99 flush_tlb_all(); /* XXX fix me */
102 #endif /* _ASM_IA64_TLBFLUSH_H */