aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/include/asm/page.h8
-rw-r--r--arch/mips/mm/tlb-r4k.c20
2 files changed, 22 insertions, 6 deletions
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index e59cd1ac09c2..d41790928c64 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -38,6 +38,14 @@
38#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 38#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
39#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 39#define HPAGE_MASK (~(HPAGE_SIZE - 1))
40#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 40#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
41#else /* !CONFIG_HUGETLB_PAGE */
42# ifndef BUILD_BUG
43# define BUILD_BUG() do { extern void __build_bug(void); __build_bug(); } while (0)
44# endif
45#define HPAGE_SHIFT ({BUILD_BUG(); 0; })
46#define HPAGE_SIZE ({BUILD_BUG(); 0; })
47#define HPAGE_MASK ({BUILD_BUG(); 0; })
48#define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; })
41#endif /* CONFIG_HUGETLB_PAGE */ 49#endif /* CONFIG_HUGETLB_PAGE */
42 50
43#ifndef __ASSEMBLY__ 51#ifndef __ASSEMBLY__
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 0d394e0e8837..88dc49cfa163 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -120,22 +120,30 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
120 120
121 if (cpu_context(cpu, mm) != 0) { 121 if (cpu_context(cpu, mm) != 0) {
122 unsigned long size, flags; 122 unsigned long size, flags;
123 int huge = is_vm_hugetlb_page(vma);
123 124
124 ENTER_CRITICAL(flags); 125 ENTER_CRITICAL(flags);
125 size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 126 if (huge) {
126 size = (size + 1) >> 1; 127 start = round_down(start, HPAGE_SIZE);
128 end = round_up(end, HPAGE_SIZE);
129 size = (end - start) >> HPAGE_SHIFT;
130 } else {
131 start = round_down(start, PAGE_SIZE << 1);
132 end = round_up(end, PAGE_SIZE << 1);
133 size = (end - start) >> (PAGE_SHIFT + 1);
134 }
127 if (size <= current_cpu_data.tlbsize/2) { 135 if (size <= current_cpu_data.tlbsize/2) {
128 int oldpid = read_c0_entryhi(); 136 int oldpid = read_c0_entryhi();
129 int newpid = cpu_asid(cpu, mm); 137 int newpid = cpu_asid(cpu, mm);
130 138
131 start &= (PAGE_MASK << 1);
132 end += ((PAGE_SIZE << 1) - 1);
133 end &= (PAGE_MASK << 1);
134 while (start < end) { 139 while (start < end) {
135 int idx; 140 int idx;
136 141
137 write_c0_entryhi(start | newpid); 142 write_c0_entryhi(start | newpid);
138 start += (PAGE_SIZE << 1); 143 if (huge)
144 start += HPAGE_SIZE;
145 else
146 start += (PAGE_SIZE << 1);
139 mtc0_tlbw_hazard(); 147 mtc0_tlbw_hazard();
140 tlb_probe(); 148 tlb_probe();
141 tlb_probe_hazard(); 149 tlb_probe_hazard();