ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ppc / tlbflush.h
1 /*
2  * include/asm-ppc/tlbflush.h
3  *
4  *  This program is free software; you can redistribute it and/or
5  *  modify it under the terms of the GNU General Public License
6  *  as published by the Free Software Foundation; either version
7  *  2 of the License, or (at your option) any later version.
8  */
9 #ifdef __KERNEL__
10 #ifndef _PPC_TLBFLUSH_H
11 #define _PPC_TLBFLUSH_H
12
13 #include <linux/config.h>
14 #include <linux/mm.h>
15
16 extern void _tlbie(unsigned long address);
17 extern void _tlbia(void);
18
19 #if defined(CONFIG_4xx)
20
21 #ifndef CONFIG_44x
22 #define __tlbia()       asm volatile ("sync; tlbia; isync" : : : "memory")
23 #else
24 #define __tlbia         _tlbia
25 #endif
26
27 static inline void flush_tlb_mm(struct mm_struct *mm)
28         { __tlbia(); }
29 static inline void flush_tlb_page(struct vm_area_struct *vma,
30                                 unsigned long vmaddr)
31         { _tlbie(vmaddr); }
32 static inline void flush_tlb_range(struct vm_area_struct *vma,
33                                 unsigned long start, unsigned long end)
34         { __tlbia(); }
35 static inline void flush_tlb_kernel_range(unsigned long start,
36                                 unsigned long end)
37         { __tlbia(); }
38
39 #elif defined(CONFIG_8xx)
40 #define __tlbia()       asm volatile ("tlbia; sync" : : : "memory")
41
42 static inline void flush_tlb_mm(struct mm_struct *mm)
43         { __tlbia(); }
44 static inline void flush_tlb_page(struct vm_area_struct *vma,
45                                 unsigned long vmaddr)
46         { _tlbie(vmaddr); }
47 static inline void flush_tlb_range(struct mm_struct *mm,
48                                 unsigned long start, unsigned long end)
49         { __tlbia(); }
50 static inline void flush_tlb_kernel_range(unsigned long start,
51                                 unsigned long end)
52         { __tlbia(); }
53
54 #else   /* 6xx, 7xx, 7xxx cpus */
55 struct mm_struct;
56 struct vm_area_struct;
57 extern void flush_tlb_mm(struct mm_struct *mm);
58 extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
59 extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
60                             unsigned long end);
61 extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
62 #endif
63
64 /*
65  * This is called in munmap when we have freed up some page-table
66  * pages.  We don't need to do anything here, there's nothing special
67  * about our page-table pages.  -- paulus
68  */
69 static inline void flush_tlb_pgtables(struct mm_struct *mm,
70                                       unsigned long start, unsigned long end)
71 {
72 }
73
74 /*
75  * This gets called at the end of handling a page fault, when
76  * the kernel has put a new PTE into the page table for the process.
77  * We use it to ensure coherency between the i-cache and d-cache
78  * for the page which has just been mapped in.
79  * On machines which use an MMU hash table, we use this to put a
80  * corresponding HPTE into the hash table ahead of time, instead of
81  * waiting for the inevitable extra hash-table miss exception.
82  */
83 extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
84
85 #endif /* _PPC_TLBFLUSH_H */
86 #endif /*__KERNEL__ */