diff options
author | David S. Miller <davem@davemloft.net> | 2017-08-10 19:49:15 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-10 19:49:15 +0300 |
commit | 4d9fbf539b52810cd2903719b181ed3d3ccd861f (patch) | |
tree | 981775e1ac718a5f4ff7fb2296c92f4fc545441f /arch/sparc/mm/hugetlbpage.c | |
parent | 5389e239eba5ef0e1cad596dba4860890a3e6965 (diff) | |
download | linux-4d9fbf539b52810cd2903719b181ed3d3ccd861f.tar.xz |
sparc64: Revert 16GB huge page support.
It overflows the amount of space available in the initial .text section
of trap handler assembler in some configurations, resulting in build
failures.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/mm/hugetlbpage.c')
-rw-r--r-- | arch/sparc/mm/hugetlbpage.c | 102 |
1 files changed, 42 insertions, 60 deletions
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c index bcd8cdbc377f..28ee8d8ffa07 100644 --- a/arch/sparc/mm/hugetlbpage.c +++ b/arch/sparc/mm/hugetlbpage.c @@ -143,10 +143,6 @@ static pte_t sun4v_hugepage_shift_to_tte(pte_t entry, unsigned int shift) pte_val(entry) = pte_val(entry) & ~_PAGE_SZALL_4V; switch (shift) { - case HPAGE_16GB_SHIFT: - hugepage_size = _PAGE_SZ16GB_4V; - pte_val(entry) |= _PAGE_PUD_HUGE; - break; case HPAGE_2GB_SHIFT: hugepage_size = _PAGE_SZ2GB_4V; pte_val(entry) |= _PAGE_PMD_HUGE; @@ -191,9 +187,6 @@ static unsigned int sun4v_huge_tte_to_shift(pte_t entry) unsigned int shift; switch (tte_szbits) { - case _PAGE_SZ16GB_4V: - shift = HPAGE_16GB_SHIFT; - break; case _PAGE_SZ2GB_4V: shift = HPAGE_2GB_SHIFT; break; @@ -266,19 +259,22 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, pgd_t *pgd; pud_t *pud; pmd_t *pmd; + pte_t *pte = NULL; pgd = pgd_offset(mm, addr); pud = pud_alloc(mm, pgd, addr); - if (!pud) - return NULL; - if (sz >= PUD_SIZE) - return (pte_t *)pud; - pmd = pmd_alloc(mm, pud, addr); - if (!pmd) - return NULL; - if (sz >= PMD_SIZE) - return (pte_t *)pmd; - return pte_alloc_map(mm, pmd, addr); + if (pud) { + pmd = pmd_alloc(mm, pud, addr); + if (!pmd) + return NULL; + + if (sz >= PMD_SIZE) + pte = (pte_t *)pmd; + else + pte = pte_alloc_map(mm, pmd, addr); + } + + return pte; } pte_t *huge_pte_offset(struct mm_struct *mm, @@ -287,40 +283,34 @@ pte_t *huge_pte_offset(struct mm_struct *mm, pgd_t *pgd; pud_t *pud; pmd_t *pmd; + pte_t *pte = NULL; pgd = pgd_offset(mm, addr); - if (pgd_none(*pgd)) - return NULL; - pud = pud_offset(pgd, addr); - if (pud_none(*pud)) - return NULL; - if (is_hugetlb_pud(*pud)) - return (pte_t *)pud; - pmd = pmd_offset(pud, addr); - if (pmd_none(*pmd)) - return NULL; - if (is_hugetlb_pmd(*pmd)) - return (pte_t *)pmd; - return pte_offset_map(pmd, addr); + if (!pgd_none(*pgd)) { + pud = pud_offset(pgd, addr); + if (!pud_none(*pud)) { + pmd = pmd_offset(pud, addr); + if (!pmd_none(*pmd)) { + if (is_hugetlb_pmd(*pmd)) + pte = (pte_t *)pmd; + else + pte = pte_offset_map(pmd, addr); + } + } + } + + return pte; } void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t entry) { - unsigned int nptes, orig_shift, shift; - unsigned long i, size; + unsigned int i, nptes, orig_shift, shift; + unsigned long size; pte_t orig; size = huge_tte_to_size(entry); - - shift = PAGE_SHIFT; - if (size >= PUD_SIZE) - shift = PUD_SHIFT; - else if (size >= PMD_SIZE) - shift = PMD_SHIFT; - else - shift = PAGE_SHIFT; - + shift = size >= HPAGE_SIZE ? PMD_SHIFT : PAGE_SHIFT; nptes = size >> shift; if (!pte_present(*ptep) && pte_present(entry)) @@ -343,23 +333,19 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { - unsigned int i, nptes, orig_shift, shift; + unsigned int i, nptes, hugepage_shift; unsigned long size; pte_t entry; entry = *ptep; size = huge_tte_to_size(entry); - - shift = PAGE_SHIFT; - if (size >= PUD_SIZE) - shift = PUD_SHIFT; - else if (size >= PMD_SIZE) - shift = PMD_SHIFT; + if (size >= HPAGE_SIZE) + nptes = size >> PMD_SHIFT; else - shift = PAGE_SHIFT; + nptes = size >> PAGE_SHIFT; - nptes = size >> shift; - orig_shift = pte_none(entry) ? PAGE_SHIFT : huge_tte_to_shift(entry); + hugepage_shift = pte_none(entry) ? PAGE_SHIFT : + huge_tte_to_shift(entry); if (pte_present(entry)) mm->context.hugetlb_pte_count -= nptes; @@ -368,11 +354,11 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, for (i = 0; i < nptes; i++) ptep[i] = __pte(0UL); - maybe_tlb_batch_add(mm, addr, ptep, entry, 0, orig_shift); + maybe_tlb_batch_add(mm, addr, ptep, entry, 0, hugepage_shift); /* An HPAGE_SIZE'ed page is composed of two REAL_HPAGE_SIZE'ed pages */ if (size == HPAGE_SIZE) maybe_tlb_batch_add(mm, addr + REAL_HPAGE_SIZE, ptep, entry, 0, - orig_shift); + hugepage_shift); return entry; } @@ -385,8 +371,7 @@ int pmd_huge(pmd_t pmd) int pud_huge(pud_t pud) { - return !pud_none(pud) && - (pud_val(pud) & (_PAGE_VALID|_PAGE_PUD_HUGE)) != _PAGE_VALID; + return 0; } static void hugetlb_free_pte_range(struct mmu_gather *tlb, pmd_t *pmd, @@ -450,11 +435,8 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, next = pud_addr_end(addr, end); if (pud_none_or_clear_bad(pud)) continue; - if (is_hugetlb_pud(*pud)) - pud_clear(pud); - else - hugetlb_free_pmd_range(tlb, pud, addr, next, floor, - ceiling); + hugetlb_free_pmd_range(tlb, pud, addr, next, floor, + ceiling); } while (pud++, addr = next, addr != end); start &= PGDIR_MASK; |