]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/include/asm-arm/tlb.h | |
3 | * | |
4 | * Copyright (C) 2002 Russell King | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | * | |
10 | * Experimentation shows that on a StrongARM, it appears to be faster | |
11 | * to use the "invalidate whole tlb" rather than "invalidate single | |
12 | * tlb" for this. | |
13 | * | |
14 | * This appears true for both the process fork+exit case, as well as | |
15 | * the munmap-large-area case. | |
16 | */ | |
17 | #ifndef __ASMARM_TLB_H | |
18 | #define __ASMARM_TLB_H | |
19 | ||
20 | #include <asm/cacheflush.h> | |
21 | #include <asm/tlbflush.h> | |
22 | #include <asm/pgalloc.h> | |
23 | ||
24 | /* | |
25 | * TLB handling. This allows us to remove pages from the page | |
26 | * tables, and efficiently handle the TLB issues. | |
27 | */ | |
28 | struct mmu_gather { | |
29 | struct mm_struct *mm; | |
1da177e4 | 30 | unsigned int fullmm; |
1da177e4 LT |
31 | }; |
32 | ||
33 | DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); | |
34 | ||
35 | static inline struct mmu_gather * | |
36 | tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) | |
37 | { | |
15a23ffa | 38 | struct mmu_gather *tlb = &get_cpu_var(mmu_gathers); |
1da177e4 LT |
39 | |
40 | tlb->mm = mm; | |
1da177e4 LT |
41 | tlb->fullmm = full_mm_flush; |
42 | ||
43 | return tlb; | |
44 | } | |
45 | ||
46 | static inline void | |
47 | tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) | |
48 | { | |
1da177e4 | 49 | if (tlb->fullmm) |
fc2acab3 | 50 | flush_tlb_mm(tlb->mm); |
1da177e4 LT |
51 | |
52 | /* keep the page table cache within bounds */ | |
53 | check_pgt_cache(); | |
15a23ffa HD |
54 | |
55 | put_cpu_var(mmu_gathers); | |
1da177e4 LT |
56 | } |
57 | ||
1da177e4 LT |
58 | #define tlb_remove_tlb_entry(tlb,ptep,address) do { } while (0) |
59 | ||
60 | /* | |
61 | * In the case of tlb vma handling, we can optimise these away in the | |
62 | * case where we're doing a full MM flush. When we're doing a munmap, | |
63 | * the vmas are adjusted to only cover the region to be torn down. | |
64 | */ | |
65 | static inline void | |
66 | tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) | |
67 | { | |
68 | if (!tlb->fullmm) | |
69 | flush_cache_range(vma, vma->vm_start, vma->vm_end); | |
70 | } | |
71 | ||
72 | static inline void | |
73 | tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) | |
74 | { | |
75 | if (!tlb->fullmm) | |
76 | flush_tlb_range(vma, vma->vm_start, vma->vm_end); | |
77 | } | |
78 | ||
79 | #define tlb_remove_page(tlb,page) free_page_and_swap_cache(page) | |
80 | #define pte_free_tlb(tlb,ptep) pte_free(ptep) | |
81 | #define pmd_free_tlb(tlb,pmdp) pmd_free(pmdp) | |
82 | ||
83 | #define tlb_migrate_finish(mm) do { } while (0) | |
84 | ||
85 | #endif |