RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / include / asm-ia64 / tlbflush.h
blobe37f9fbf33af8babd7406b648219a1dca48bc152
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.
22 * Flush everything (kernel mapping may also have changed due to
23 * vmalloc/vfree).
25 extern void local_flush_tlb_all (void);
27 #ifdef CONFIG_SMP
28 extern void smp_flush_tlb_all (void);
29 extern void smp_flush_tlb_mm (struct mm_struct *mm);
30 extern void smp_flush_tlb_cpumask (cpumask_t xcpumask);
31 # define flush_tlb_all() smp_flush_tlb_all()
32 #else
33 # define flush_tlb_all() local_flush_tlb_all()
34 # define smp_flush_tlb_cpumask(m) local_flush_tlb_all()
35 #endif
37 static inline void
38 local_finish_flush_tlb_mm (struct mm_struct *mm)
40 if (mm == current->active_mm)
41 activate_context(mm);
45 * Flush a specified user mapping. This is called, e.g., as a result of fork() and
46 * exit(). fork() ends up here because the copy-on-write mechanism needs to write-protect
47 * the PTEs of the parent task.
49 static inline void
50 flush_tlb_mm (struct mm_struct *mm)
52 if (!mm)
53 return;
55 set_bit(mm->context, ia64_ctx.flushmap);
56 mm->context = 0;
58 if (atomic_read(&mm->mm_users) == 0)
59 return; /* happens as a result of exit_mmap() */
61 #ifdef CONFIG_SMP
62 smp_flush_tlb_mm(mm);
63 #else
64 local_finish_flush_tlb_mm(mm);
65 #endif
68 extern void flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end);
71 * Page-granular tlb flush.
73 static inline void
74 flush_tlb_page (struct vm_area_struct *vma, unsigned long addr)
76 #ifdef CONFIG_SMP
77 flush_tlb_range(vma, (addr & PAGE_MASK), (addr & PAGE_MASK) + PAGE_SIZE);
78 #else
79 if (vma->vm_mm == current->active_mm)
80 ia64_ptcl(addr, (PAGE_SHIFT << 2));
81 else
82 vma->vm_mm->context = 0;
83 #endif
87 * Flush the TLB entries mapping the virtually mapped linear page
88 * table corresponding to address range [START-END).
90 static inline void
91 flush_tlb_pgtables (struct mm_struct *mm, unsigned long start, unsigned long end)
94 * Deprecated. The virtual page table is now flushed via the normal gather/flush
95 * interface (see tlb.h).
100 * Flush the local TLB. Invoked from another cpu using an IPI.
102 #ifdef CONFIG_SMP
103 void smp_local_flush_tlb(void);
104 #else
105 #define smp_local_flush_tlb()
106 #endif
108 #define flush_tlb_kernel_range(start, end) flush_tlb_all() /* XXX fix me */
110 #endif /* _ASM_IA64_TLBFLUSH_H */