0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <linux/kernel.h>
0021 #include <linux/mm.h>
0022 #include <linux/init.h>
0023 #include <linux/highmem.h>
0024 #include <linux/pagemap.h>
0025 #include <linux/export.h>
0026
0027 #include <asm/tlbflush.h>
0028 #include <asm/tlb.h>
0029
0030 #include <mm/mmu_decl.h>
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 void hash__flush_range(struct mm_struct *mm, unsigned long start, unsigned long end)
0051 {
0052 pmd_t *pmd;
0053 unsigned long pmd_end;
0054 int count;
0055 unsigned int ctx = mm->context.id;
0056
0057 start &= PAGE_MASK;
0058 if (start >= end)
0059 return;
0060 end = (end - 1) | ~PAGE_MASK;
0061 pmd = pmd_off(mm, start);
0062 for (;;) {
0063 pmd_end = ((start + PGDIR_SIZE) & PGDIR_MASK) - 1;
0064 if (pmd_end > end)
0065 pmd_end = end;
0066 if (!pmd_none(*pmd)) {
0067 count = ((pmd_end - start) >> PAGE_SHIFT) + 1;
0068 flush_hash_pages(ctx, start, pmd_val(*pmd), count);
0069 }
0070 if (pmd_end == end)
0071 break;
0072 start = pmd_end + 1;
0073 ++pmd;
0074 }
0075 }
0076 EXPORT_SYMBOL(hash__flush_range);
0077
0078
0079
0080
0081 void hash__flush_tlb_mm(struct mm_struct *mm)
0082 {
0083 struct vm_area_struct *mp;
0084
0085
0086
0087
0088
0089
0090
0091 for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
0092 hash__flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
0093 }
0094 EXPORT_SYMBOL(hash__flush_tlb_mm);
0095
0096 void hash__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
0097 {
0098 struct mm_struct *mm;
0099 pmd_t *pmd;
0100
0101 mm = (vmaddr < TASK_SIZE)? vma->vm_mm: &init_mm;
0102 pmd = pmd_off(mm, vmaddr);
0103 if (!pmd_none(*pmd))
0104 flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
0105 }
0106 EXPORT_SYMBOL(hash__flush_tlb_page);