]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/sh/include/asm/tlb.h
5 # include <asm/tlb_64.h>
9 #include <linux/pagemap.h>
12 #include <linux/swap.h>
13 #include <asm/pgalloc.h>
14 #include <asm/tlbflush.h>
15 #include <asm/mmu_context.h>
18 * TLB handling. This allows us to remove pages from the page
19 * tables, and efficiently handle the TLB issues.
24 unsigned long start
, end
;
27 static inline void init_tlb_gather(struct mmu_gather
*tlb
)
29 tlb
->start
= TASK_SIZE
;
39 arch_tlb_gather_mmu(struct mmu_gather
*tlb
, struct mm_struct
*mm
,
40 unsigned long start
, unsigned long end
)
45 tlb
->fullmm
= !(start
| (end
+1));
51 arch_tlb_finish_mmu(struct mmu_gather
*tlb
,
52 unsigned long start
, unsigned long end
, bool force
)
54 if (tlb
->fullmm
|| force
)
55 flush_tlb_mm(tlb
->mm
);
57 /* keep the page table cache within bounds */
62 tlb_remove_tlb_entry(struct mmu_gather
*tlb
, pte_t
*ptep
, unsigned long address
)
64 if (tlb
->start
> address
)
66 if (tlb
->end
< address
+ PAGE_SIZE
)
67 tlb
->end
= address
+ PAGE_SIZE
;
70 #define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \
71 tlb_remove_tlb_entry(tlb, ptep, address)
74 * In the case of tlb vma handling, we can optimise these away in the
75 * case where we're doing a full MM flush. When we're doing a munmap,
76 * the vmas are adjusted to only cover the region to be torn down.
79 tlb_start_vma(struct mmu_gather
*tlb
, struct vm_area_struct
*vma
)
82 flush_cache_range(vma
, vma
->vm_start
, vma
->vm_end
);
86 tlb_end_vma(struct mmu_gather
*tlb
, struct vm_area_struct
*vma
)
88 if (!tlb
->fullmm
&& tlb
->end
) {
89 flush_tlb_range(vma
, tlb
->start
, tlb
->end
);
94 static inline void tlb_flush_mmu_tlbonly(struct mmu_gather
*tlb
)
98 static inline void tlb_flush_mmu_free(struct mmu_gather
*tlb
)
102 static inline void tlb_flush_mmu(struct mmu_gather
*tlb
)
106 static inline int __tlb_remove_page(struct mmu_gather
*tlb
, struct page
*page
)
108 free_page_and_swap_cache(page
);
109 return false; /* avoid calling tlb_flush_mmu */
112 static inline void tlb_remove_page(struct mmu_gather
*tlb
, struct page
*page
)
114 __tlb_remove_page(tlb
, page
);
117 static inline bool __tlb_remove_page_size(struct mmu_gather
*tlb
,
118 struct page
*page
, int page_size
)
120 return __tlb_remove_page(tlb
, page
);
123 static inline void tlb_remove_page_size(struct mmu_gather
*tlb
,
124 struct page
*page
, int page_size
)
126 return tlb_remove_page(tlb
, page
);
129 #define tlb_remove_check_page_size_change tlb_remove_check_page_size_change
130 static inline void tlb_remove_check_page_size_change(struct mmu_gather
*tlb
,
131 unsigned int page_size
)
135 #define pte_free_tlb(tlb, ptep, addr) pte_free((tlb)->mm, ptep)
136 #define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp)
137 #define pud_free_tlb(tlb, pudp, addr) pud_free((tlb)->mm, pudp)
139 #define tlb_migrate_finish(mm) do { } while (0)
141 #if defined(CONFIG_CPU_SH4) || defined(CONFIG_SUPERH64)
142 extern void tlb_wire_entry(struct vm_area_struct
*, unsigned long, pte_t
);
143 extern void tlb_unwire_entry(void);
145 static inline void tlb_wire_entry(struct vm_area_struct
*vma
,
146 unsigned long addr
, pte_t pte
)
151 static inline void tlb_unwire_entry(void)
157 #else /* CONFIG_MMU */
159 #define tlb_start_vma(tlb, vma) do { } while (0)
160 #define tlb_end_vma(tlb, vma) do { } while (0)
161 #define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
162 #define tlb_flush(tlb) do { } while (0)
164 #include <asm-generic/tlb.h>
166 #endif /* CONFIG_MMU */
167 #endif /* __ASSEMBLY__ */
168 #endif /* __ASM_SH_TLB_H */