diff options
-rw-r--r-- | include/asm-powerpc/tlb.h (renamed from include/asm-ppc/tlb.h) | 59 | ||||
-rw-r--r-- | include/asm-powerpc/tlbflush.h | 146 | ||||
-rw-r--r-- | include/asm-ppc/tlbflush.h | 115 | ||||
-rw-r--r-- | include/asm-ppc64/tlb.h | 39 | ||||
-rw-r--r-- | include/asm-ppc64/tlbflush.h | 52 |
5 files changed, 182 insertions, 229 deletions
diff --git a/include/asm-ppc/tlb.h b/include/asm-powerpc/tlb.h index 2c142c5d8584..56659f121779 100644 --- a/include/asm-ppc/tlb.h +++ b/include/asm-powerpc/tlb.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * TLB shootdown specifics for PPC | 2 | * TLB shootdown specifics for powerpc |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Anton Blanchard, IBM Corp. | ||
4 | * Copyright (C) 2002 Paul Mackerras, IBM Corp. | 5 | * Copyright (C) 2002 Paul Mackerras, IBM Corp. |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
@@ -8,29 +9,53 @@ | |||
8 | * as published by the Free Software Foundation; either version | 9 | * as published by the Free Software Foundation; either version |
9 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
10 | */ | 11 | */ |
11 | #ifndef _PPC_TLB_H | 12 | #ifndef _ASM_POWERPC_TLB_H |
12 | #define _PPC_TLB_H | 13 | #define _ASM_POWERPC_TLB_H |
13 | 14 | ||
14 | #include <linux/config.h> | 15 | #include <linux/config.h> |
16 | #ifndef __powerpc64__ | ||
15 | #include <asm/pgtable.h> | 17 | #include <asm/pgtable.h> |
18 | #endif | ||
16 | #include <asm/pgalloc.h> | 19 | #include <asm/pgalloc.h> |
17 | #include <asm/tlbflush.h> | 20 | #include <asm/tlbflush.h> |
21 | #ifndef __powerpc64__ | ||
18 | #include <asm/page.h> | 22 | #include <asm/page.h> |
19 | #include <asm/mmu.h> | 23 | #include <asm/mmu.h> |
20 | 24 | #endif | |
21 | #ifdef CONFIG_PPC_STD_MMU | ||
22 | /* Classic PPC with hash-table based MMU... */ | ||
23 | 25 | ||
24 | struct mmu_gather; | 26 | struct mmu_gather; |
27 | |||
28 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
29 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
30 | |||
31 | #if !defined(CONFIG_PPC_STD_MMU) | ||
32 | |||
33 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
34 | |||
35 | #elif defined(__powerpc64__) | ||
36 | |||
37 | extern void pte_free_finish(void); | ||
38 | |||
39 | static inline void tlb_flush(struct mmu_gather *tlb) | ||
40 | { | ||
41 | flush_tlb_pending(); | ||
42 | pte_free_finish(); | ||
43 | } | ||
44 | |||
45 | #else | ||
46 | |||
25 | extern void tlb_flush(struct mmu_gather *tlb); | 47 | extern void tlb_flush(struct mmu_gather *tlb); |
26 | 48 | ||
49 | #endif | ||
50 | |||
27 | /* Get the generic bits... */ | 51 | /* Get the generic bits... */ |
28 | #include <asm-generic/tlb.h> | 52 | #include <asm-generic/tlb.h> |
29 | 53 | ||
30 | /* Nothing needed here in fact... */ | 54 | #if !defined(CONFIG_PPC_STD_MMU) || defined(__powerpc64__) |
31 | #define tlb_start_vma(tlb, vma) do { } while (0) | 55 | |
32 | #define tlb_end_vma(tlb, vma) do { } while (0) | 56 | #define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) |
33 | 57 | ||
58 | #else | ||
34 | extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, | 59 | extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, |
35 | unsigned long address); | 60 | unsigned long address); |
36 | 61 | ||
@@ -41,17 +66,5 @@ static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, | |||
41 | flush_hash_entry(tlb->mm, ptep, address); | 66 | flush_hash_entry(tlb->mm, ptep, address); |
42 | } | 67 | } |
43 | 68 | ||
44 | #else | 69 | #endif |
45 | /* Embedded PPC with software-loaded TLB, very simple... */ | 70 | #endif /* __ASM_POWERPC_TLB_H */ |
46 | |||
47 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
48 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
49 | #define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) | ||
50 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
51 | |||
52 | /* Get the generic bits... */ | ||
53 | #include <asm-generic/tlb.h> | ||
54 | |||
55 | #endif /* CONFIG_PPC_STD_MMU */ | ||
56 | |||
57 | #endif /* __PPC_TLB_H */ | ||
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h new file mode 100644 index 000000000000..ca3655672bbc --- /dev/null +++ b/include/asm-powerpc/tlbflush.h | |||
@@ -0,0 +1,146 @@ | |||
1 | #ifndef _ASM_POWERPC_TLBFLUSH_H | ||
2 | #define _ASM_POWERPC_TLBFLUSH_H | ||
3 | /* | ||
4 | * TLB flushing: | ||
5 | * | ||
6 | * - flush_tlb_mm(mm) flushes the specified mm context TLB's | ||
7 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
8 | * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB | ||
9 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
10 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
11 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | #ifdef __KERNEL__ | ||
19 | |||
20 | #include <linux/config.h> | ||
21 | |||
22 | struct mm_struct; | ||
23 | |||
24 | #ifdef CONFIG_PPC64 | ||
25 | |||
26 | #include <linux/percpu.h> | ||
27 | #include <asm/page.h> | ||
28 | |||
29 | #define PPC64_TLB_BATCH_NR 192 | ||
30 | |||
31 | struct ppc64_tlb_batch { | ||
32 | unsigned long index; | ||
33 | struct mm_struct *mm; | ||
34 | pte_t pte[PPC64_TLB_BATCH_NR]; | ||
35 | unsigned long vaddr[PPC64_TLB_BATCH_NR]; | ||
36 | unsigned int large; | ||
37 | }; | ||
38 | DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); | ||
39 | |||
40 | extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); | ||
41 | |||
42 | static inline void flush_tlb_pending(void) | ||
43 | { | ||
44 | struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); | ||
45 | |||
46 | if (batch->index) | ||
47 | __flush_tlb_pending(batch); | ||
48 | put_cpu_var(ppc64_tlb_batch); | ||
49 | } | ||
50 | |||
51 | extern void flush_hash_page(unsigned long va, pte_t pte, int local); | ||
52 | void flush_hash_range(unsigned long number, int local); | ||
53 | |||
54 | #else /* CONFIG_PPC64 */ | ||
55 | |||
56 | #include <linux/mm.h> | ||
57 | |||
58 | extern void _tlbie(unsigned long address); | ||
59 | extern void _tlbia(void); | ||
60 | |||
61 | /* | ||
62 | * TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range & | ||
63 | * flush_tlb_kernel_range are best implemented as tlbia vs | ||
64 | * specific tlbie's | ||
65 | */ | ||
66 | |||
67 | #if (defined(CONFIG_4xx) && !defined(CONFIG_44x)) || defined(CONFIG_8xx) | ||
68 | #define flush_tlb_pending() asm volatile ("tlbia; sync" : : : "memory") | ||
69 | #elif defined(CONFIG_4xx) || defined(CONFIG_FSL_BOOKE) | ||
70 | #define flush_tlb_pending() _tlbia() | ||
71 | #endif | ||
72 | |||
73 | /* | ||
74 | * This gets called at the end of handling a page fault, when | ||
75 | * the kernel has put a new PTE into the page table for the process. | ||
76 | * We use it to ensure coherency between the i-cache and d-cache | ||
77 | * for the page which has just been mapped in. | ||
78 | * On machines which use an MMU hash table, we use this to put a | ||
79 | * corresponding HPTE into the hash table ahead of time, instead of | ||
80 | * waiting for the inevitable extra hash-table miss exception. | ||
81 | */ | ||
82 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | ||
83 | |||
84 | #endif /* CONFIG_PPC64 */ | ||
85 | |||
86 | #if defined(CONFIG_PPC64) || defined(CONFIG_4xx) || \ | ||
87 | defined(CONFIG_FSL_BOOKE) || defined(CONFIG_8xx) | ||
88 | |||
89 | static inline void flush_tlb_mm(struct mm_struct *mm) | ||
90 | { | ||
91 | flush_tlb_pending(); | ||
92 | } | ||
93 | |||
94 | static inline void flush_tlb_page(struct vm_area_struct *vma, | ||
95 | unsigned long vmaddr) | ||
96 | { | ||
97 | #ifdef CONFIG_PPC64 | ||
98 | flush_tlb_pending(); | ||
99 | #else | ||
100 | _tlbie(vmaddr); | ||
101 | #endif | ||
102 | } | ||
103 | |||
104 | static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, | ||
105 | unsigned long vmaddr) | ||
106 | { | ||
107 | #ifndef CONFIG_PPC64 | ||
108 | _tlbie(vmaddr); | ||
109 | #endif | ||
110 | } | ||
111 | |||
112 | static inline void flush_tlb_range(struct vm_area_struct *vma, | ||
113 | unsigned long start, unsigned long end) | ||
114 | { | ||
115 | flush_tlb_pending(); | ||
116 | } | ||
117 | |||
118 | static inline void flush_tlb_kernel_range(unsigned long start, | ||
119 | unsigned long end) | ||
120 | { | ||
121 | flush_tlb_pending(); | ||
122 | } | ||
123 | |||
124 | #else /* 6xx, 7xx, 7xxx cpus */ | ||
125 | |||
126 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
127 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); | ||
128 | extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr); | ||
129 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | ||
130 | unsigned long end); | ||
131 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | ||
132 | |||
133 | #endif | ||
134 | |||
135 | /* | ||
136 | * This is called in munmap when we have freed up some page-table | ||
137 | * pages. We don't need to do anything here, there's nothing special | ||
138 | * about our page-table pages. -- paulus | ||
139 | */ | ||
140 | static inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
141 | unsigned long start, unsigned long end) | ||
142 | { | ||
143 | } | ||
144 | |||
145 | #endif /*__KERNEL__ */ | ||
146 | #endif /* _ASM_POWERPC_TLBFLUSH_H */ | ||
diff --git a/include/asm-ppc/tlbflush.h b/include/asm-ppc/tlbflush.h deleted file mode 100644 index 9afee4ffc835..000000000000 --- a/include/asm-ppc/tlbflush.h +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
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_page_nohash(struct vm_area_struct *vma, | ||
33 | unsigned long vmaddr) | ||
34 | { _tlbie(vmaddr); } | ||
35 | static inline void flush_tlb_range(struct vm_area_struct *vma, | ||
36 | unsigned long start, unsigned long end) | ||
37 | { __tlbia(); } | ||
38 | static inline void flush_tlb_kernel_range(unsigned long start, | ||
39 | unsigned long end) | ||
40 | { __tlbia(); } | ||
41 | |||
42 | #elif defined(CONFIG_FSL_BOOKE) | ||
43 | |||
44 | /* TODO: determine if flush_tlb_range & flush_tlb_kernel_range | ||
45 | * are best implemented as tlbia vs specific tlbie's */ | ||
46 | |||
47 | #define __tlbia() _tlbia() | ||
48 | |||
49 | static inline void flush_tlb_mm(struct mm_struct *mm) | ||
50 | { __tlbia(); } | ||
51 | static inline void flush_tlb_page(struct vm_area_struct *vma, | ||
52 | unsigned long vmaddr) | ||
53 | { _tlbie(vmaddr); } | ||
54 | static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, | ||
55 | unsigned long vmaddr) | ||
56 | { _tlbie(vmaddr); } | ||
57 | static inline void flush_tlb_range(struct vm_area_struct *vma, | ||
58 | unsigned long start, unsigned long end) | ||
59 | { __tlbia(); } | ||
60 | static inline void flush_tlb_kernel_range(unsigned long start, | ||
61 | unsigned long end) | ||
62 | { __tlbia(); } | ||
63 | |||
64 | #elif defined(CONFIG_8xx) | ||
65 | #define __tlbia() asm volatile ("tlbia; sync" : : : "memory") | ||
66 | |||
67 | static inline void flush_tlb_mm(struct mm_struct *mm) | ||
68 | { __tlbia(); } | ||
69 | static inline void flush_tlb_page(struct vm_area_struct *vma, | ||
70 | unsigned long vmaddr) | ||
71 | { _tlbie(vmaddr); } | ||
72 | static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, | ||
73 | unsigned long vmaddr) | ||
74 | { _tlbie(vmaddr); } | ||
75 | static inline void flush_tlb_range(struct vm_area_struct *vma, | ||
76 | unsigned long start, unsigned long end) | ||
77 | { __tlbia(); } | ||
78 | static inline void flush_tlb_kernel_range(unsigned long start, | ||
79 | unsigned long end) | ||
80 | { __tlbia(); } | ||
81 | |||
82 | #else /* 6xx, 7xx, 7xxx cpus */ | ||
83 | struct mm_struct; | ||
84 | struct vm_area_struct; | ||
85 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
86 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); | ||
87 | extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr); | ||
88 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | ||
89 | unsigned long end); | ||
90 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | ||
91 | #endif | ||
92 | |||
93 | /* | ||
94 | * This is called in munmap when we have freed up some page-table | ||
95 | * pages. We don't need to do anything here, there's nothing special | ||
96 | * about our page-table pages. -- paulus | ||
97 | */ | ||
98 | static inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
99 | unsigned long start, unsigned long end) | ||
100 | { | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * This gets called at the end of handling a page fault, when | ||
105 | * the kernel has put a new PTE into the page table for the process. | ||
106 | * We use it to ensure coherency between the i-cache and d-cache | ||
107 | * for the page which has just been mapped in. | ||
108 | * On machines which use an MMU hash table, we use this to put a | ||
109 | * corresponding HPTE into the hash table ahead of time, instead of | ||
110 | * waiting for the inevitable extra hash-table miss exception. | ||
111 | */ | ||
112 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | ||
113 | |||
114 | #endif /* _PPC_TLBFLUSH_H */ | ||
115 | #endif /*__KERNEL__ */ | ||
diff --git a/include/asm-ppc64/tlb.h b/include/asm-ppc64/tlb.h deleted file mode 100644 index 97cb696ce68d..000000000000 --- a/include/asm-ppc64/tlb.h +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * TLB shootdown specifics for PPC64 | ||
3 | * | ||
4 | * Copyright (C) 2002 Anton Blanchard, IBM Corp. | ||
5 | * Copyright (C) 2002 Paul Mackerras, IBM Corp. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | #ifndef _PPC64_TLB_H | ||
13 | #define _PPC64_TLB_H | ||
14 | |||
15 | #include <asm/tlbflush.h> | ||
16 | |||
17 | struct mmu_gather; | ||
18 | |||
19 | extern void pte_free_finish(void); | ||
20 | |||
21 | static inline void tlb_flush(struct mmu_gather *tlb) | ||
22 | { | ||
23 | flush_tlb_pending(); | ||
24 | pte_free_finish(); | ||
25 | } | ||
26 | |||
27 | /* Avoid pulling in another include just for this */ | ||
28 | #define check_pgt_cache() do { } while (0) | ||
29 | |||
30 | /* Get the generic bits... */ | ||
31 | #include <asm-generic/tlb.h> | ||
32 | |||
33 | /* Nothing needed here in fact... */ | ||
34 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
35 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
36 | |||
37 | #define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) | ||
38 | |||
39 | #endif /* _PPC64_TLB_H */ | ||
diff --git a/include/asm-ppc64/tlbflush.h b/include/asm-ppc64/tlbflush.h deleted file mode 100644 index 626f505c6ee3..000000000000 --- a/include/asm-ppc64/tlbflush.h +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | #ifndef _PPC64_TLBFLUSH_H | ||
2 | #define _PPC64_TLBFLUSH_H | ||
3 | |||
4 | /* | ||
5 | * TLB flushing: | ||
6 | * | ||
7 | * - flush_tlb_mm(mm) flushes the specified mm context TLB's | ||
8 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
9 | * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB | ||
10 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
11 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
12 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | ||
13 | */ | ||
14 | |||
15 | #include <linux/percpu.h> | ||
16 | #include <asm/page.h> | ||
17 | |||
18 | #define PPC64_TLB_BATCH_NR 192 | ||
19 | |||
20 | struct mm_struct; | ||
21 | struct ppc64_tlb_batch { | ||
22 | unsigned long index; | ||
23 | struct mm_struct *mm; | ||
24 | pte_t pte[PPC64_TLB_BATCH_NR]; | ||
25 | unsigned long vaddr[PPC64_TLB_BATCH_NR]; | ||
26 | unsigned int large; | ||
27 | }; | ||
28 | DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); | ||
29 | |||
30 | extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); | ||
31 | |||
32 | static inline void flush_tlb_pending(void) | ||
33 | { | ||
34 | struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); | ||
35 | |||
36 | if (batch->index) | ||
37 | __flush_tlb_pending(batch); | ||
38 | put_cpu_var(ppc64_tlb_batch); | ||
39 | } | ||
40 | |||
41 | #define flush_tlb_mm(mm) flush_tlb_pending() | ||
42 | #define flush_tlb_page(vma, addr) flush_tlb_pending() | ||
43 | #define flush_tlb_page_nohash(vma, addr) do { } while (0) | ||
44 | #define flush_tlb_range(vma, start, end) \ | ||
45 | do { (void)(start); flush_tlb_pending(); } while (0) | ||
46 | #define flush_tlb_kernel_range(start, end) flush_tlb_pending() | ||
47 | #define flush_tlb_pgtables(mm, start, end) do { } while (0) | ||
48 | |||
49 | extern void flush_hash_page(unsigned long va, pte_t pte, int local); | ||
50 | void flush_hash_range(unsigned long number, int local); | ||
51 | |||
52 | #endif /* _PPC64_TLBFLUSH_H */ | ||