Skip to content

Commit ac65e28

Browse files
Nitin Guptadavem330
authored andcommitted
sparc64: Fix build error in flush_tsb_user_page
Patch "sparc64: Add 64K page size support" unconditionally used __flush_huge_tsb_one_entry() which is available only when hugetlb support is enabled. Another issue was incorrect TSB flushing for 64K pages in flush_tsb_user(). Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cd429ce commit ac65e28

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

arch/sparc/mm/hugetlbpage.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
309309

310310
addr &= ~(size - 1);
311311
orig = *ptep;
312-
orig_shift = pte_none(orig) ? PAGE_SIZE : huge_tte_to_shift(orig);
312+
orig_shift = pte_none(orig) ? PAGE_SHIFT : huge_tte_to_shift(orig);
313313

314314
for (i = 0; i < nptes; i++)
315315
ptep[i] = __pte(pte_val(entry) + (i << shift));
@@ -335,7 +335,8 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
335335
else
336336
nptes = size >> PAGE_SHIFT;
337337

338-
hugepage_shift = pte_none(entry) ? PAGE_SIZE : huge_tte_to_shift(entry);
338+
hugepage_shift = pte_none(entry) ? PAGE_SHIFT :
339+
huge_tte_to_shift(entry);
339340

340341
if (pte_present(entry))
341342
mm->context.hugetlb_pte_count -= nptes;

arch/sparc/mm/tsb.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,18 @@ void flush_tsb_user(struct tlb_batch *tb)
120120

121121
spin_lock_irqsave(&mm->context.lock, flags);
122122

123-
if (tb->hugepage_shift == PAGE_SHIFT) {
123+
if (tb->hugepage_shift < HPAGE_SHIFT) {
124124
base = (unsigned long) mm->context.tsb_block[MM_TSB_BASE].tsb;
125125
nentries = mm->context.tsb_block[MM_TSB_BASE].tsb_nentries;
126126
if (tlb_type == cheetah_plus || tlb_type == hypervisor)
127127
base = __pa(base);
128-
__flush_tsb_one(tb, PAGE_SHIFT, base, nentries);
128+
if (tb->hugepage_shift == PAGE_SHIFT)
129+
__flush_tsb_one(tb, PAGE_SHIFT, base, nentries);
130+
#if defined(CONFIG_HUGETLB_PAGE)
131+
else
132+
__flush_huge_tsb_one(tb, PAGE_SHIFT, base, nentries,
133+
tb->hugepage_shift);
134+
#endif
129135
}
130136
#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
131137
else if (mm->context.tsb_block[MM_TSB_HUGE].tsb) {
@@ -152,8 +158,14 @@ void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr,
152158
nentries = mm->context.tsb_block[MM_TSB_BASE].tsb_nentries;
153159
if (tlb_type == cheetah_plus || tlb_type == hypervisor)
154160
base = __pa(base);
155-
__flush_huge_tsb_one_entry(base, vaddr, PAGE_SHIFT, nentries,
156-
hugepage_shift);
161+
if (hugepage_shift == PAGE_SHIFT)
162+
__flush_tsb_one_entry(base, vaddr, PAGE_SHIFT,
163+
nentries);
164+
#if defined(CONFIG_HUGETLB_PAGE)
165+
else
166+
__flush_huge_tsb_one_entry(base, vaddr, PAGE_SHIFT,
167+
nentries, hugepage_shift);
168+
#endif
157169
}
158170
#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
159171
else if (mm->context.tsb_block[MM_TSB_HUGE].tsb) {

0 commit comments

Comments
 (0)