1 #ifndef _I386_TLBFLUSH_H
2 #define _I386_TLBFLUSH_H
5 #include <asm/processor.h>
8 #include <asm/paravirt.h>
10 #define __flush_tlb() __native_flush_tlb()
11 #define __flush_tlb_global() __native_flush_tlb_global()
12 #define __flush_tlb_single(addr) __native_flush_tlb_single(addr)
15 #define __native_flush_tlb() xen_tlb_flush()
16 #define __native_flush_tlb_global() xen_tlb_flush()
17 #define __native_flush_tlb_single(addr) xen_invlpg(addr)
18 #define __flush_tlb_all() xen_tlb_flush()
20 #define cpu_has_invlpg (boot_cpu_data.x86 > 3)
22 #define __flush_tlb_one(addr) __flush_tlb_single(addr)
27 * - flush_tlb() flushes the current mm struct TLBs
28 * - flush_tlb_all() flushes all processes TLBs
29 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
30 * - flush_tlb_page(vma, vmaddr) flushes one page
31 * - flush_tlb_range(vma, start, end) flushes a range of pages
32 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
33 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
35 * ..but the i386 has somewhat limited tlb flushing capabilities,
36 * and page-granular flushes are available only on i486 and up.
41 #define flush_tlb() __flush_tlb()
42 #define flush_tlb_all() __flush_tlb_all()
43 #define local_flush_tlb() __flush_tlb()
45 static inline void flush_tlb_mm(struct mm_struct *mm)
47 if (mm == current->active_mm)
51 static inline void flush_tlb_page(struct vm_area_struct *vma,
54 if (vma->vm_mm == current->active_mm)
55 __flush_tlb_one(addr);
58 static inline void flush_tlb_range(struct vm_area_struct *vma,
59 unsigned long start, unsigned long end)
61 if (vma->vm_mm == current->active_mm)
69 #define local_flush_tlb() \
72 extern void flush_tlb_all(void);
73 extern void flush_tlb_current_task(void);
74 extern void flush_tlb_mm(struct mm_struct *);
75 extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
77 #define flush_tlb() flush_tlb_current_task()
79 static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long start, unsigned long end)
81 flush_tlb_mm(vma->vm_mm);
85 #define TLBSTATE_LAZY 2
89 struct mm_struct *active_mm;
91 char __cacheline_padding[L1_CACHE_BYTES-8];
93 DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
98 #define flush_tlb_kernel_range(start, end) flush_tlb_all()
100 static inline void flush_tlb_pgtables(struct mm_struct *mm,
101 unsigned long start, unsigned long end)
103 /* i386 does not keep any page table caches in TLB */
106 #endif /* _I386_TLBFLUSH_H */